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
## <aname="no-restricted-imports"></a> `no-restricted-imports` now accepts multiple config entries with the same `name`
286
+
287
+
In previous versions of ESLint, if multiple entries in the `paths` array of your configuration for the `no-restricted-imports` rule had the same `name` property, only the last one would apply, while the previous ones would be ignored.
288
+
289
+
As of ESLint v9.0.0, all entries apply, allowing for specifying different messages for different imported names. For example, you can now configure the rule like this:
290
+
291
+
```js
292
+
{
293
+
rules: {
294
+
"no-restricted-imports": ["error", {
295
+
paths: [
296
+
{
297
+
name:"react-native",
298
+
importNames: ["Text"],
299
+
message:"import 'Text' from 'ui/_components' instead"
300
+
},
301
+
{
302
+
name:"react-native",
303
+
importNames: ["View"],
304
+
message:"import 'View' from 'ui/_components' instead"
305
+
}
306
+
]
307
+
}]
308
+
}
309
+
}
310
+
```
311
+
312
+
and both `import { Text } from "react-native"` and `import { View } from "react-native"` will be reported, with different messages.
313
+
314
+
In previous versions of ESLint, with this configuration only `import { View } from "react-native"` would be reported.
315
+
316
+
**To address:** If your configuration for this rule has multiple entries with the same `name`, you may need to remove unintentional ones.
## <aname="string-config"></a> `"eslint:recommended"` and `"eslint:all"` no longer accepted in flat config
285
321
286
322
In ESLint v8.x, `eslint.config.js` could refer to `"eslint:recommended"` and `"eslint:all"` configurations by inserting a string into the config array, as in this example:
0 commit comments