oxc icon indicating copy to clipboard operation
oxc copied to clipboard

oxlint: Suggestion for JS-based config file

Open lachlancollins opened this issue 6 months ago • 1 comments

Problem

Hi there, thanks so much for all the work that's gone into this project so far, I'm finally testing out oxlint and it's such a dramatic performance leap!

One problem I've noticed is that only 90 of the 400+ rules are enabled by default, and there doesn't seem to be an easy way to enable "groups" of rules in the config. For example, if I wanted to enable all of the currently implemented recommended eslint-plugin-jsdoc rules, that would be 18 lines to add to an .oxlintrc.json. And when new rules get added, I'd need to keep an eye on the changelog and manually enable these.

Additionally, since the config is JSON-based, there isn't an easy way to share config between projects. For example, I'd love to add a shared oxlint config for TanStack projects to @tanstack/config.

Suggestion

I think it would make more sense to use a JS-based config. Other rust-based JS tools such as rolldown and rspack adopt the popular <tool>.config.js and defineConfig pattern, which works really well for generating shareable and extendable configs.

With a JS setup, it would also be possible to easily enable groups of rules (e.g. import { jsdoc } from 'oxlint/configs', then rules: [...jsdoc['recommended']).

I know that the current config is partially compatible with legacy .eslintrc.json, but I don't think it's necessarily a good idea to try to match how flat eslint.config.js works. I think the extensibility improvements from being able to share configs would help overcome any pain points of having two separate lint configs (at least until a project can fully switch over all rules to oxlint!)

Somewhat related: #4600, #3217

lachlancollins avatar Aug 09 '24 05:08 lachlancollins