-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error arfter upgrade 7.11.0 ->7.12.0 " The "path" argument must be of type string. Received undefined" #13789
Comments
cc @bradzacher |
Thanks for so many details! Can you please check the version in |
Here it is:
When I switch back to |
This looks like a problem with the package manager, ESLint |
YeahI can confirm this. I even get the information that G:\webpages\pathfinder>npm list @eslint/eslintrc --depth=2
pathfinder-eve@2.0.0 G:\webpages\pathfinder
`-- eslint@7.12.0
`-- @eslint/eslintrc@0.2.0 ...same output with: `npm list --depth=1` (expand me)G:\webpages\pathfinder>npm list --depth=1
pathfinder-eve@2.0.0 G:\webpages\pathfinder
+-- @types/node@14.14.2
+-- @typescript-eslint/eslint-plugin@4.5.0
| +-- @typescript-eslint/experimental-utils@4.5.0
| +-- @typescript-eslint/parser@4.5.0 deduped
| +-- @typescript-eslint/scope-manager@4.5.0
| +-- debug@4.2.0
| +-- eslint@7.12.0 deduped
| +-- functional-red-black-tree@1.0.1
| +-- regexpp@3.1.0
| +-- semver@7.3.2
| `-- tsutils@3.17.1
+-- @typescript-eslint/parser@4.5.0
| +-- @typescript-eslint/scope-manager@4.5.0 deduped
| +-- @typescript-eslint/types@4.5.0
| +-- @typescript-eslint/typescript-estree@4.5.0
| +-- debug@4.2.0 deduped
| `-- eslint@7.12.0 deduped
+-- ansi-colors@4.1.1
+-- easytimer.js@4.3.0
+-- eslint-plugin-import@2.22.1
| +-- array-includes@3.1.1
| +-- array.prototype.flat@1.2.3
| +-- contains-path@0.1.0
| +-- debug@2.6.9
| +-- doctrine@1.5.0
| +-- eslint-import-resolver-node@0.3.4
| +-- eslint-module-utils@2.6.0
| +-- eslint@7.12.0 deduped
| +-- has@1.0.3
| +-- minimatch@3.0.4
| +-- object.values@1.1.1
| +-- read-pkg-up@2.0.0
| +-- resolve@1.18.1
| `-- tsconfig-paths@3.9.0
+-- eslint-plugin-jsdoc@30.7.3
| +-- comment-parser@0.7.6
| +-- debug@4.2.0 deduped
| +-- eslint@7.12.0 deduped
| +-- jsdoctypeparser@9.0.0
| +-- lodash@4.17.20
| +-- regextras@0.7.1
| +-- semver@7.3.2 deduped
| `-- spdx-expression-parse@3.0.1
+-- eslint-plugin-json@2.1.2
| +-- lodash@4.17.20 deduped
| `-- vscode-json-languageservice@3.9.1
+-- eslint@7.12.0 <===
| +-- @babel/code-frame@7.10.4
| +-- @eslint/eslintrc@0.2.0 <===
| +-- ajv@6.12.6
| +-- chalk@4.1.0
| +-- cross-spawn@7.0.3
| +-- debug@4.2.0 deduped
| +-- doctrine@3.0.0
| +-- enquirer@2.3.6
| +-- eslint-scope@5.1.1
| +-- eslint-utils@2.1.0
| +-- eslint-visitor-keys@2.0.0
| +-- espree@7.3.0
| +-- esquery@1.3.1
| +-- esutils@2.0.3
| +-- file-entry-cache@5.0.1
| +-- functional-red-black-tree@1.0.1 deduped
| +-- glob-parent@5.1.1
| +-- globals@12.4.0
| +-- ignore@4.0.6
| +-- import-fresh@3.2.1
| +-- imurmurhash@0.1.4
| +-- is-glob@4.0.1
| +-- js-yaml@3.14.0
| +-- json-stable-stringify-without-jsonify@1.0.1
| +-- levn@0.4.1
| +-- lodash@4.17.20 deduped
| +-- minimatch@3.0.4 deduped
| +-- natural-compare@1.4.0
| +-- optionator@0.9.1
| +-- progress@2.0.3
| +-- regexpp@3.1.0 deduped
| +-- semver@7.3.2 deduped
| +-- strip-ansi@6.0.0
| +-- strip-json-comments@3.1.1
| +-- table@5.4.6
| +-- text-table@0.2.0
| `-- v8-compile-cache@2.1.1
G:\webpages\pathfinder\node_modules\@eslint\eslintrc\package.json (expand me){
"name": "@eslint/eslintrc",
"version": "0.1.3",
"description": "The legacy ESLintRC config file format for ESLint",
"main": "lib/index.js",
"files": [
"lib",
"conf",
"LICENSE"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"lint": "eslint .",
"test": "mocha tests/lib/shared",
"generate-release": "eslint-generate-release",
"generate-alpharelease": "eslint-generate-prerelease alpha",
"generate-betarelease": "eslint-generate-prerelease beta",
"generate-rcrelease": "eslint-generate-prerelease rc",
"publish-release": "eslint-publish-release"
},
"repository": "eslint/eslintrc",
"keywords": [
"ESLint",
"ESLintRC",
"Configuration"
],
"author": "Nicholas C. Zakas",
"license": "MIT",
"bugs": {
"url": "https://github.com/eslint/eslintrc/issues"
},
"homepage": "https://github.com/eslint/eslintrc#readme",
"devDependencies": {
"chai": "^4.2.0",
"eslint": "^7.7.0",
"eslint-config-eslint": "^6.0.0",
"eslint-plugin-jsdoc": "^22.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-release": "^3.1.2",
"mocha": "^8.1.1"
},
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.1.1",
"espree": "^7.3.0",
"globals": "^12.1.0",
"ignore": "^4.0.6",
"import-fresh": "^3.2.1",
"js-yaml": "^3.13.1",
"lodash": "^4.17.19",
"minimatch": "^3.0.4",
"strip-json-comments": "^3.1.1"
},
"engines": {
"node": "^10.12.0 || >=12.0.0"
}
} I get the same result after a reinstall:
Could this be a caching issue? - Ill do some more tests, maybe I figure out something. I can also try an manually install |
I made some more investigations: NPM packeges npm list --depth=1
But this does not solve my initial error. I was able to further reduce the origin of the error:
constructor({
additionalPluginPool = new Map(),
cwd = process.cwd(),
resolvePluginsRelativeTo,
builtInRules,
resolver = ModuleResolver,
eslintAllPath,
eslintRecommendedPath
} = {}) {
if(!eslintRecommendedPath) throw new Error('xx'); // <<==
// ...
}
{
"plugins": [
"@typescript-eslint",
// "import", // <<== error cause
"jsdoc",
"json"
]
} |
@exodus4d would everything else work well if you turn off just |
The problem with |
@mdjermanovic that seems like a breaking change in publicly accessible API, in a minor version :-/ |
Thanks for the thorough investigation! If I understand correctly, there was a problem with The other problem is with |
I'll leave this issue open for discussion, but we have public API documented here: https://eslint.org/docs/developer-guide/nodejs-api #13654 will really help to avoid these problems |
When `CLIEngine` instantiates `FileEnumerator`, it explicitly passes its own `CascadingConfigArrayFactory` instance, which now includes values for `builtInRules`, `loadRules`, `eslintRecommendedPath`, and `eslintAllPath`. This is the only place that ESLint core instantiates `FileEnumerator`, so core does not rely on the constructor's default value for `configArrayFactory`. After `CascadingConfigArrayFactory` was extracted into `@eslint/eslintrc`, it no longer assumed values for `eslintRecommendedPath` and `eslintAllPath`, which `CLIEngine` now provides. If those values are not passed, as is the case with the default `CascadingConfigArrayFactory` for `configArrayFactory`, file enumeration will encounter the exception that was reported in #13789. From the perspective of ESLint core, the default value for `configArrayFactory` is dead code. However, even though `FileEnumerator` is an undocumented API, it's called by `eslint-plugin-import`'s `no-unused-modules` rule, which hits the exception reproduced by this test.
When `CLIEngine` instantiates `FileEnumerator`, it explicitly passes its own `CascadingConfigArrayFactory` instance, which now includes values for `builtInRules`, `loadRules`, `eslintRecommendedPath`, and `eslintAllPath`. This is the only place that ESLint core instantiates `FileEnumerator`, so core does not rely on the constructor's default value for `configArrayFactory`. After `CascadingConfigArrayFactory` was extracted into `@eslint/eslintrc`, it no longer assumed values for `eslintRecommendedPath` and `eslintAllPath`, which `CLIEngine` now provides. If those values are not passed, as is the case with the default `CascadingConfigArrayFactory` for `configArrayFactory`, file enumeration will encounter the exception that was reported in #13789. From the perspective of ESLint core, the default value for `configArrayFactory` is dead code. However, even though `FileEnumerator` is an undocumented API, it's called by `eslint-plugin-import`'s `no-unused-modules` rule, which hits the exception reproduced by this test.
Tell us about your environment
What parser (default,
@babel/eslint-parser
,@typescript-eslint/parser
, etc.) are you using?"parser": "@typescript-eslint/parser"
Please show your full configuration:
Configuration `.eslintrc.json`
Configuration `tsconfig.eslint.json`
Configuration `tsconfig.base.json`
package.json
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
What did you expect to happen?
The issue happened just after the update from ESLint
v7.11.0
tov7.12.0
What else might be "special" on my setup?
*.mjs
extensionsMaybe this help to find the issue. I added some output in the stacktrace, right before the Error:
shows
filePath: undefined
:shows
eslintRecommendedPath: undefined
The text was updated successfully, but these errors were encountered: