Skip to content

Commit e333c8f

Browse files
authored
fix unstable plugin reference with flat configs
The previous use of spread meant that ```ts import jsxA11y from 'eslint-plugin-jsx-a11y'; jsxA11y !== jsxA11y.flatConfigs.recommended.plugins['jsx-a11y'] ``` This is a problem because if someone does something like this ```js import jsxA11y from 'eslint-plugin-jsx-a11y'; export default [ { plugins: { 'jsx-a11y': jsxA11y } }, jsxA11y.flatConfigs.recommended, ]; ``` then ESLint will crash with the error `Config "jsx-a11y/recommended": Key "plugins": Cannot redefine plugin "jsx-a11y".` This PR fixes that by using `Object.assign` to mutate the `jsxA11y` object and maintain referential equality.
1 parent 743168b commit e333c8f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,4 +317,4 @@ const flatConfigs = {
317317
strict: createConfig(strictRules, 'strict'),
318318
};
319319

320-
module.exports = { ...jsxA11y, configs, flatConfigs };
320+
module.exports = Object.assign(jsxA11y, { configs, flatConfigs });

0 commit comments

Comments
 (0)