Skip to content

Commit ec342c6

Browse files
authored
Fix ESLint issues (#10199)
* Fix ESLint issues * Avoid using eslint flag config in VSCode
1 parent 839b6f0 commit ec342c6

File tree

16 files changed

+26
-12
lines changed

16 files changed

+26
-12
lines changed

.eslintrc.cjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ module.exports = {
5656
project: ['./tsconfig.json'],
5757
},
5858
},
59+
{
60+
files: ['scripts/*.{ts,js}', 'prettier.config.cjs', 'jest.config.js', 'jest.project.js'],
61+
rules: {
62+
'@typescript-eslint/no-require-imports': 'off',
63+
},
64+
},
5965
],
6066
ignorePatterns: [
6167
'dev-test',

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"yaml.schemas": {
33
"./website/static/config.schema.json": "*codegen.*"
44
},
5+
"eslint.useFlatConfig": false,
56
"editor.tabSize": 2,
67
"editor.insertSpaces": true,
78
"editor.rulers": [80],

packages/graphql-codegen-cli/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export async function runCli(cmd: string): Promise<number> {
3131
export async function ensureGraphQlPackage() {
3232
try {
3333
await import('graphql');
34-
} catch (e) {
34+
} catch {
3535
throw new Error(
3636
`Unable to load "graphql" package. Please make sure to install "graphql" as a dependency! \n
3737
To install "graphql", run:

packages/graphql-codegen-cli/src/graphql-config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function isGraphQLConfig(config: GraphQLConfig): config is GraphQLConfig {
5757

5858
try {
5959
return config.getDefault().hasExtension('codegen');
60-
} catch (e) {}
60+
} catch {}
6161

6262
try {
6363
for (const projectName in config.projects) {
@@ -69,7 +69,7 @@ function isGraphQLConfig(config: GraphQLConfig): config is GraphQLConfig {
6969
}
7070
}
7171
}
72-
} catch (e) {}
72+
} catch {}
7373

7474
return false;
7575
}

packages/graphql-codegen-cli/src/utils/watcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export const createWatcher = (
119119
// In ESM require is not defined
120120
try {
121121
delete require.cache[path];
122-
} catch (err) {}
122+
} catch {}
123123

124124
if (eventName === 'update' && config.configFilePath && path === config.configFilePath) {
125125
log(`${logSymbols.info} Config file has changed, reloading...`);

packages/graphql-codegen-cli/tests/__mocks__/some-fetch.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-require-imports */
12
const {
23
promises: { readFile },
34
} = require('fs');

packages/graphql-codegen-cli/tests/custom-loaders/custom-documents-loader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-require-imports */
12
const { parse } = require('graphql');
23
const { readFileSync } = require('fs');
34
const { join } = require('path');

packages/graphql-codegen-cli/tests/custom-loaders/custom-schema-loader-with-context.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-require-imports */
12
const { buildSchema } = require('graphql');
23
const { readFileSync } = require('fs');
34
const { join } = require('path');

packages/graphql-codegen-cli/tests/custom-loaders/custom-schema-loader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-require-imports */
12
const { buildSchema } = require('graphql');
23
const { readFileSync } = require('fs');
34
const { join } = require('path');

packages/graphql-codegen-cli/tests/init.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-require-imports */
12
import { resolve } from 'path';
23
import bddStdin from 'bdd-stdin';
34
import { bold } from '../src/init/helpers.js';

0 commit comments

Comments
 (0)