Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
folkforms committed Apr 24, 2024
1 parent 1d0c614 commit b99f352
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 57 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
cookbook/public/**
cookbook/src/gatsby-theme-carbon/**
dist/**
node_modules/**
reports/**
storybook-static/**
56 changes: 29 additions & 27 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@


/* eslint-disable no-console */
const path = require('path');
const gulp = require('gulp');
const shell = require('shelljs');
const path = require("path");
const gulp = require("gulp");
const shell = require("shelljs");

// Load env vars from the .env file.
require('dotenv').config();
require("dotenv").config();

/*
* This task generates a development bundle to the specified output folder.
Expand All @@ -24,29 +22,36 @@ require('dotenv').config();
* before it is transpiled by Babel.
*/

gulp.task('deploy:spm', async () => {
gulp.task("deploy:spm", async () => {
if (process.env.CLIENT_DIR) {
const customComponentName = process.env.CUSTOM_COMPONENT_NAME || "custom";
const customComponentLocation = process.env.CLIENT_DIR + "/components/" + customComponentName + "/WebContent/CDEJ/jscript/SPMUIComponents";
shell.echo(`\n[INFO] Copying the generated files to custom component: ${customComponentLocation}`);
const customComponentLocation = `${process.env.CLIENT_DIR}/components/${customComponentName}/WebContent/CDEJ/jscript/SPMUIComponents`;
shell.echo(
`\n[INFO] Copying the generated files to custom component: ${customComponentLocation}`,
);
shell.exec(
`webpack --mode=development --devtool=eval-source-map\
--output-path=${customComponentLocation}`,
{ fatal: true }
{ fatal: true },
);
} else {
throw new Error("Env var CLIENT_DIR is not defined in the .env file. It should be set to the weblicent directory.")
throw new Error(
"Env var CLIENT_DIR is not defined in the .env file. It should be set to the weblicent directory.",
);
}
});

gulp.task('dev:spm', () => {
gulp.task("dev:spm", () => {
if (!process.env.CLIENT_DIR) {
throw new Error("Env var CLIENT_DIR is not defined in the .env file. It should be set to the weblicent directory.")
throw new Error(
"Env var CLIENT_DIR is not defined in the .env file. It should be set to the weblicent directory.",
);
}
const cdejLocation = process.env.RELATIVE_PATH_TO_BUNDLE || "CDEJ/jscript/SPMUIComponents";
const cdejLocation =
process.env.RELATIVE_PATH_TO_BUNDLE || "CDEJ/jscript/SPMUIComponents";
const output =
process.env.CLIENT_DIR + "/WebContent/" + cdejLocation ||
path.resolve(__dirname, '/dist');
`${process.env.CLIENT_DIR}/WebContent/${cdejLocation}` ||
path.resolve(__dirname, "/dist");

shell.echo(`\n[INFO] Generating the dev bundle to path: ${output}
[INFO] Any changes to the files will automatically trigger a new bundle generation.`);
Expand All @@ -55,22 +60,19 @@ gulp.task('dev:spm', () => {
`webpack --mode=development --devtool=eval-source-map\
--output-path=${output} --watch\
`,
{ fatal: true }
{ fatal: true },
);

shell.echo(`\n\n[INFO] Bundle Generated into ${output} \n[INFO] Watching for file changes`);

shell.echo(
`\n\n[INFO] Bundle Generated into ${output} \n[INFO] Watching for file changes`,
);
});

gulp.task('prod:spm', (done) => {
const output = path.resolve(__dirname, '/dist');
gulp.task("prod:spm", (done) => {
const output = path.resolve(__dirname, "/dist");

shell.echo(`\n[INFO] Generating the dev bundle to path: ${output}.`);

shell.exec(
`webpack --mode production`,
{ fatal: true}
);
shell.exec(`webpack --mode production`, { fatal: true });
done();
});

4 changes: 2 additions & 2 deletions packages/carbon-addons-devenv/sample_renderers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright Merative US L.P. 2020
*/

import PersonFolio from './PersonFolio';
import Logo from './Logo';
import PersonFolio from "./personFolio";
import Logo from "./logo";

export default { PersonFolio, Logo };
13 changes: 6 additions & 7 deletions packages/graphql-mocks/resolvers/data/sampleLogoData.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

const logoData = (parent, args) => {
if (args.logoId == 'id_1') {
return {name: 'avatar__adult--125-enabled.svg', logoId: 'id_1'};
if (args.logoId === "id_1") {
return { name: "avatar__adult--125-enabled.svg", logoId: "id_1" };
}
return {name: 'avatar__child--125-enabled.svg', logoId: 'id_2'};
}
module.exports = { logoData };
return { name: "avatar__child--125-enabled.svg", logoId: "id_2" };
};

module.exports = { logoData };
42 changes: 21 additions & 21 deletions packages/graphql-mocks/server.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
const express = require('express');
const cors = require('cors');
const { graphqlHTTP } = require('express-graphql');
const { makeExecutableSchema } = require('@graphql-tools/schema');
const open = require('open');
const { TypeDefs } = require('./typeDefs');
const { Resolvers } = require('./resolvers');
const express = require("express");
const cors = require("cors");
const { graphqlHTTP } = require("express-graphql");
const { makeExecutableSchema } = require("@graphql-tools/schema");
const open = require("open");
const { TypeDefs } = require("./typeDefs");
const { Resolvers } = require("./resolvers");


const schema = makeExecutableSchema({
const schema = makeExecutableSchema({
typeDefs: TypeDefs,
resolvers: Resolvers,
});

const app = express();
app.use(cors({
origin: '*'
}));
app.use('/graphql', graphqlHTTP({
schema,
graphiql: true,
}));
app.use(
cors({
origin: "*",
}),
);
app.use(
"/graphql",
graphqlHTTP({
schema,
graphiql: true,
}),
);
app.listen(4000);
open('http://localhost:4000/graphql');
console.log('...........................................................');
console.log('Running GraphQL mocks api at http://localhost:4000/graphql');
console.log('...........................................................');
console.log('');
open("http://localhost:4000/graphql");

0 comments on commit b99f352

Please sign in to comment.