-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Describe the bug
npm run lint or npx eslint src fails to run on a freshly created SvelteKit project, complaining that Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/zizheng/Projects/my-app/.eslintrc.js from /Users/zizheng/Projects/my-app/node_modules/@eslint/eslintrc/dist/eslintrc.cjs not supported. ... (see logs section for details).
Reproduction
The following steps can be reproduced
- both on macOS 12.4 and Windows 11
- both with the demo project and the skeleton project
- both with and without TypeScript
$ npm create svelte my-app
...
✔ Which Svelte app template? › Skeleton project
✔ Add type checking with TypeScript? › No
✔ Add ESLint for code linting? … Yes
✔ Add Prettier for code formatting? … No
✔ Add Playwright for browser testing? … No
...
$ cd my-app
$ npm install
$ npm run lint
Logs
$ npm --version
8.13.1
$ npm create svelte my-app
create-svelte version 2.0.0-next.143
Welcome to SvelteKit!
This is beta software; expect bugs and missing features.
Problems? Open an issue on https://github.com/sveltejs/kit/issues if none exists already.
✔ Which Svelte app template? › Skeleton project
✔ Add type checking with TypeScript? › No
✔ Add ESLint for code linting? … Yes
✔ Add Prettier for code formatting? … No
✔ Add Playwright for browser testing? … No
Your project is ready!
✔ ESLint
https://github.com/sveltejs/eslint-plugin-svelte3
Install community-maintained integrations:
https://github.com/svelte-add/svelte-adders
Next steps:
1: cd my-app
2: npm install (or pnpm install, etc)
3: git init && git add -A && git commit -m "Initial commit" (optional)
4: npm run dev -- --open
To close the dev server, hit Ctrl-C
Stuck? Visit us at https://svelte.dev/chat
$ cd my-app
$ npm install
> [email protected] prepare
> svelte-kit sync
added 183 packages, and audited 184 packages in 13s
21 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
$ npm run lint
> [email protected] lint
> eslint .
Oops! Something went wrong! :(
ESLint: 8.18.0
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/zizheng/Projects/my-app/.eslintrc.js from /Users/zizheng/Projects/my-app/node_modules/@eslint/eslintrc/dist/eslintrc.cjs not supported.
Instead change the require of .eslintrc.js in /Users/zizheng/Projects/my-app/node_modules/@eslint/eslintrc/dist/eslintrc.cjs to a dynamic import() which is available in all CommonJS modules.
at module.exports [as default] (/Users/zizheng/Projects/my-app/node_modules/import-fresh/index.js:32:59)
at loadJSConfigFile (/Users/zizheng/Projects/my-app/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2559:47)
at loadConfigFile (/Users/zizheng/Projects/my-app/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2643:20)
at ConfigArrayFactory.loadInDirectory (/Users/zizheng/Projects/my-app/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2840:34)
at CascadingConfigArrayFactory._loadConfigInAncestors (/Users/zizheng/Projects/my-app/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3833:46)
at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/zizheng/Projects/my-app/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3754:18)
at FileEnumerator._iterateFilesRecursive (/Users/zizheng/Projects/my-app/node_modules/eslint/lib/cli-engine/file-enumerator.js:446:49)
at _iterateFilesRecursive.next (<anonymous>)
at FileEnumerator.iterateFiles (/Users/zizheng/Projects/my-app/node_modules/eslint/lib/cli-engine/file-enumerator.js:297:49)
at iterateFiles.next (<anonymous>)
at CLIEngine.executeOnFiles (/Users/zizheng/Projects/my-app/node_modules/eslint/lib/cli-engine/cli-engine.js:786:48)
at ESLint.lintFiles (/Users/zizheng/Projects/my-app/node_modules/eslint/lib/eslint/eslint.js:550:23)
at Object.execute (/Users/zizheng/Projects/my-app/node_modules/eslint/lib/cli.js:301:36)
at main (/Users/zizheng/Projects/my-app/node_modules/eslint/bin/eslint.js:138:52)
at Object.<anonymous> (/Users/zizheng/Projects/my-app/node_modules/eslint/bin/eslint.js:142:2)System Info
System:
OS: macOS 12.4
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 9.94 GB / 32.00 GB
Shell: 3.5.0 - /usr/local/bin/fish
Binaries:
Node: 18.4.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.13.1 - /usr/local/bin/npm
Browsers:
Firefox: 102.0
Safari: 15.5
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.52
@sveltejs/kit: next => 1.0.0-next.355
svelte: ^3.44.0 => 3.48.0Severity
annoyance
Additional Information
No response
Metadata
Metadata
Assignees
Labels
No labels