antfu / eslint-config

Anthony's ESLint config preset

Home Page:https://eslint-config.antfu.me/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I love this config but Eslint is slow.

riderx opened this issue · comments

Clear and concise description of the problem

My problem is ESLint speed, I tried biome for example and there is nothing to compare, plus it works for lint and formatting by default.

Suggested solution

Currently, the config here has a very specific system, and Biomejs just released an ESLint convert CLI, but it doesn't understand this config.
I'm not sure, we should all go to biome, but I would love to be able to experiment with it by having a way to make this tool able to export a normal ESLint config and convert it to biome to see if just like this if that improve my workflow.

Alternative

Making ESLint fast could be an alternative, but I'm not sure how we can do that.

Additional context

Biome command to auto-convert ESLint: https://biomejs.dev/guides/migrate-eslint-prettier/

No response

Validations

How's related to this project? Feel free to use tools that make sense to you. ESLint is never slow to me as it's not speed-sensitive and usually runs per-file on save.

I would love to, the problem is, this config is not standard and so it's impossible to auto-convert it.
So I wonder how I could easily convert it to flat config to be able to convert it to biome.
As a side note, I would also like your opinion on Biome as that far from ESLint but definitely has some improvement.

AFAICT, biome is not compatible with eslint rules. Instead, Biome has their own alternatives to some existing eslint rules. My point is that if you manage to use this auto-migration tool, it won't be able to do anything about the unsupported rules.

Regardless, if you still want to use this auto-migration tool, you could probably just copy the rules) from the relevant plugins into a single eslint.config.js file and point the auto-migration tool to that.

react rules for example:

// recommended rules from @eslint-react/dom
'react-dom/no-children-in-void-dom-elements': 'warn',
'react-dom/no-dangerously-set-innerhtml': 'warn',
'react-dom/no-dangerously-set-innerhtml-with-children': 'error',
'react-dom/no-find-dom-node': 'error',
'react-dom/no-missing-button-type': 'warn',
'react-dom/no-missing-iframe-sandbox': 'warn',
'react-dom/no-namespace': 'error',
'react-dom/no-render-return-value': 'error',
'react-dom/no-script-url': 'warn',
'react-dom/no-unsafe-iframe-sandbox': 'warn',
'react-dom/no-unsafe-target-blank': 'warn',
// recommended rules react-hooks
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
// react refresh
'react-refresh/only-export-components': [
'warn',
{
allowConstantExport: isAllowConstantExport,
allowExportNames: [
...(isUsingNext
? [
'config',
'generateStaticParams',
'metadata',
'generateMetadata',
'viewport',
'generateViewport',
]
: []),
...(isUsingRemix
? [
'meta',
'links',
'headers',
'loader',
'action',
]
: []),
],
},
],
// recommended rules from @eslint-react
'react/ensure-forward-ref-using-ref': 'warn',
'react/no-access-state-in-setstate': 'error',
'react/no-array-index-key': 'warn',
'react/no-children-count': 'warn',
'react/no-children-for-each': 'warn',
'react/no-children-map': 'warn',
'react/no-children-only': 'warn',
'react/no-children-prop': 'warn',
'react/no-children-to-array': 'warn',
'react/no-clone-element': 'warn',
'react/no-comment-textnodes': 'warn',
'react/no-component-will-mount': 'error',
'react/no-component-will-receive-props': 'error',
'react/no-component-will-update': 'error',
'react/no-create-ref': 'error',
'react/no-direct-mutation-state': 'error',
'react/no-duplicate-key': 'error',
'react/no-implicit-key': 'error',
'react/no-missing-key': 'error',
'react/no-nested-components': 'warn',
'react/no-redundant-should-component-update': 'error',
'react/no-set-state-in-component-did-mount': 'warn',
'react/no-set-state-in-component-did-update': 'warn',
'react/no-set-state-in-component-will-update': 'warn',
'react/no-string-refs': 'error',
'react/no-unsafe-component-will-mount': 'warn',
'react/no-unsafe-component-will-receive-props': 'warn',
'react/no-unsafe-component-will-update': 'warn',
'react/no-unstable-context-value': 'error',
'react/no-unstable-default-props': 'error',
'react/no-unused-class-component-members': 'warn',
'react/no-unused-state': 'warn',
'react/no-useless-fragment': 'warn',
'react/prefer-destructuring-assignment': 'warn',
'react/prefer-shorthand-boolean': 'warn',
'react/prefer-shorthand-fragment': 'warn',

You can probably even paste these rules snippets into an llm and tell it to output a single valid javascript object.

Yea, I can see that, a bumpy road.
I will stick to ESLint and this config and hope they will do the Rust shift they were thinking to.
This set of rules is more important right now

The problem is not that the format is auto-convertable or not; it is that the features will never match parity (so even you managed to convert, you gonna lose a lot of features). The nature of native tools like Biome makes them not easily extendable (or will lose performance on interop with JS, which in those cases, might not end up be faster than ESLint). So to make those linter rules works, Biome has to write those rules in Rust and bundle in side the package - this means only the popular, de-facto standard rules will ever be considered implementing - making it quite hard to have rich ecosystem or innovations.

So I would say, please go ahead us Biome if you only ever need those popular rules. As for me, as a poweruser, extensibility and customizability value way much more than a few milliseconds saving on a development-only tool.

I missed this point initially, thanks for the enlightenment.
I do hope they will find a way to make extendable and fast.

Furthermore, I would love to block commit before lint and this is not really nice experience for now.
I have used your rules for years, so I would not change them.
And keep this perfectible experience for now