From 0d7a54d1d7d90ada980de82e68698fe43068acd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sun, 6 Oct 2024 15:48:08 +0200 Subject: [PATCH] feat!: update dependencies and support ESLint 9 --- README.md | 6 ++++-- eslint.config.js | 16 +++++++++++++++- index.js | 13 ++----------- package.json | 14 +++++++------- test/test.js | 3 +-- 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 7c703b0..2f908e9 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,10 @@ export default [ files: ['**/*.{gql,graphql}'], languageOptions: { parserOptions: { - schema: 'path/to/your/schema/**/*.{gql,graphql}', - operations: 'path/to/your/operations/**/*.{gql,graphql}', + graphQLConfig: { + schema: 'path/to/your/schema/**/*.{gql,graphql}', + documents: 'path/to/your/operations/**/*.{gql,graphql}', + }, }, }, }, diff --git a/eslint.config.js b/eslint.config.js index 5663296..b840b45 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,4 +2,18 @@ import cheminfo from 'eslint-config-cheminfo'; import graphql from './index.js'; -export default [...cheminfo, ...graphql]; +export default [ + ...cheminfo, + ...graphql, + { + files: ['**/*.{gql,graphql}'], + languageOptions: { + parserOptions: { + graphQLConfig: { + schema: './test/schema/**/*.{gql,graphql}', + documents: './test/operations/**/*.{gql,graphql}', + }, + }, + }, + }, +]; diff --git a/index.js b/index.js index a5b05d8..41f9ad4 100644 --- a/index.js +++ b/index.js @@ -7,15 +7,7 @@ export default [ '@graphql-eslint': graphqlEslint, }, languageOptions: { - parser: { - ...graphqlEslint, - // Necessary to avoid an error when ESLint is run with --cache. - // https://github.com/dimaMachina/graphql-eslint/issues/2178 - // TODO: remove this when fixed in the package. - meta: { - name: '@graphql-eslint', - }, - }, + parser: graphqlEslint.parser, }, rules: { '@graphql-eslint/alphabetize': 'off', @@ -56,7 +48,6 @@ export default [ ], '@graphql-eslint/no-anonymous-operations': 'error', - '@graphql-eslint/no-case-insensitive-enum-values-duplicates': 'error', '@graphql-eslint/no-deprecated': 'warn', '@graphql-eslint/no-duplicate-fields': 'error', '@graphql-eslint/no-hashtag-description': 'error', @@ -85,7 +76,7 @@ export default [ '@graphql-eslint/require-deprecation-reason': 'error', '@graphql-eslint/require-description': 'off', '@graphql-eslint/require-field-of-type-query-in-mutation-result': 'off', - '@graphql-eslint/require-id-when-available': 'error', + '@graphql-eslint/require-selections': 'error', '@graphql-eslint/scalar-leafs': 'error', '@graphql-eslint/selection-set-depth': 'off', diff --git a/package.json b/package.json index 12a7bbb..0231dfa 100644 --- a/package.json +++ b/package.json @@ -17,16 +17,16 @@ "test-only": "node test/test.js" }, "dependencies": { - "@graphql-eslint/eslint-plugin": "^3.20.1" + "@graphql-eslint/eslint-plugin": "4.0.0-alpha.4" }, "peerDependencies": { - "eslint": "^8.57.0", - "graphql": "^16.8.1" + "eslint": "^8.57.0 || ^9.12.0", + "graphql": "^16.9.0" }, "devDependencies": { - "eslint": "8.57.0", - "eslint-config-cheminfo": "^11.0.3", - "graphql": "16.8.1", - "prettier": "^3.3.2" + "eslint": "9.12.0", + "eslint-config-cheminfo": "^12.0.0", + "graphql": "16.9.0", + "prettier": "^3.3.3" } } diff --git a/test/test.js b/test/test.js index ac3343d..7f0057c 100644 --- a/test/test.js +++ b/test/test.js @@ -1,8 +1,7 @@ import assert from 'node:assert'; -import { loadESLint } from 'eslint'; +import { ESLint } from 'eslint'; -const ESLint = await loadESLint({ useFlatConfig: true }); const eslint = new ESLint(); const formatter = await eslint.loadFormatter('stylish');