-
Notifications
You must be signed in to change notification settings - Fork 30
guardian/eslint-config-typescript v12
#14747
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
Merged
Merged
+436
−844
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
This involved some dependency updates, including updating `typescript-eslint` from v7 to v8, which came with a number of breaking changes, detailed here: https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/ The first set of changes required to handle this were to our ESLint config. `no-var-requires` has been deprecated in favour of `no-require-imports`, and the former has been replaced by the latter in the `recommended` preset, which `guardian/eslint-config-typescript` extends. However, we had the former turned off, so this updates our config to turn the latter off instead. See: - https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/#rule-breaking-changes - https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/#updated-configuration-rules `ban-types` has been removed and replaced with `no-restricted-types`, `no-empty-object-type`, `no-unsafe-function-type` and `no-wrapper-object-types`. Previously we used `extendDefaults` to include the latter three rules. That option no longer exists, but they're included in the `recommended-type-checked` preset, which `guardian/eslint-config-typescript` extends, so they should still be present in our config. The remainder of our `ban-types` config involved banning a list of configurable types, which is now handled by `no-restricted-types`. See: - https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/#replacement-of-ban-types - https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/#updated-configuration-rules The second set of changes are to our source files, to fix issues surfaced by the rule changes. These have pre-emptively been handled in earlier commits, and amount to following these rules: - `no-unused-expressions` - `prefer-promise-reject-errors` - `no-empty-object-type` - `no-unsafe-function-type` There is one exception to this, where `prefer-promise-reject-errors` has been disabled for a particular issue in AR.
9ae1271 to
2f084a3
Compare
DanielCliftonGuardian
approved these changes
Oct 27, 2025
|
Seen on PROD (merged by @JamieB-gu 8 minutes and 40 seconds ago) Please check your changes! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
apps-rendering
dotcom-rendering
maintenance
Departmental tracking: maintenance work, not a fix or a feature
Seen-on-PROD
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This involved some dependency updates, including updating
typescript-eslintfrom v7 to v8, which came with a number of breaking changes1.Note: Currently based on #14748 until that's merged. The AR validation check should be fixed by that change.
ESLint Config
The first set of changes required to handle this were to our ESLint config.
no-var-requiresno-var-requireshas been deprecated in favour ofno-require-imports2, and the former has been replaced by the latter in therecommendedpreset3, whichguardian/eslint-config-typescriptextends. However, we had the former turned off, so this updates our config to turn the latter off instead.ban-typesban-typeshas been removed and replaced withno-restricted-types,no-empty-object-type,no-unsafe-function-typeandno-wrapper-object-types4. Previously we usedextendDefaultsto include the latter three rules. That option no longer exists, but they're included in therecommended-type-checkedpreset3, whichguardian/eslint-config-typescriptextends, so they should still be present in our config. The remainder of ourban-typesconfig involved banning a list of configurable types, which is now handled byno-restricted-types.Source Files
The second set of changes are to our source files, to fix issues surfaced by the rule changes. These have pre-emptively been handled in earlier PRs, and amount to following these rules:
no-unused-expressionsin Followno-unused-expressionslint rule #14691 and Followno-unused-expressionslint rule in AR #14748prefer-promise-reject-errorsin Followprefer-promise-reject-errorslint rule #14693no-empty-object-typein Followno-empty-object-typelint rule #14694no-unsafe-function-typein Followno-unsafe-function-typelint rule #14696Footnotes
https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/ ↩
https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/#rule-breaking-changes ↩
https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/#updated-configuration-rules ↩ ↩2
https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/#replacement-of-ban-types ↩