-
-
Notifications
You must be signed in to change notification settings - Fork 700
test: rewrite some files in .ts
#2968
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
base: master
Are you sure you want to change the base?
Conversation
|
FloEdelmann
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.
Cool!
FloEdelmann
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.
Looks good to me now. Thank you! 🙂
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 converts several test files from JavaScript (.js) to TypeScript (.ts) to enable direct import of TypeScript files in modern Node.js versions. The changes include:
- Migration from CommonJS
require()to ES6importstatements - Addition of type annotations for better type safety
- Configuration updates to support TypeScript test files
- Addition of non-null assertions with corresponding ESLint rule disabled
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Added vitest globals types and included test TypeScript files in compilation |
| tests/lib/rules/comment-directive.ts | Converted from .js to .ts with ES6 imports and type annotations |
| tests/lib/rules/block-order.ts | Converted from .js to .ts with ES6 imports, type annotations, and removed unnecessary output: null from valid test cases |
| tests/lib/configs/flat.ts | Converted from .js to .ts with ES6 imports, type annotations, and added non-null assertions |
| tests/lib/configs/eslintrc.ts | Converted from .js to .ts with ES6 imports |
| eslint.config.mjs | Disabled @typescript-eslint/no-non-null-assertion rule to allow non-null assertions in TypeScript code |
Comments suppressed due to low confidence (1)
tests/lib/rules/block-order.ts:4
- The import path
'../../../node_modules/@types/eslint'is fragile and non-standard. Import from'eslint'directly instead, as TypeScript will resolve the correct type definitions automatically.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
In earlier Node.js versions, importing
tsfiles directly wasn't supported, so the failing test files from #2916 have been changed to use the.tsextension in this PR.