From 3efdc5408c0bd4af4e5f63df6076e301f6d3ac52 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Fri, 17 Feb 2023 23:38:53 +0200 Subject: [PATCH] ESLint: use the `--rulesdir` option for internal rules. (#3849) --- .eslintrc.yml | 14 ++++++-------- package-lock.json | 10 +--------- package.json | 3 +-- resources/build-docusaurus.ts | 1 - resources/eslint-internal-rules/README.md | 6 ------ resources/eslint-internal-rules/package.json | 2 -- 6 files changed, 8 insertions(+), 28 deletions(-) delete mode 100644 resources/eslint-internal-rules/README.md diff --git a/.eslintrc.yml b/.eslintrc.yml index 4049462418..f1f1f94897 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -5,7 +5,6 @@ env: shared-node-browser: true reportUnusedDisableDirectives: true plugins: - - internal-rules - node - import - simple-import-sort @@ -19,12 +18,11 @@ settings: rules: ############################################################################## # Internal rules located in 'resources/eslint-internal-rules'. - # See './resources/eslint-internal-rules/README.md' ############################################################################## - internal-rules/only-ascii: error - internal-rules/no-dir-import: error - internal-rules/require-to-string-tag: off + only-ascii: error + no-dir-import: error + require-to-string-tag: off ############################################################################## # `eslint-plugin-node` rule list based on `v11.1.x` @@ -658,10 +656,10 @@ overrides: '@typescript-eslint/type-annotation-spacing': off - files: 'src/**' rules: - internal-rules/require-to-string-tag: error + require-to-string-tag: error - files: 'src/**/__*__/**' rules: - internal-rules/require-to-string-tag: off + require-to-string-tag: off node/no-unpublished-import: [error, { allowModules: ['chai', 'mocha'] }] import/no-deprecated: off import/no-restricted-paths: off @@ -700,7 +698,7 @@ overrides: env: node: true rules: - internal-rules/only-ascii: [error, { allowEmoji: true }] + only-ascii: [error, { allowEmoji: true }] node/no-unpublished-import: off node/no-sync: off import/no-namespace: off diff --git a/package-lock.json b/package-lock.json index 1f295999b7..11d512e416 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,6 @@ "docusaurus-plugin-typedoc-api": "2.5.0", "eslint": "8.27.0", "eslint-plugin-import": "2.26.0", - "eslint-plugin-internal-rules": "file:./resources/eslint-internal-rules", "eslint-plugin-node": "11.1.0", "eslint-plugin-react": "7.31.10", "eslint-plugin-react-hooks": "4.6.0", @@ -8129,10 +8128,6 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, - "node_modules/eslint-plugin-internal-rules": { - "resolved": "resources/eslint-internal-rules", - "link": true - }, "node_modules/eslint-plugin-node": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", @@ -17995,7 +17990,7 @@ "resources/eslint-internal-rules": { "name": "eslint-plugin-graphql-internal", "version": "0.0.0", - "dev": true, + "extraneous": true, "engines": { "node": ">= 14.0.0" } @@ -24174,9 +24169,6 @@ } } }, - "eslint-plugin-internal-rules": { - "version": "file:resources/eslint-internal-rules" - }, "eslint-plugin-node": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", diff --git a/package.json b/package.json index 88c2668dca..73b35cc121 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "changelog": "ts-node resources/gen-changelog.ts", "benchmark": "ts-node resources/benchmark.ts", "test": "npm run lint && npm run check && npm run testonly:cover && npm run prettier:check && npm run check:spelling && npm run check:integrations", - "lint": "eslint --cache --max-warnings 0 .", + "lint": "eslint --cache --max-warnings 0 --rulesdir resources/eslint-internal-rules/ .", "check": "tsc --pretty", "testonly": "mocha --full-trace src/**/__tests__/**/*-test.ts", "testonly:cover": "c8 npm run testonly", @@ -75,7 +75,6 @@ "docusaurus-plugin-typedoc-api": "2.5.0", "eslint": "8.27.0", "eslint-plugin-import": "2.26.0", - "eslint-plugin-internal-rules": "file:./resources/eslint-internal-rules", "eslint-plugin-node": "11.1.0", "eslint-plugin-react": "7.31.10", "eslint-plugin-react-hooks": "4.6.0", diff --git a/resources/build-docusaurus.ts b/resources/build-docusaurus.ts index 757bf3140f..8928bac07c 100644 --- a/resources/build-docusaurus.ts +++ b/resources/build-docusaurus.ts @@ -14,7 +14,6 @@ fs.writeFileSync(tmpDirPath('package.json'), JSON.stringify(packageJSON)); copyToTmpDir('package-lock.json'); copyToTmpDir('tsconfig.json'); -copyToTmpDir('resources/eslint-internal-rules'); copyToTmpDir('src'); copyToTmpDir('website'); diff --git a/resources/eslint-internal-rules/README.md b/resources/eslint-internal-rules/README.md deleted file mode 100644 index cec9e87c9b..0000000000 --- a/resources/eslint-internal-rules/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Custom ESLint Rules - -This is a dummy npm package that allows us to treat it as an `eslint-plugin-graphql-internal`. -It's not actually published, nor are the rules here useful for users of graphql. - -**If you modify this rule, you must re-run `npm install` for it to take effect.** diff --git a/resources/eslint-internal-rules/package.json b/resources/eslint-internal-rules/package.json index 5912b1453e..f2bd1508d8 100644 --- a/resources/eslint-internal-rules/package.json +++ b/resources/eslint-internal-rules/package.json @@ -1,6 +1,4 @@ { - "name": "eslint-plugin-graphql-internal", - "version": "0.0.0", "private": true, "engines": { "node": ">= 14.0.0"