[Performance] no-cycle: dont scc for each linted file by soryy708 · Pull Request #3068 · import-js/eslint-plugin-import (original) (raw)

@ljharb in Discord you asked me:

Are we're sure that those are the only 3 keys in context that matter?

You also said

We support eslint 2 - 8, so it'd be good to check the older ones too.

Ok, I logged the context object in StronglyConnectedComponentsBuilder.for, in various ESLint versions. Here are my observations:

ESLint 7.25.0:

{ "cacheKey": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.jsd9da56ee23e751184e57ead488db4381bbe0f9fdc987aa0e7c39a448ea5986827e67ce99a36f4c88b10f0e80d55b71bae8fe96ab1747797f208639408c00c378/path-to-somewhere/src/main.ts", "settings": { "import/extensions": [ ".ts", ".cts", ".mts", ".tsx", ".js", ".jsx", ".mjs", ".cjs" ], "import/external-module-folders": [ "node_modules", "node_modules/@types" ], "import/parsers": { "@typescript-eslint/parser": [ ".ts", ".cts", ".mts", ".tsx" ] }, "import/resolver": { "node": { "extensions": [ ".ts", ".cts", ".mts", ".tsx", ".js", ".jsx", ".mjs", ".cjs" ] } } }, "parserOptions": { "ecmaFeatures": { "globalReturn": false }, "project": "tsconfig.json", "sourceType": "module" }, "parserPath": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.js", "path": "/path-to-somewhere/src/main.ts" }

ESLint 6.8.0:

{ "cacheKey": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.jsd9da56ee23e751184e57ead488db4381bbe0f9fdc987aa0e7c39a448ea5986827e67ce99a36f4c88b10f0e80d55b71bae8fe96ab1747797f208639408c00c378/path-to-somewhere/src/main.ts", "settings": { "import/extensions": [ ".ts", ".cts", ".mts", ".tsx", ".js", ".jsx", ".mjs", ".cjs" ], "import/external-module-folders": [ "node_modules", "node_modules/@types" ], "import/parsers": { "@typescript-eslint/parser": [ ".ts", ".cts", ".mts", ".tsx" ] }, "import/resolver": { "node": { "extensions": [ ".ts", ".cts", ".mts", ".tsx", ".js", ".jsx", ".mjs", ".cjs" ] } } }, "parserOptions": { "ecmaFeatures": { "globalReturn": false }, "project": "tsconfig.json", "sourceType": "module" }, "parserPath": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.js", "path": "/path-to-somewhere/src/main.ts" }

ESLint 5.16.0:

{ "cacheKey": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.jsd579e5a92f2fb830c4066e8075b30bdff66e6bb3eafbbfe9dc70dc8ec7c603f47e67ce99a36f4c88b10f0e80d55b71bae8fe96ab1747797f208639408c00c378/path-to-somewhere/src/main.ts", "settings": { "import/extensions": [ ".ts", ".cts", ".mts", ".tsx", ".js", ".jsx", ".mjs", ".cjs" ], "import/external-module-folders": [ "node_modules", "node_modules/@types" ], "import/parsers": { "@typescript-eslint/parser": [ ".ts", ".cts", ".mts", ".tsx" ] }, "import/resolver": { "node": { "extensions": [ ".ts", ".cts", ".mts", ".tsx", ".js", ".jsx", ".mjs", ".cjs" ] } } }, "parserOptions": { "ecmaFeatures": { "globalReturn": false }, "project": "tsconfig.json", "sourceType": "module", "ecmaVersion": 6 }, "parserPath": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.js", "path": "/path-to-somewhere/src/main.ts" }

ESLint 4.19.1:

{ "cacheKey": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.jsd579e5a92f2fb830c4066e8075b30bdff66e6bb3eafbbfe9dc70dc8ec7c603f47e67ce99a36f4c88b10f0e80d55b71bae8fe96ab1747797f208639408c00c378/path-to-somewhere/src/main.ts", "settings": { "import/extensions": [ ".ts", ".cts", ".mts", ".tsx", ".js", ".jsx", ".mjs", ".cjs" ], "import/external-module-folders": [ "node_modules", "node_modules/@types" ], "import/parsers": { "@typescript-eslint/parser": [ ".ts", ".cts", ".mts", ".tsx" ] }, "import/resolver": { "node": { "extensions": [ ".ts", ".cts", ".mts", ".tsx", ".js", ".jsx", ".mjs", ".cjs" ] } } }, "parserOptions": { "ecmaFeatures": { "globalReturn": false }, "project": "tsconfig.json", "sourceType": "module", "ecmaVersion": 6 }, "parserPath": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.js", "path": "/path-to-somewhere/src/main.ts" }

ESLint 3.19.0:

{ "cacheKey": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.jsd579e5a92f2fb830c4066e8075b30bdff66e6bb3eafbbfe9dc70dc8ec7c603f47e67ce99a36f4c88b10f0e80d55b71bae8fe96ab1747797f208639408c00c378/path-to-somewhere/src/main.ts", "settings": { "import/extensions": [ ".ts", ".cts", ".mts", ".tsx", ".js", ".jsx", ".mjs", ".cjs" ], "import/external-module-folders": [ "node_modules", "node_modules/@types" ], "import/parsers": { "@typescript-eslint/parser": [ ".ts", ".cts", ".mts", ".tsx" ] }, "import/resolver": { "node": { "extensions": [ ".ts", ".cts", ".mts", ".tsx", ".js", ".jsx", ".mjs", ".cjs" ] } } }, "parserOptions": { "ecmaFeatures": { "globalReturn": false }, "project": "tsconfig.json", "sourceType": "module", "ecmaVersion": 6 }, "parserPath": "/path-to-somewhere/node_modules/@typescript-eslint/parser/dist/index.js", "path": "/path-to-somewhere/src/main.ts" }

For ESLint 2 I got:

  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: estree.ts.
The file must be included in at least one of the projects provided

In summary, I believe that yes that's all that interests us in the context object, in various supported ESLint versions.