Open hornta opened 1 year ago
That seems to be coming from inside of babel. What does resolvers\webpack\.babelrc
have in it?
It has ../../.babelrc
. I've no idea why it isn't json but I changed it to { "extends": "../../.babelrc" }
which made that particular error go away and now I'm getting this output from running the tests.
PS Z:\git\eslint-plugin-import> npm test
> eslint-plugin-import@2.27.5 pretest
> linklocal
tests\files\order-redirect
resolvers\webpack
tests\files\symlinked-module
tests\files\order-redirect-scoped
utils
resolvers\node
Linked 6 dependencies
> eslint-plugin-import@2.27.5 test
> npm run tests-only
> eslint-plugin-import@2.27.5 tests-only
> npm run mocha tests/src
> eslint-plugin-import@2.27.5 mocha
> cross-env BABEL_ENV=test nyc mocha tests/src
node:internal/modules/cjs/loader:998
throw err;
^
Error: Cannot find module 'Z:\git\eslint-plugin-import\node'
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Module._load (node:internal/modules/cjs/loader:841:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.11.0
=============================== Coverage summary ===============================
Statements : 0% ( 0/5935 )
Branches : 0% ( 0/3834 )
Functions : 0% ( 0/821 )
Lines : 0% ( 0/3653 )
================================================================================
----------------------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------------------------------------|----------|----------|----------|----------|-------------------|
All files | 0 | 0 | 0 | 0 | |
config | 0 | 100 | 100 | 0 | |
electron.js | 0 | 100 | 100 | 0 | 4 |
errors.js | 0 | 100 | 100 | 0 | 6 |
react-native.js | 0 | 100 | 100 | 0 | 4 |
react.js | 0 | 100 | 100 | 0 | 8 |
recommended.js | 0 | 100 | 100 | 0 | 5 |
stage-0.js | 0 | 100 | 100 | 0 | 7 |
typescript.js | 0 | 100 | 100 | 0 | 8,10 |
warnings.js | 0 | 100 | 100 | 0 | 5 |
resolvers/node | 0 | 0 | 0 | 0 | |
index.js | 0 | 0 | 0 | 0 |... 58,59,60,62,65 |
resolvers/node/coverage | 0 | 0 | 0 | 0 | |
block-navigation.js | 0 | 0 | 0 | 0 |... 53,54,58,59,63 |
prettify.js | 0 | 0 | 0 | 0 | 1 |
sorter.js | 0 | 0 | 0 | 0 |... 52,153,154,158 |
resolvers/node/coverage/lcov-report | 0 | 0 | 0 | 0 | |
block-navigation.js | 0 | 0 | 0 | 0 |... 53,54,58,59,63 |
prettify.js | 0 | 0 | 0 | 0 | 1 |
sorter.js | 0 | 0 | 0 | 0 |... 52,153,154,158 |
resolvers/webpack | 0 | 0 | 0 | 0 | |
config.js | 0 | 100 | 100 | 0 | 4 |
index.js | 0 | 0 | 0 | 0 |... 43,444,445,447 |
resolvers/webpack/coverage | 0 | 0 | 0 | 0 | |
block-navigation.js | 0 | 0 | 0 | 0 |... 53,54,58,59,63 |
prettify.js | 0 | 0 | 0 | 0 | 1 |
sorter.js | 0 | 0 | 0 | 0 |... 52,153,154,158 |
resolvers/webpack/coverage/lcov-report | 0 | 0 | 0 | 0 | |
block-navigation.js | 0 | 0 | 0 | 0 |... 53,54,58,59,63 |
prettify.js | 0 | 0 | 0 | 0 | 1 |
sorter.js | 0 | 0 | 0 | 0 |... 52,153,154,158 |
src | 0 | 0 | 0 | 0 | |
ExportMap.js | 0 | 0 | 0 | 0 |... 06,819,821,824 |
docsUrl.js | 0 | 0 | 0 | 0 | 3,6 |
importDeclaration.js | 0 | 100 | 0 | 0 | 2,3 |
index.js | 0 | 100 | 100 | 0 | 1,57 |
src/core | 0 | 0 | 0 | 0 | |
importType.js | 0 | 0 | 0 | 0 |... 21,122,123,127 |
packagePath.js | 0 | 0 | 0 | 0 |... 11,15,16,18,20 |
staticRequire.js | 0 | 0 | 0 | 0 | 3 |
src/rules | 0 | 0 | 0 | 0 | |
consistent-type-specifier-style.js | 0 | 0 | 0 | 0 |... 00,202,204,210 |
default.js | 0 | 0 | 0 | 0 |... 27,28,29,30,37 |
dynamic-import-chunkname.js | 0 | 0 | 0 | 0 |... 08,112,113,116 |
export.js | 0 | 0 | 0 | 0 |... 34,236,237,239 |
exports-last.js | 0 | 0 | 0 | 0 |... 27,30,31,32,33 |
extensions.js | 0 | 0 | 0 | 0 |... 80,181,182,190 |
first.js | 0 | 0 | 0 | 0 |... 30,131,136,139 |
group-exports.js | 0 | 0 | 0 | 0 |... 40,141,142,152 |
imports-first.js | 0 | 100 | 100 | 0 | 3,5,15 |
max-dependencies.js | 0 | 0 | 0 | 0 |... 45,47,51,52,54 |
named.js | 0 | 0 | 0 | 0 |... 24,127,129,135 |
namespace.js | 0 | 0 | 0 | 0 |... 07,208,209,210 |
newline-after-import.js | 0 | 0 | 0 | 0 |... 94,195,198,205 |
no-absolute-path.js | 0 | 0 | 0 | 0 |... 28,29,31,37,38 |
no-amd.js | 0 | 0 | 100 | 0 |... 29,32,34,35,39 |
no-anonymous-default-export.js | 0 | 0 | 0 | 0 |... 99,101,105,106 |
no-commonjs.js | 0 | 0 | 0 | 0 |... 26,128,130,133 |
no-cycle.js | 0 | 0 | 0 | 0 |... 42,147,149,156 |
no-default-export.js | 0 | 0 | 0 | 0 |... 31,32,33,34,35 |
no-deprecated.js | 0 | 0 | 0 | 0 |... 27,131,132,133 |
no-duplicates.js | 0 | 0 | 0 | 0 |... 46,347,348,349 |
no-dynamic-require.js | 0 | 0 | 0 | 0 |... 59,60,67,68,70 |
no-empty-named-blocks.js | 0 | 0 | 0 | 0 |... 82,83,85,91,95 |
no-extraneous-dependencies.js | 0 | 0 | 0 | 0 |... 83,292,293,298 |
no-import-module-exports.js | 0 | 0 | 0 | 0 |... 70,74,76,79,80 |
no-internal-modules.js | 0 | 0 | 0 | 0 |... 28,132,139,141 |
no-mutable-exports.js | 0 | 0 | 0 | 0 |... 46,47,48,49,54 |
no-named-as-default-member.js | 0 | 0 | 0 | 0 |... 75,77,79,80,82 |
no-named-as-default.js | 0 | 0 | 0 | 0 |... 27,28,31,33,40 |
no-named-default.js | 0 | 0 | 0 | 0 |... 17,18,19,22,23 |
no-named-export.js | 0 | 0 | 0 | 0 |... 28,29,32,33,34 |
no-namespace.js | 0 | 0 | 0 | 0 |... 66,167,171,173 |
no-nodejs-modules.js | 0 | 0 | 0 | 0 |6,7,11,37,38,40,41 |
no-relative-packages.js | 0 | 0 | 0 | 0 |... 42,47,50,56,69 |
no-relative-parent-imports.js | 0 | 0 | 0 | 0 |... 33,36,38,39,46 |
no-restricted-paths.js | 0 | 0 | 0 | 0 |... 35,236,240,241 |
no-self-import.js | 0 | 0 | 0 | 0 | 11,14,15,22,35,36 |
no-unassigned-import.js | 0 | 0 | 0 | 0 |... 39,40,44,49,55 |
no-unresolved.js | 0 | 0 | 0 | 0 |... 47,48,49,50,58 |
no-unused-modules.js | 0 | 0 | 0 | 0 |... 52,953,955,956 |
no-useless-path-segments.js | 0 | 0 | 0 | 0 |... 30,131,135,145 |
no-webpack-loader-syntax.js | 0 | 0 | 0 | 0 | 5,6,10,22,23 |
order.js | 0 | 0 | 0 | 0 |... 83,784,787,790 |
prefer-default-export.js | 0 | 0 | 0 | 0 |... 08,109,110,111 |
unambiguous.js | 0 | 0 | 100 | 0 | 9,22,23,26,28,29 |
utils | 0 | 0 | 0 | 0 | |
ModuleCache.js | 0 | 0 | 0 | 0 |... 38,43,44,47,50 |
declaredScope.js | 0 | 0 | 0 | 0 | 3,5,6,7,8,9 |
hash.js | 0 | 0 | 0 | 0 |... 52,54,56,58,59 |
ignore.js | 0 | 0 | 0 | 0 |... 50,51,55,59,61 |
module-require.js | 0 | 100 | 0 | 0 |... 20,21,24,26,30 |
moduleVisitor.js | 0 | 0 | 0 | 0 |... 40,144,146,153 |
parse.js | 0 | 0 | 0 | 0 |... 40,142,143,148 |
pkgDir.js | 0 | 0 | 0 | 0 | 3,4,6,8,9,10 |
pkgUp.js | 0 | 0 | 0 | 0 |... 47,48,51,55,56 |
readPkgUp.js | 0 | 0 | 0 | 0 |... 41,42,45,46,51 |
resolve.js | 0 | 0 | 0 | 0 |... 25,229,233,234 |
unambiguous.js | 0 | 0 | 0 | 0 |3,5,16,17,21,28,29 |
visit.js | 0 | 0 | 0 | 0 |... 17,18,19,22,23 |
----------------------------------------|----------|----------|----------|----------|-------------------|
node:events:491
throw er; // Unhandled 'error' event
^
Error: spawn nyc ENOENT
at notFoundError (Z:\git\eslint-plugin-import\node_modules\cross-spawn\lib\enoent.js:11:11)
at verifyENOENT (Z:\git\eslint-plugin-import\node_modules\cross-spawn\lib\enoent.js:46:16)
at cp.emit (Z:\git\eslint-plugin-import\node_modules\cross-spawn\lib\enoent.js:33:19)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
Emitted 'error' event on ChildProcess instance at:
at cp.emit (Z:\git\eslint-plugin-import\node_modules\cross-spawn\lib\enoent.js:36:37)
at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn nyc'
}
Node.js v18.11.0
Update:
I noticed that the babelrc is a symbolic link so I enabled it in windows and recloned the repo and than ran npm test
but it gives the same output as above.
ah yes, that's indeed because it's a unix-style symlink.
I suspect that if you replace the symlink with a copy of the file it's targeting, that it should work?
These Windows CI errors may be related:
https://ci.appveyor.com/project/ljharb/eslint-plugin-import/builds/46821162/job/gort0xlqll93sbix
Error: Cannot find module 'semver'
Require stack:
- /mnt/c/projects/eslint-plugin-import/tests/src/cli.js
- /mnt/c/projects/eslint-plugin-import/node_modules/mocha/lib/mocha.js
- /mnt/c/projects/eslint-plugin-import/node_modules/mocha/index.js
- /mnt/c/projects/eslint-plugin-import/node_modules/mocha/bin/_mocha
- ```
I can’t reproduce those errors in my local Windows, so I’m not sure if they are related.
This is an nyc
issue: https://github.com/istanbuljs/nyc/issues/1205.
Simple solution: update nyc
to 15.x in eslint-plugin-import
.
That's not an option, unfortunately, because nyc 15 drops node versions we support.
I'm also experiencing this issue, on Windows 11 Home version 22H2 (build 22621.2715). Is there a workaround?
I'm experiencing this too. I think it's time to drop support for node 16.
Apparently that's not acceptable per https://github.com/import-js/eslint-plugin-import/pull/3008#pullrequestreview-2067222709
Absolutely not. This would be a breaking change, and platform support has zero bearing whatsoever on what node versions a library should support.
What version[s] does nyc
drop that this project needs to still support?
Edit: answered here:
We support down to eslint 2, and we support down to node 4 (arguably we should support down to node 0.10, but we haven't prioritized that and nobody's asked for it)
Additionally, breaking changes are the most costly thing any package can impose on the ecosystem, and "dropping a node version" has a very small amount of benefit, so there'd need to be actually good reasons to do a breaking change before dropping a node version happened.
The earliest nyc version that avoids these problems on windows isn't compatible with this project.
What versions of Node must this project be compatible with? On Windows it looks like we monkey-patch the nyc
dependency to sidestep this:
Maybe the version requirement should instead be changed from "nyc": "^11.9.0"
to "nyc": ">=11.9.0"
?
Unfortunately that would install nyc latest, on versions of node that can't support it.
I would think that it would make an otherwise consistent dependency tree. I was trying to update that nyc
dependency on a setup with old node
and npm
, but it seems pretty otherwise borked on macOS.
Installing with node 4 + npm 2:
$ npm install
...
npm ERR! Darwin 23.5.0
npm ERR! argv "/Users/dan/.proto/tools/node/4.9.1/bin/node" "/Users/dan/.proto/tools/npm/2.15.12/bin/npm-cli.js" "install"
npm ERR! node v4.9.1
npm ERR! npm v2.15.12
npm ERR! path /Users/dan/Source/eslint-plugin-import/node_modules/eslint-doc-generator/node_modules/@typescript-eslint/utils/node_modules/@types/json-schema/package.json
npm ERR! code ENOTDIR
npm ERR! errno -20
npm ERR! syscall open
npm ERR! ENOTDIR: not a directory, open '/Users/dan/Source/eslint-plugin-import/node_modules/eslint-doc-generator/node_modules/@typescript-eslint/utils/node_modules/@types/json-schema/package.json'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/dan/Source/eslint-plugin-import/npm-debug.log
In node 8 + npm 5, I got a built-time error about python version (understandable). And then at test time:
$ npm test
...
> eslint-plugin-import@2.29.1 mocha /Users/dan/Source/eslint-plugin-import
> cross-env BABEL_ENV=test nyc mocha "tests/src"
/Users/dan/Source/eslint-plugin-import/node_modules/eslint/lib/cli-engine/cli-engine.js:456
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
...
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! eslint-plugin-import@2.29.1 mocha: `cross-env BABEL_ENV=test nyc mocha "tests/src"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the eslint-plugin-import@2.29.1 mocha script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/dan/.npm/_logs/2024-05-21T02_49_11_875Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! eslint-plugin-import@2.29.1 tests-only: `npm run mocha tests/src`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the eslint-plugin-import@2.29.1 tests-only script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/dan/.npm/_logs/2024-05-21T02_49_11_917Z-debug.log
npm ERR! Test failed. See above for more details.
I think the incidental complexity of supporting versions this old may outweigh the usefulness!
The usefulness is near infinite, and supporting node devs who use windows is unfortunately a very very very obscure edge case.
At the moment, you need to manually run the commands that CI is running. I'm happy to make this easier - ideally it's a single npm run
command that both CI and windows devs can use - and then we can iterate from there if possible.
I'm sure I'm missing some perspective, not having been involved with Node during many years of growing pains. Still my understanding is that users of older versions are still free to use old versions. If you're stuck on eslint 2, you're unlikely to install eslint-plugin-import@latest
.
At any rate, in CI on these old versions, there are things that crash out, like fsevents
is crashing node-gyp in the install phase:
https://github.com/import-js/eslint-plugin-import/actions/runs/9107211528/job/25035728071#step:3:104
And lots of warnings that I can't tell if they should be failing the tests or are just diagnostic output that is expected but not captured by the testing rig:
https://github.com/import-js/eslint-plugin-import/actions/runs/9107211528/job/25035728071#step:5:53
Error while parsing /Users/runner/work/eslint-plugin-import/eslint-plugin-import/tests/files/default-export-from.js Line 1, column 20: ';' expected.
parseForESLint
from parser/Users/runner/work/eslint-plugin-import/eslint-plugin-import/node_modules/@typescript-eslint/parser/dist/index.js
is invalid and will just be ignored
Anyway, when I run export ESLINT_VERSION=6 && npm run copy-metafiles && ./tests/dep-time-travel.sh && npm run tests-only
, I don't get the above "SyntaxError: Unexpected token {". But I do get several test failures:
$ export ESLINT_VERSION=6 && npm run copy-metafiles && ./tests/dep-time-travel.sh && npm run tests-only
...
1) TypeScript export valid
export * from './module';
:
AssertionError [ERR_ASSERTION]: Should have no errors but had 1: [ { ruleId: 'export',
severity: 1,
message: 'No named exports found in module \'./module\'.',
line: 2,
column: 27,
nodeType: 'Literal',
endLine: 2,
endColumn: 37 } ]
+ expected - actual
-1
+0
at testValidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:460:20)
at Context.RuleTester.it (node_modules/eslint/lib/rule-tester/rule-tester.js:662:25)
2) Typescript no-restricted-paths invalid import type b from "../server/b":
AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
+ expected - actual
-0
+1
at testInvalidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:507:24)
at Context.RuleTester.it (node_modules/eslint/lib/rule-tester/rule-tester.js:670:25)
3) Typescript no-restricted-paths invalid import type b from "../server/b":
AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
+ expected - actual
-0
+1
at testInvalidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:507:24)
at Context.RuleTester.it (node_modules/eslint/lib/rule-tester/rule-tester.js:670:25)
4) Typescript no-restricted-paths invalid import type a from "../client/a"
import type c from "./c.ts":
AssertionError [ERR_ASSERTION]: Should have 2 errors but had 1: [ { ruleId: 'no-restricted-paths',
severity: 1,
message: 'Unexpected path "./c.ts" imported in restricted zone.',
line: 2,
column: 20,
nodeType: 'Literal',
endLine: 2,
endColumn: 28 } ]
+ expected - actual
-1
+2
at testInvalidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:507:24)
at Context.RuleTester.it (node_modules/eslint/lib/rule-tester/rule-tester.js:670:25)
5) Typescript no-restricted-paths invalid import type b from "../server/b":
AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
+ expected - actual
-0
+1
at testInvalidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:507:24)
at Context.RuleTester.it (node_modules/eslint/lib/rule-tester/rule-tester.js:670:25)
6) Typescript no-restricted-paths invalid import type b from "../two/a":
AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
+ expected - actual
-0
+1
at testInvalidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:507:24)
at Context.RuleTester.it (node_modules/eslint/lib/rule-tester/rule-tester.js:670:25)
7) Typescript no-restricted-paths invalid import type b from "../two/a":
AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
+ expected - actual
-0
+1
at testInvalidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:507:24)
at Context.RuleTester.it (node_modules/eslint/lib/rule-tester/rule-tester.js:670:25)
8) Typescript no-restricted-paths invalid import type b from "../two/a":
AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
+ expected - actual
-0
+1
at testInvalidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:507:24)
at Context.RuleTester.it (node_modules/eslint/lib/rule-tester/rule-tester.js:670:25)
9) Typescript no-restricted-paths invalid import type A from "../two/a":
AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
+ expected - actual
-0
+1
at testInvalidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:507:24)
at Context.RuleTester.it (node_modules/eslint/lib/rule-tester/rule-tester.js:670:25)
10) Typescript no-restricted-paths invalid import type A from "../two/a":
AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
+ expected - actual
-0
+1
at testInvalidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:507:24)
at Context.RuleTester.it (node_modules/eslint/lib/rule-tester/rule-tester.js:670:25)
In practice, having a major bump means that bugfixes and security fixes don't get backported, so "they can just stay on an old version" is a pipe dream.
I would love to improve the test and dev experience on Windows, so if you can come up with a PR that doesn't affect runtime I'd be very excited to review it.
In practice, having a major bump means that bugfixes and security fixes don't get backported, so "they can just stay on an old version" is a pipe dream.
Agreed. OTOH, I can't imagine a user who is unhappy that they can't get fixes in eslint-plugin-import
but are otherwise content with using Node 6, eslint 2, and the laundry list of packages that self-declare themselves deprecated upon install!
I would love to improve the test and dev experience on Windows, so if you can come up with a PR that doesn't affect runtime I'd be very excited to review it.
I'll be happy to give it a shot.
I just cloned the repository and these commands.
Specs: windows 11 node 18.11.0 npm 9.4.0