-
Notifications
You must be signed in to change notification settings - Fork 26.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eslint v9 support #2961
Comments
Certain extensions aren't compatible yet with 9.X such as: airbnb/javascript#2961
since eslint v9 is released, there are some packages like eslint-config-airbnb that is a boilerplate setup community contribution that doesn't support eslint v9 yet. follow more on airbnb/javascript#2961
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
* Remove Airbnb ESLint config, as it doesn't support ESLint 9. Consider adding it back once airbnb/javascript#2961 is resolved. * We're still using the legacy config format, since facebook/react#30774 is not merged yet. * Fix some lint errors output by the new ESLint config. * The TypeScript version is bumped to 5.6.3, which is the latest supported by typescript-eslint.
* Remove Airbnb ESLint config, as it doesn't support ESLint 9. Consider adding it back once airbnb/javascript#2961 is resolved. * We're still using the legacy config format, since facebook/react#30774 is not merged yet. * Fix some lint errors output by the new ESLint config. * The TypeScript version is bumped to 5.6.3, which is the latest supported by typescript-eslint.
I see it will take a bit longer than I expected. Has anyone a workaround while its in progress? |
@dgtllion this is still within the expected timeframe. The workaround is "stick with eslint 8 for now". |
My goal is to move to eslint v9. I think your advice is more to stayaround instead of workaround. |
@dgtllion here is an excerpt of what I use to make airbnb works in ESLint 9 : https://gist.github.com/xfournet/ed9f2f02e411b86188bad4aeb9b1bddb |
Here’s the workaround I’m using for
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import stylisticPlugin from '@stylistic/eslint-plugin';
// Load airbnb config as FlatConfig
const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
const airbnbFlat = compat.extends('eslint-config-airbnb');
// Extract list of rules
const baseRuleEntries = airbnbFlat.flatMap((cfg) => (cfg.rules ? Object.entries(cfg.rules) : []));
// 1. Replace deprecated stylistic rules with rules from stylistic plugin
const ruleEntriesWithStylisticVersion = baseRuleEntries
.map(([rule, setting]) => [rule.split('/').at(-1), setting])
.filter(([rule]) => rule in stylisticPlugin.rules);
const stylisticPatchedRules = {
...Object.fromEntries(baseRuleEntries),
...stylisticPlugin.configs['disable-legacy'].rules,
...Object.fromEntries(ruleEntriesWithStylisticVersion.map(([rule, setting]) => [`@stylistic/${rule}`, setting])),
};
// 2. For typescript config, replace rules that have a typescript-eslint version
const ruleEntriesWithTsEslintVersion = baseRuleEntries
.filter(([rule]) => rule in (tseslint.plugin.rules ?? {}));
const typescriptPatchedRules = Object.fromEntries([
...ruleEntriesWithTsEslintVersion.map(([rule]) => [rule, 'off']),
...ruleEntriesWithTsEslintVersion.map(([rule, setting]) => [`@typescript-eslint/${rule}`, setting]),
]);
export default [
// Base rules - patched to use stylistic plugin
{
plugins: { '@stylistic': stylisticPlugin },
rules: stylisticPatchedRules,
},
// Within typescript files, use the @typescript-eslint version of any rule we can
{
files:['**/*.ts', '**/*.tsx', '**/*.d.ts'],
rules: typescriptPatchedRules,
},
]; |
@dgtllion you can't move to eslint 9 yet while using the airbnb config in a supported fashion. You can choose to be unsupported (using the workaround above, for example), or choose to wait on eslint 8 (which is perfectly reasonable and won't obstruct anything meaningful), or choose to stop using the airbnb config. |
(see also #2478, #2223, #2036, #1834, #1447)
eslint v9 was released on 2024.04.05.
The current plan is, if possible, to release a new semver-minor of both configs, that supports
7 || 8 || 9
.Note that this is different from whether flat config is supported or not by these plugins, and from whether this project will convert to flat config.
The timeframe for eslint v9 support is "not as soon as you would like, but as soon as we can".
Please accept this, and please add no noise to this thread beyond emoji reactions - distractions won't help anyone get the work done any faster.
Please do not file additional issues and do not file pull requests attempting to add support - please, instead, continue to use eslint v8 until such time as our configs support v9.
Peer Dep eslint combined v7, v8, and v9 support released:
eslint-plugin-import
(PR)eslint-find-rules
eslint-plugin-react
eslint-plugin-jsx-a11y
(PR)eslint-plugin-react-hooks
The text was updated successfully, but these errors were encountered: