Skip to content

Commit

Permalink
update to eslint 9 (#2452)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency eslint to v9

* upd

* upd

* upd

* more

* more

* more

* more

* prettier

* fix type check

* fix type check

* fix type check

* fix type check

* fix bob check

* more work

* pnpm i

* fix prebuild

* Update website/src/components/graphql-editor.tsx

* fix types error

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
dimaMachina and renovate[bot] committed Jul 31, 2024
1 parent 277ead9 commit 7e23fa4
Show file tree
Hide file tree
Showing 86 changed files with 494 additions and 417 deletions.
2 changes: 1 addition & 1 deletion .changeset/real-coins-share.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@graphql-eslint/eslint-plugin": major
'@graphql-eslint/eslint-plugin': major
---

exposing GraphQLESTreeNode type
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module.exports = {
extends: ['plugin:eslint-plugin/tests-recommended'],
rules: {
'eslint-plugin/test-case-shorthand-strings': 'error',
'import/extensions': 'off',
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/code-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"graphql": "16.9.0"
},
"devDependencies": {
"@eslint/js": "9.2.0",
"@eslint/js": "9.8.0",
"@graphql-eslint/eslint-plugin": "workspace:*",
"eslint": "8.57.0"
"eslint": "9.8.0"
}
}
4 changes: 2 additions & 2 deletions examples/graphql-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"graphql": "16.9.0"
},
"devDependencies": {
"@eslint/js": "9.2.0",
"@eslint/js": "9.8.0",
"@graphql-eslint/eslint-plugin": "workspace:*",
"eslint": "8.57.0"
"eslint": "9.8.0"
}
}
4 changes: 2 additions & 2 deletions examples/monorepo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"graphql": "16.9.0"
},
"devDependencies": {
"@eslint/js": "9.2.0",
"@eslint/js": "9.8.0",
"@graphql-eslint/eslint-plugin": "workspace:*",
"eslint": "8.57.0"
"eslint": "9.8.0"
}
}
4 changes: 2 additions & 2 deletions examples/multiple-projects-graphql-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"author": "Dimitri POSTOLOV",
"private": true,
"scripts": {
"lint": "eslint ."
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint ."
},
"dependencies": {
"graphql": "16.9.0"
},
"devDependencies": {
"@graphql-eslint/eslint-plugin": "workspace:*",
"eslint": "8.57.0"
"eslint": "9.8.0"
}
}
4 changes: 2 additions & 2 deletions examples/prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"graphql": "16.9.0"
},
"devDependencies": {
"@eslint/js": "9.2.0",
"@eslint/js": "9.8.0",
"@graphql-eslint/eslint-plugin": "workspace:*",
"eslint": "8.57.0",
"eslint": "9.8.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.2.1",
"prettier": "3.3.3"
Expand Down
4 changes: 2 additions & 2 deletions examples/programmatic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"graphql": "16.9.0"
},
"devDependencies": {
"@eslint/js": "9.2.0",
"@eslint/js": "9.8.0",
"@graphql-eslint/eslint-plugin": "workspace:*",
"eslint": "8.57.0"
"eslint": "9.8.0"
}
}
4 changes: 2 additions & 2 deletions examples/svelte-code-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"author": "Dimitri POSTOLOV",
"private": true,
"scripts": {
"lint": "eslint ."
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint ."
},
"dependencies": {
"graphql": "16.9.0"
},
"devDependencies": {
"@graphql-eslint/eslint-plugin": "workspace:*",
"eslint": "8.57.0",
"eslint": "9.8.0",
"svelte": "4.2.18",
"svelte-eslint-parser": "0.41.0",
"svelte2tsx": "0.7.15"
Expand Down
4 changes: 2 additions & 2 deletions examples/vue-code-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"author": "Dimitri POSTOLOV",
"private": true,
"scripts": {
"lint": "eslint ."
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint ."
},
"dependencies": {
"graphql": "16.9.0"
},
"devDependencies": {
"@graphql-eslint/eslint-plugin": "workspace:*",
"@vue/compiler-sfc": "3.4.35",
"eslint": "8.57.0",
"eslint": "9.8.0",
"vue-eslint-parser": "9.4.3"
}
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "module",
"name": "graphql-eslint-monorepo",
"type": "module",
"repository": "https://github.com/B2o5T/graphql-eslint",
"author": "Dotan Simha <[email protected]>",
"license": "MIT",
Expand All @@ -12,10 +12,10 @@
},
"scripts": {
"build": "turbo run build --filter=!website && bob check",
"ci:lint": "eslint --ignore-path .gitignore --output-file eslint_report.json --format json .",
"ci:lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ignore-path .gitignore --output-file eslint_report.json --format json .",
"create-rule": "tsx scripts/create-rule.ts",
"generate:configs": "tsx scripts/generate-configs.ts",
"lint": "eslint --ignore-path .gitignore --cache .",
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ignore-path .gitignore --cache .",
"lint:prettier": "prettier --ignore-path .gitignore --ignore-path .prettierignore --cache --check .",
"prebuild": "rimraf tsconfig.tsbuildinfo",
"prerelease": "NODE_ENV=production pnpm build",
Expand All @@ -36,7 +36,7 @@
"chalk": "5.3.0",
"dedent": "1.5.3",
"enquirer": "2.4.1",
"eslint": "8.57.0",
"eslint": "9.8.0",
"eslint-plugin-eslint-plugin": "6.2.0",
"eslint-plugin-tailwindcss": "3.17.4",
"husky": "9.1.4",
Expand All @@ -53,7 +53,7 @@
},
"pnpm": {
"patchedDependencies": {
"eslint@8.48.0": "patches/[email protected]",
"eslint@9.8.0": "patches/[email protected]",
"[email protected]": "patches/[email protected]"
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/alphabetize.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rule, RuleOptions } from '../src/rules/alphabetize';
import { ruleTester } from './test-utils';
import { rule, RuleOptions } from '../src/rules/alphabetize.js';
import { ruleTester } from './test-utils.js';

const GROUP_ORDER_TEST = /* GraphQL */ `
type User {
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/description-style.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rule, RuleOptions } from '../src/rules/description-style';
import { ruleTester } from './test-utils';
import { rule, RuleOptions } from '../src/rules/description-style.js';
import { ruleTester } from './test-utils.js';

const INLINE_SDL = /* GraphQL */ `
" Test "
Expand Down
12 changes: 6 additions & 6 deletions packages/plugin/__tests__/eslint-directives.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join } from 'node:path';
import { rule as noAnonymousOperations } from '../src/rules/no-anonymous-operations';
import { rule as noTypenamePrefix } from '../src/rules/no-typename-prefix';
import { ruleTester } from './test-utils';
import { rule as noAnonymousOperations } from '../src/rules/no-anonymous-operations.js';
import { rule as noTypenamePrefix } from '../src/rules/no-typename-prefix.js';
import { ruleTester } from './test-utils.js';

