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
Github Javascript Action requiring ESLint throws Cannot find module '@eslint/eslintrc/universal'
#14986
Comments
I think this will help you #14936 (comment) |
Thanks but this setup doesn't have jest. It is a simple nodejs |
I couldn't reproduce this error in Github CI with a copy of the file, only with the action. This works (runs local file): https://github.com/mdjermanovic/test-eslint-beta/blob/main/.github/workflows/smoke-test.yml Could it be that the action is run using a different Node.js version that doesn't support subpaths in Can you add this to the test action: console.log(process.version); |
Looks like it's v12.13.1, which isn't supported by ESLint v8. https://github.com/mdjermanovic/test-eslint-beta/runs/3451676360?check_suite_focus=true |
It will probably work well in a Here's a test action: https://github.com/mdjermanovic/test-docker-action Test run: https://github.com/mdjermanovic/test-eslint-beta/runs/3452043609?check_suite_focus=true |
require('./node_modules/eslint')
throws Cannot find module '@eslint/eslintrc/universal'
Cannot find module '@eslint/eslintrc/universal'
That's it - great catch @mdjermanovic! The workflow is running node I was blindly trusting the workflow logs when
Currently runs:
using: 'node14'
So the only way to get this working is to use the Once v8 is released as stable it might be worth to include short statement regarding Github Javascript Actions in release notes. I think there are couple of Github Actions created for linting projects on CI. As there is nothing wrong with |
setup-node doesn’t have node > 12 yet, but https://github.com/ljharb/actions works fine :-p |
@ljharb by With workflow - uses: actions/setup-node@v2
with:
node-version: 14
- uses: AriPerkkio/eslint-remote-tester-run-action@test/eslint-v8 we end up in a situation where
The workflow runs The root cause is this line https://github.com/AriPerkkio/eslint-remote-tester-run-action/blob/a6174c3d08c4aa508075b310429321f623cc8fe2/action.yml#L31, where only allowed values are |
Right, I'm saying that my action only has one version of node available for anything :-) |
Relates to third party integrations with ESLint utilizing nodejs linter API.
Tell us about your environment
What parser (default,
@babel/eslint-parser
,@typescript-eslint/parser
, etc.) are you using?Unrelevant, but
default
.Please show your full configuration:
Unrelevant, but:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
Requiring
eslint
with absolute path fails due to@eslint/eslintrc/universal
being unable to load.eslint/lib/linter/linter.js
Line 27 in c9947d2
I'm only able to reproduce this issue in Github CI. In local environment it always works. I have no idea why.
https://github.com/AriPerkkio/eslint-remote-tester-bot-test-setups/runs/3449285821?check_suite_focus=true
This error message is also mentioned in different issue: #14936 (comment).
What did you expect to happen?
Should work exactly as v7 works.
This issue only comes up with v8 beta. Eslint@7 works fine.
What actually happened? Please copy-paste the actual, raw output from ESLint.
eslint/lib/linter/linter.js
fails to load.Steps to reproduce this issue:
Sorry for not being able to provide easy repro but I'll try to describe the situtation.
Run this file in Github CI https://github.com/AriPerkkio/eslint-remote-tester-run-action/blob/acb6f063cb0d9ea8dfd183e69caba14dd7a67330/dist/index.js.
In minimal repro:
eslint-remote-tester-run-acton
importseslint
using absolute path. This is how Github CI Action can utilize dependencies of projects it is being used in. https://github.com/AriPerkkio/eslint-remote-tester-run-action/blob/acb6f063cb0d9ea8dfd183e69caba14dd7a67330/dist/index.js#L24-L27In my real use case:
eslint-remote-tester
utilizes ESLint's Nodejs API: engine/worker-task.tseslint-remote-tester-run-action
is requringeslint-remote-tester
using absolute path: peer-dependencies.ts.eslint-remote-tester-run-action
->eslint-remote-tester
->eslint
->@eslint/eslintrc/universal
Are you willing to submit a pull request to fix this bug?
Yes.
Some debugging narrowing common mistakes out of scope
https://github.com/AriPerkkio/eslint-remote-tester-bot-test-setups/runs/3449285821?check_suite_focus=true
./node_modules/@eslint/eslintrc/dist
and its universal is available on file system ✅eslint@8
is available on file system ✅@eslint/eslintrc@1
is available on file system ✅The text was updated successfully, but these errors were encountered: