You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Note:** If you installed ESLint globally (using the `-g` flag in npm, or the `global` prefix in yarn) then you must also install `eslint-plugin-jsx-a11y` globally.
62
62
63
-
## Usage
63
+
## Usage (legacy: `.eslintrc`)
64
64
65
65
Add `jsx-a11y` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
66
66
@@ -108,6 +108,125 @@ configuration file by mapping each custom component name to a DOM element type.
108
108
}
109
109
```
110
110
111
+
## Usage (new: `eslint.config.js`)
112
+
113
+
From [`v8.21.0`](https://github.com/eslint/eslint/releases/tag/v8.21.0), eslint announced a new config system.
114
+
In the new system, `.eslintrc*` is no longer used. `eslint.config.js` would be the default config file name.
115
+
In eslint `v8`, the legacy system (`.eslintrc*`) would still be supported, while in eslint `v9`, only the new system would be supported.
116
+
117
+
And from [`v8.23.0`](https://github.com/eslint/eslint/releases/tag/v8.23.0), eslint CLI starts to look up `eslint.config.js`.
118
+
**So, if your eslint is `>=8.23.0`, you're 100% ready to use the new config system.**
119
+
120
+
You might want to check out the official blog posts,
If your eslint.config.js is ESM, include the `.js` extension (e.g. `eslint-plugin-jsx-a11y/recommended.js`). Note that the next semver-major will require omitting the extension for these imports.
163
+
164
+
**Note**: These configurations will import `eslint-plugin-jsx-a11y` and enable JSX in [`languageOptions.parserOptions`](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#configuration-objects).
165
+
166
+
In the new config system, the `plugin:` protocol(e.g. `plugin:jsx-a11y/recommended`) is no longer valid.
167
+
As eslint does not automatically import the preset config (shareable config), you explicitly do it by yourself.
jsxA11yRecommended, // This is not a plugin object, but a shareable config object
175
+
…
176
+
];
177
+
```
178
+
179
+
You can of course add/override properties.
180
+
181
+
**Note**: Our shareable configs does not preconfigure `files` or [`languageOptions.globals`](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#configuration-objects).
182
+
For most of the cases, you probably want to configure some properties by yourself.
0 commit comments