-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to ESLint 9 #109
base: master
Are you sure you want to change the base?
Migrate to ESLint 9 #109
Conversation
'jest', | ||
'cypress', | ||
'vitest' | ||
)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ESLint 9 requires to import plugins and presets. To avoiding having to declare presets both as an import as well as an item within this array, I've added a (type-checked) function that imports them by name.
An important aspect of this is that individual presets only execute when they are loaded (since the typescript
preset depends on the typescript
dependency, as well as the tailwind
preset depends on the tailwindcss
dependency).
- Enable `@typescript-eslint/ban-ts-comment` (fixes #89) | ||
- Upgrade available major versions of dependencies (`@typescript-eslint/eslint-plugin`) | ||
- Add `molindo/tailwind` | ||
- Enable `react/function-component-definition` to have auto fix for using functions of React components (fixes #75) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prettier reindented this file.
}, | ||
"peerDependencies": { | ||
"eslint": "^8.0.0" | ||
"eslint": "^9.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prettier is not a strict peer dependency technically, but strongly recommended (and kind of assumed). Not listing it here gives flexibility to consumers though, e.g. to use alternative formatters like Biome or Oxc.
@@ -0,0 +1,26 @@ | |||
// @ts-check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think authoring the files in JavaScript is quite nice here to avoid a build step entirely. Still, we can use TypeScript to validate the types in our modules.
names.map((name) => import(`./${name}.js`).then((mod) => mod.default)) | ||
); | ||
return config.flat(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"eslint-plugin-jest": "^28.2.3", | ||
"eslint-plugin-jsx-a11y": "^6.10.0", | ||
"eslint-plugin-react": "^7.37.0", | ||
"eslint-plugin-react-hooks": "5.1.0-beta-26f2496093-20240514", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get rid of a warning during install.
This reverts commit 0d66819.
Adds support for ESLint 9 and also addresses various issues raised over time.
Fixes #108
Fixes #107
Fixes #106
Fixes #105
Fixes #102
Fixes #101
Fixes #99
Prerelease
Details
I've also added two PRs to potentially get rid of peer dependency warnings in yarn v1:
vitest
peer dependency optional vitest-dev/eslint-plugin-vitest#548tailwindcss
peer dependency optional francoismassart/eslint-plugin-tailwindcss#365In more recent npm versions, peer dependencies are automatically installed, therefore this doesn't pose a problem. The PRs would still help though, to avoid installing the dependencies in the first place.