eslint / eslint

Find and fix problems in your JavaScript code.
https://eslint.org
MIT License
24.39k stars 4.4k forks source link

Bug: TypeError [ERR_IMPORT_ATTRIBUTE_MISSING] #18409

Closed jamesrweb closed 2 weeks ago

jamesrweb commented 2 weeks ago

Environment

Node version: v21.7.3 npm version: v10.5.0 Local ESLint version: v9.1.1 (Currently used) Global ESLint version: Not found Operating System: darwin 23.4.0

What parser are you using?

Default (Espree)

What did you do?

Configuration ``` { "root": true, "parser": "@typescript-eslint/parser", "plugins": ["@typescript-eslint"], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended" ], "rules": { "no-console": 2 } } ```
Not applicable

What did you expect to happen?

Ran pnpm eslint --config "/path/to/my/eslint.config.json" .... from my lint.sh bash script.

What actually happened?

TypeError [ERR_IMPORT_ATTRIBUTE_MISSING]: Module "file:///path/to/my/project/config/eslint/eslint.config.json?mtime=1713773393975" needs an import attribute of "type: json"

Link to Minimal Reproducible Example

N / A

Participation

Additional comments

All paths are correct in the lint.sh, eslint has issues with the config json for some reason though. It is not related to a file, a parser or a lint config, simply the CLI itself.

mdjermanovic commented 2 weeks ago

In ESLint v9, eslint.config.js is the new default configuration format. JSON config files are not supported by the new config format.

If you still need to use the old (now deprecated) eslintrc config format, you'll have to set environment variable ESLINT_USE_FLAT_CONFIG to false.

https://eslint.org/docs/latest/use/migrate-to-9.0.0#flat-config