oxc
oxc copied to clipboard
`eslint.config.js` support
Currently eslint.config.js
is not supported as tested by bunx oxlint . --import-plugin --config=eslint.config.js
And got
❯ bunx oxlint . --import-plugin --config=eslint.config.js
× Failed to parse jsonc file "eslint.config.js"
Invalid Options: Failed to parse configuration file.
The error message is leading, it should be something like "we do not support files other than json".
@Boshen yes, but support for eslint.config.js
would be cool
@dalisoft please refer to this statement @Boshen made: https://github.com/oxc-project/oxc/pull/2214#issuecomment-1921636907
This is actually a HUGE issue because now the new "Flat Config" format (the eslint.config.js
) is the default in ESLint (and ALL the other formats are now deprecated, they just don't work anymore) and not supporting it would mean that you give up on the OXLint <> ESLint interoperability. At which point i don't even know why you are developing the --import-plugin
, if nobody can use OXLint and ESLint togheter.
This is actually a HUGE issue because now the new "Flat Config" format (the
eslint.config.js
) is the default in ESLint (and ALL the other formats are now deprecated, they just don't work anymore) and not supporting it would mean that you give up on the OXLint <> ESLint interoperability. At which point i don't even know why you are developing the--import-plugin
, if nobody can use OXLint and ESLint togheter.
Do you have a rough idea of how to make it work? i.e. load eslint and get all the information we need?
@Boshen if you'd like I can put something together
You can't load and evaluate JavaScript from Rust, that's the crux of the problem.
To make this even remotely work, you would need to execute a node
process that loads eslint, resolves the config, and outputs its information as JSON (is this even possible?). With this, you're now coupling node's overhead to Rust, and you lose some performance wins.
You can't load and evaluate JavaScript from Rust, that's the crux of the problem.
To make this even remotely work, you would need to execute a
node
process that loads eslint, resolves the config, and outputs its information as JSON (is this even possible?). With this, you're now coupling node's overhead to Rust, and you lose some performance wins.
I'm not worried about the performance impact, I'm worried about the maintenance burden put into this project, as stated in https://github.com/oxc-project/oxc/pull/2214#issuecomment-1921636907
When I was doing research while setting up oxlint, I read almost all ESLint related issues from GitHub, stackoverflow, discord, reddit etc, and 90% of them are configuration issues, and a lot of them are unanswered due to its context and complexity.
Maybe we can use eslint --print-config
to do it. This command will output all configurations in JSON format.
If oxlint is going to have compatibitly only with eslint 8 and before configs (I think a valid opinon given the burden). Perhaps oxlint needs its own new config format that would have the same advantages of the eslint flat config. There is a lot of great information here on why the changes were made: https://eslint.org/blog/2022/08/new-config-system-part-1/
Perhaps a similar system but written in static RON files would be a good solution?
Oxlint could then support both the past eslint json format and its own new format
Due to lack of resources, we decided to cut down the scope and aim for a beta release https://github.com/oxc-project/oxc/issues/5653
Close as not planned for now, we may reconsider this in the future.