Closed rdebeasi closed 7 months ago
We don't support flat config yet, so you have to use eslint's FlatCompat wrapper.
Ah, I see. Thank you for the update!
Quick update: I was able to use the plugin with flat config by following these instructions from the readme.
Would you like me to close this ticket, or is there more work to be done to fully support flat configs?
lol oops, i forgot we do support flat config :-) glad you found the section in the readme!
If anyone finds this issue, I was using ESM and according to the docs, we need to import this plugin with the .js
extension.
My code is as follows:
import eslint from '@eslint/js'
import react from 'eslint-plugin-react/configs/recommended.js' <---- Note the extension here
import tseslint from 'typescript-eslint'
export default tseslint.config( <--- This is the same as export default [...]
react,
eslint.configs.recommended,
...tseslint.configs.recommended,
{
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
},
},
)
When using ESM, I get a TS error: Could not find a declaration file for module eslint-plugin-react/configs/recommended.js
.
Could that be improved on the part of the library?
Is there an existing issue for this?
Description Overview
I receive an "Oops! Something went wrong!" error when using
eslint-plugin-react
with a flat config.eslint.config.js
Error message
When I remove eslint-plugin-react, the error goes away.
eslint.config.js without eslint-plugin-react
Expected Behavior
When a flat config is used with eslint-plugin-react, running the linter from the CLI returns either a success code or a list of linter errors.
eslint-plugin-react version
7.33.2
eslint version
8.56.0
node version
20.7.0