sloops77 / eslint-plugin-better-mutation

Eslint rules to enforce function-scope mutation only
MIT License
20 stars 6 forks source link

Support for eslint v9 and flat config #49

Open skyqrose opened 4 months ago

skyqrose commented 4 months ago

Eslint v9 has breaking changes and a new config format. There's more discussion on another eslint plugin here: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/978

Alternatively, this workaround allowed me to use this plugin in a flat config (on eslint v8, I haven't tested v9). You could add it to the installation instructions.

// eslint.config.mjs
import pluginBetterMutation from "eslint-plugin-better-mutation";

export default [
  // ...
  {
    plugins: {
      'better-mutation': pluginBetterMutation,
      // ... other plugins
    },
    rules: [
      ...pluginBetterMuttation.configs.recommended.rules,
      // ... other plugins and rules
    ]
  },
  // ...
];
sloops77 commented 3 months ago

@skyqrose thanks for your suggestion! Docs have been updated. Proper flatconfig support is incoming too