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

eslint v9 #9

Merged
merged 5 commits into from
Jan 22, 2025
Merged

eslint v9 #9

merged 5 commits into from
Jan 22, 2025

Conversation

falkenhawk
Copy link
Member

@falkenhawk falkenhawk commented Jan 9, 2025

Update eslint to v9 and all related dependencies

Refreshed rules config - to avoid breaking changes.

indent rule

indent rule should work better now - although it's still buggy - there might be reports on code which was not reported before.

The biggest pain point might be that typeof does not mark a variable as used by no-unused-vars rule - now error is reported. Related thread: typescript-eslint/typescript-eslint#10266

Added perfectionist/sort-named-imports and perfectionist/sort-named-exports

We had named imports sorted in v1 when tslint was taking care of that. But it got lost during migration to eslint, as I wrongly assumed that import/order will take care of that.

Later on, the support for sorting named imports (but still not exports) was added to the original eslint-plugin-import import-js/eslint-plugin-import#3043 but we have switched to eslint-plugin-import-x since and the porting request of that feature is still pending. un-ts/eslint-plugin-import-x#225

We could consider switching back to eslint-plugin-import but it still has a set of its own, still unresolved issues.
Instead, I decided to try eslint-plugin-perfectionist and the sorting rules from that. Note we are sticking with import/order for sorting and grouping imports for the time being, as more time would be needed to convert the sorting and grouping config to achieve similar behaviour with the perfectionist/sort-imports rule.

There is also perfectionist/sort-exports rule, but it does not provide config options to define grouping and custom sorting, to achieve similar behaviour to import/order with our custom config applied, so for now we won't enforce that rule.

and all related dependencies

Refresh rules config - to avoid breaking changes.
indent rule should work better now - although it's still buggy - there might be reports on code which was not reported before.
The biggest pain point might be that `typeof` does not mark a variable as used by `no-unused-vars` rule - now error is reported. Related thread: typescript-eslint/typescript-eslint#10266
and additional cleanup
- @types/eslint no longer needed, eslint has types built-in now
- decouple from yarn
@falkenhawk
Copy link
Member Author

Published as v3.0.0-rc.0

@@ -492,7 +474,7 @@ function customize(options: CustomizeOptions = {}) {
],
languageOptions: {
globals: {
...globals.jest,
...jestPlugin.environments.globals.globals,
Copy link
Member

Choose a reason for hiding this comment

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

😅 .globals.globals

https://perfectionist.dev/rules/sort-named-imports
https://perfectionist.dev/rules/sort-named-exports

We had named imports sorted in v1 when tslint was taking care of that. But it got lost during migration to eslint, as I wrongly assumed that import/order will take care of that.
Later on, the support for sorting named imports (but still not exports) was added to the original eslint-plugin-import import-js/eslint-plugin-import#3043
but we have switched to eslint-plugin-import-x since and the porting request of that feature is still pending. un-ts/eslint-plugin-import-x#225

We could consider switching back to eslint-plugin-import but it still has a set of its own, still unresolved issues.
Instead, I decided to try eslint-plugin-perfectionist and the sorting rules from that. Note we are sticking with import/order for sorting and grouping imports for the time being, as more time would be needed to convert the sorting and grouping config to achieve similar behaviour with the perfectionist/sort-imports rule.

There is also perfectionist/sort-exports rule, but it does not provide config options to define grouping and custom sorting, to achieve similar behaviour to import/order with our custom config applied, so for now we won't enforce that rule.
@falkenhawk
Copy link
Member Author

falkenhawk commented Jan 20, 2025

Added perfectionist/sort-named-imports and perfectionist/sort-named-exports rules and published as v3.0.0-rc.1 v3.0.0-rc.2.

@falkenhawk
Copy link
Member Author

v3.0.0-rc.3 is out.

@falkenhawk falkenhawk merged commit 06b77c8 into master Jan 22, 2025
@falkenhawk falkenhawk deleted the eslint-v9 branch January 22, 2025 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants