-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
test: enable strict mode in type tests
#20398
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
Conversation
✅ Deploy Preview for docs-eslint canceled.
|
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.
Pull request overview
This PR aims to enable strict mode in TypeScript type tests for consistency with other ESLint plugin projects and updates TypeScript to version 5.9.3.
- Adds
strict: trueto the tsconfig.json for type tests - Updates TypeScript version from 5.3.3 to 5.9.3 in the root package.json
- Updates TypeScript version from 5.7.2 to 5.9.3 in eslint-config-eslint package.json
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/lib/types/tsconfig.json | Adds strict: true compiler option to enable strict type checking |
| packages/eslint-config-eslint/package.json | Downgrades TypeScript dev dependency from 5.7.2 to 5.9.3 |
| package.json | Updates TypeScript dev dependency from 5.3.3 to 5.9.3 |
tests/lib/types/tsconfig.json
Outdated
| "noImplicitAny": true, | ||
| "noImplicitThis": true, | ||
| "strict": true, | ||
| "strictNullChecks": true, | ||
| "strictFunctionTypes": true, |
Copilot
AI
Dec 14, 2025
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.
With strict: true enabled, the explicit flags noImplicitAny, noImplicitThis, strictNullChecks, and strictFunctionTypes are redundant as they are already included in the strict flag. Consider removing these redundant flags for cleaner configuration, or if keeping them for documentation purposes, add a comment explaining why they're explicitly listed.
| "noImplicitAny": true, | |
| "noImplicitThis": true, | |
| "strict": true, | |
| "strictNullChecks": true, | |
| "strictFunctionTypes": true, | |
| "strict": true, |
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.
The default strict mode setup may change with the major update, so I think it’s fine to leave it as-is.
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 it’s fine to remove the other settings in this case. From what I understand, strict mode has only ever enabled new strict options even in minor releases (for example, strictFunctionTypes in TypeScript 2.6), and has never disabled any.
If you're genuinely concerned that strict may change over time and that this could be problematic for some project, it's better to avoid using it and instead enable the individual options directly.
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 followed your first suggestion and updated it in this commit: 49b3a01
fasttime
left a comment
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.
LGTM, thanks!
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:
What changes did you make? (Give an overview)
In this PR, I've enabled
strictmode for the type tests.Currently, the type tests don't set
strict: true, and the current test setup doesn't match thestrictmode described in TypeScript'stsconfigdocumentation.Ref: https://www.typescriptlang.org/tsconfig/#strict
Also, the
rewrite,css,json, andmarkdownplugins have already enabledstrictmode for their type tests, so I've enabledstrictmode here as well for more accurate type checking and consistency.Additionally, I've updated
typescriptto the latest version,5.9.3.Is there anything you'd like reviewers to focus on?
N/A