ruleTester.run('no-typename-prefix', noTypenamePrefix, {
valid: [
Expand All @@ -10,7 +10,7 @@ ruleTester.run('no-typename-prefix', noTypenamePrefix, {
code: /* GraphQL */ `
type Type {
"Some description"
typeName: String! # eslint-disable-line no-typename-prefix
typeName: String! # eslint-disable-line rule-to-test/no-typename-prefix
}
`,
},
Expand All @@ -27,12 +27,12 @@ ruleTester.run('test-directives', noAnonymousOperations, {
}
`,
/* GraphQL */ `
# eslint-disable-next-line test-directives
# eslint-disable-next-line rule-to-test/test-directives
{
a
}
`,
'{ a } # eslint-disable-line test-directives',
'{ a } # eslint-disable-line rule-to-test/test-directives',
'{ a } # eslint-disable-line',
/* GraphQL */ `
# eslint-disable
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/__tests__/examples.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { spawnSync } from 'node:child_process';
import { join, relative } from 'node:path';
import { ESLint } from 'eslint';
import { CWD as PROJECT_CWD } from '../src/utils';
import { CWD as PROJECT_CWD } from '../src/utils.js';

const CWD = join(PROJECT_CWD, '..', '..');

Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/executable-definitions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { ParserOptionsForTests, ruleTester } from './test-utils';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation.js';
import { ParserOptionsForTests, ruleTester } from './test-utils.js';

const TEST_SCHEMA = /* GraphQL */ `
type Query {
Expand Down
31 changes: 16 additions & 15 deletions packages/plugin/__tests__/fields-on-correct-type.spec.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this
import { RuleTester } from '@theguild/eslint-rule-tester';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation.js';
import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils.js';

const ruleTester = new RuleTester<ParserOptionsForTests>({
...DEFAULT_CONFIG,
parserOptions: {
graphQLConfig: {
schema: /* GraphQL */ `
type User {
id: ID
age: Int
}
languageOptions: {
...DEFAULT_CONFIG.languageOptions,
parserOptions: {
graphQLConfig: {
schema: /* GraphQL */ `
type User {
id: ID
age: Int
}
type Query {
user: User
}
`,
type Query {
user: User
}
`,
},
},
},
});
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/input-name.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rule, RuleOptions } from '../src/rules/input-name';
import { ruleTester } from './test-utils';
import { rule, RuleOptions } from '../src/rules/input-name.js';
import { ruleTester } from './test-utils.js';

ruleTester.run<RuleOptions>('input-name', rule, {
valid: [
Expand Down
29 changes: 15 additions & 14 deletions packages/plugin/__tests__/known-directives.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this
import { RuleTester } from '@theguild/eslint-rule-tester';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation.js';
import { DEFAULT_CONFIG, ParserOptionsForTests } from './test-utils.js';

const ruleTester = new RuleTester<ParserOptionsForTests>({
...DEFAULT_CONFIG,
parserOptions: {
graphQLConfig: {
schema: /* GraphQL */ `
type User {
id: ID!
}
languageOptions: {
...DEFAULT_CONFIG.languageOptions,
parserOptions: {
graphQLConfig: {
schema: /* GraphQL */ `
type User {
id: ID!
}
type Query {
user: User
}
`,
type Query {
user: User
}
`,
},
},
},
});
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/known-fragment-names.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from 'node:path';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { ruleTester } from './test-utils';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation.js';
import { ruleTester } from './test-utils.js';

ruleTester.run('known-fragment-names', GRAPHQL_JS_VALIDATIONS['known-fragment-names'], {
valid: [
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/lone-executable-definition.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rule, RuleOptions } from '../src/rules/lone-executable-definition';
import { ruleTester } from './test-utils';
import { rule, RuleOptions } from '../src/rules/lone-executable-definition.js';
import { ruleTester } from './test-utils.js';

ruleTester.run<RuleOptions>('lone-executable-definition', rule, {
valid: [
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/lone-schema-definition.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation';
import { ruleTester } from './test-utils';
import { GRAPHQL_JS_VALIDATIONS } from '../src/rules/graphql-js-validation.js';
import { ruleTester } from './test-utils.js';

ruleTester.run('lone-schema-definition', GRAPHQL_JS_VALIDATIONS['lone-schema-definition'], {
valid: [
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/match-document-filename.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rule, RuleOptions } from '../src/rules/match-document-filename';
import { ruleTester } from './test-utils';
import { rule, RuleOptions } from '../src/rules/match-document-filename.js';
import { ruleTester } from './test-utils.js';

ruleTester.run<RuleOptions>('match-document-filename', rule, {
valid: [
Expand Down
1 change: 0 additions & 1 deletion packages/plugin/__tests__/mocks/graphql-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { buildSchema, introspectionFromSchema } from 'graphql';

// @ts-expect-error -- add `"type": "module"` to `package.json` to fix this
const __dirname = fileURLToPath(new URL('.', import.meta.url));

const sdlSchema = readFileSync(resolve(__dirname, 'user-schema.graphql'), 'utf8');
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/naming-convention.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rule, RuleOptions } from '../src/rules/naming-convention';
import { ruleTester } from './test-utils';
import { rule, RuleOptions } from '../src/rules/naming-convention.js';
import { ruleTester } from './test-utils.js';

ruleTester.run<RuleOptions>('naming-convention', rule, {
valid: [
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/no-anonymous-operations.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rule } from '../src/rules/no-anonymous-operations';
import { ruleTester } from './test-utils';
import { rule } from '../src/rules/no-anonymous-operations.js';
import { ruleTester } from './test-utils.js';

ruleTester.run('no-anonymous-operations', rule, {
valid: ['query myQuery { a }', 'mutation doSomething { a }', 'subscription myData { a }'],
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/no-deprecated.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rule } from '../src/rules/no-deprecated';
import { ParserOptionsForTests, ruleTester } from './test-utils';
import { rule } from '../src/rules/no-deprecated.js';
import { ParserOptionsForTests, ruleTester } from './test-utils.js';

const TEST_SCHEMA = /* GraphQL */ `
type Query {
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/no-duplicate-fields.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rule } from '../src/rules/no-duplicate-fields';
import { ruleTester } from './test-utils';
import { rule } from '../src/rules/no-duplicate-fields.js';
import { ruleTester } from './test-utils.js';

ruleTester.run('no-duplicate-fields', rule, {
valid: [],
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin/__tests__/no-hashtag-description.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rule, RULE_ID } from '../src/rules/no-hashtag-description';
import { ruleTester } from './test-utils';
import { rule, RULE_ID } from '../src/rules/no-hashtag-description.js';
import { ruleTester } from './test-utils.js';

ruleTester.run('no-hashtag-description', rule, {
valid: [
Expand Down
Loading

0 comments on commit 7e23fa4

Please sign in to comment.