-
Notifications
You must be signed in to change notification settings - Fork 2
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
Support TypeScript 5.2.2 #338
base: main
Are you sure you want to change the base?
Changes from all commits
b6e4e72
4bcc647
34496c5
c8d1de9
836c32c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
As recommended in the vitest docs: https://typescript-eslint.io/packages/rule-tester#vitest | ||
|
||
ESLint's RuleTester relies on some global hooks for tests. If they aren't available globally, your tests will fail with an error like: | ||
|
||
``` | ||
Error: Missing definition for `afterAll` - you must set one using `RuleTester.afterAll` or there must be one defined globally as `afterAll`.` | ||
``` | ||
*/ | ||
|
||
import * as vitest from 'vitest'; | ||
import { RuleTester } from '@typescript-eslint/rule-tester'; | ||
|
||
RuleTester.afterAll = vitest.afterAll; | ||
RuleTester.it = vitest.it; | ||
RuleTester.itOnly = vitest.it.only; | ||
RuleTester.describe = vitest.describe; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { RuleTester } from '@typescript-eslint/rule-tester'; | ||
import rule from './no-const-enum'; | ||
|
||
const ruleTester = new RuleTester(); | ||
|
||
ruleTester.run('no-const-enum', rule, { | ||
valid: ['const x = 1;', 'const oneEnum = { "ONE": "one" };', 'const enumTwo = { "TWO": "two" };', 'enum a { "KEY" = "VALUE" };'], | ||
invalid: [ | ||
{ | ||
code: 'const enum a { "KEY" = "VALUE" };', | ||
errors: [ | ||
{ | ||
messageId: 'noConstEnum', | ||
}, | ||
], | ||
}, | ||
], | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { RuleTester } from '@typescript-eslint/rule-tester'; | ||
import rule from './no-enum'; | ||
|
||
const ruleTester = new RuleTester(); | ||
|
||
ruleTester.run('no-enum', rule, { | ||
valid: ['const x = 1;', 'const oneEnum = { "ONE": "one" };', 'const enumTwo = { "TWO": "two" };'], | ||
invalid: [ | ||
{ | ||
code: 'enum a { "KEY" = "VALUE" };', | ||
errors: [ | ||
{ | ||
messageId: 'noEnum', | ||
}, | ||
], | ||
}, | ||
{ | ||
code: 'const enum a { "KEY" = "VALUE" };', | ||
errors: [ | ||
{ | ||
messageId: 'noEnum', | ||
}, | ||
], | ||
}, | ||
], | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
"extends": "typesafeconfig", | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"moduleResolution": "Bundler", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added to allow TS to continue to pick up the correct types. typescript-eslint/typescript-eslint#7284 Contains a warning when building, but appears to still produce the same output. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this issue persist into v8 of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is fixed! Removed the patch in 34496c5. |
||
"outDir": "dist" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
setupFiles: './setupTests.ts' | ||
}, | ||
}) |
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.
This is the main change, and what removes the nested problematic
tsutils
package from the dependency tree: typescript-eslint/typescript-eslint#7155 (comment)@shian15810 what do you think about this?
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.
Could you bump this to major version 8 of
@typescript-eslint/utils
? Its latest version is currently8.18.0
.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.
Done!
34496c5