Open Belco90 opened 5 months ago
An example of a similar migration on another eslint plugin: https://github.com/eslint-community/eslint-plugin-security/pull/145/files
@thenbe Thanks for the example! It will definitely help when migrating this plugin.
For anyone tracking this PR: eslint released some compatibility utilities that allows users to use this plugin in its current state with eslint v9.
tldr:
// eslint.config.js
import testingLibrary from 'eslint-plugin-testing-library';
+ import { fixupPluginRules } from '@eslint/compat';
{
files: ['**/*.test.{js,ts,jsx,tsx}'],
plugins: {
- 'testing-library': {
- rules: testingLibrary.rules,
- },
+ 'testing-library': fixupPluginRules({
+ rules: testingLibrary.rules,
+ }),
},
rules: testingLibrary.configs.react.rules,
}
For anyone tracking this PR: eslint released some compatibility utilities that allows users to use this plugin in its current state with eslint v9.
Thank you for this. I didn't remember this existed when I went through the flat-config docs.
For anyone using with eslint-plugin-import
, when I add the compat lib, I receive an eslint error above the import statement:
// Parse errors in imported module '@eslint/compat': parserPath or languageOptions.parser is required! (undefined:undefined) import/namespace
import { fixupPluginRules } from "@eslint/compat";
It's important to note that eslint-plugin-import
is (also) not quite ready for flat-config, however, I tested a few rules from eslint-plugin-testing-library
and the solution offered by @thenbe is working properly based on my limited testing.
is there Any ETA for it?
I have opened #925 which should resolve this without requiring a new major
Plugin version
n/a
What problem do you want to solve?
Your take on the correct solution?
Apply the changes mentioned in the linked migration docs so the custom rules are adapted to ESLint v9 and the
Anything else?
No response
Do you want to submit a pull request to implement this change?
Yes