Skip to content
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

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open

Migrate to ESLint 9 #109

wants to merge 27 commits into from

Conversation

amannn
Copy link
Member

@amannn amannn commented Oct 4, 2024

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

eslint-config-molindo@8.0.0-alpha.8

Details

I've also added two PRs to potentially get rid of peer dependency warnings in yarn v1:

In 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.

'jest',
'cypress',
'vitest'
)),
Copy link
Member Author

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)
Copy link
Member Author

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"
Copy link
Member Author

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
Copy link
Member Author

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();
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-10-07 at 17 20 27

@amannn amannn requested a review from symn October 7, 2024 15:25
@amannn amannn marked this pull request as ready for review October 7, 2024 15:25
CHANGELOG.md Outdated Show resolved Hide resolved
"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",
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment