oxc icon indicating copy to clipboard operation
oxc copied to clipboard

`eslint.config.js` support

Open dalisoft opened this issue 9 months ago • 3 comments

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.

dalisoft avatar May 09 '24 23:05 dalisoft

The error message is leading, it should be something like "we do not support files other than json".

Boshen avatar May 14 '24 10:05 Boshen

@Boshen yes, but support for eslint.config.js would be cool

dalisoft avatar May 14 '24 20:05 dalisoft

@dalisoft please refer to this statement @Boshen made: https://github.com/oxc-project/oxc/pull/2214#issuecomment-1921636907

DonIsaac avatar May 15 '24 04:05 DonIsaac

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.

AndreaPontrandolfo avatar May 19 '24 08:05 AndreaPontrandolfo

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 avatar May 19 '24 09:05 Boshen

You mean this? I guess everything can be found here.

AndreaPontrandolfo avatar May 19 '24 09:05 AndreaPontrandolfo

@Boshen if you'd like I can put something together

DonIsaac avatar May 20 '24 20:05 DonIsaac

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.

milesj avatar May 20 '24 21:05 milesj

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.

Boshen avatar May 21 '24 02:05 Boshen

Maybe we can use eslint --print-config to do it. This command will output all configurations in JSON format.

Dunqing avatar May 24 '24 08:05 Dunqing

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

corbinu avatar May 30 '24 20:05 corbinu

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.

Boshen avatar Sep 11 '24 07:09 Boshen