Skip to content

Commit

Permalink
chore: Update TS rule tester
Browse files Browse the repository at this point in the history
  • Loading branch information
mskelton committed Oct 29, 2024
1 parent e91c3e6 commit 9ec9233
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
Binary file modified bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"eslint": ">=8.56.0"
},
"dependencies": {
"@typescript-eslint/utils": "^8.11.0",
"@typescript-eslint/utils": "^8.12.1",
"isomorphic-resolve": "^1.0.0",
"natural-compare": "^1.4.0"
},
Expand All @@ -51,7 +51,7 @@
"@types/dedent": "^0.7.0",
"@types/estree": "^1.0.6",
"@types/natural-compare": "^1.4.1",
"@typescript-eslint/rule-tester": "^8.11.0",
"@typescript-eslint/rule-tester": "^8.12.1",
"bun-types": "^1.0.1",
"dedent": "^0.7.0",
"eslint": "^9.13.0",
Expand Down
7 changes: 4 additions & 3 deletions src/__tests__/type-properties.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ ruleTester.run("type-properties", rule, {
// Nested
{
code: "interface A {b:string; a:{b:string; a:number}}",
output: "interface A {a:{b:string; a:number}; b:string}",
// Rule tester will not run multiple fix iterations, but as long as we
// have two errors, we know the nested rule was caught.
output: [
"interface A {a:{b:string; a:number}; b:string}",
"interface A {a:{a:number; b:string}; b:string}",
],
errors: [{ messageId: "unsorted" }, { messageId: "unsorted" }],
},

Expand Down
7 changes: 2 additions & 5 deletions src/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ export function createRuleTester(config?: Linter.Config) {
}

export function createTsRuleTester(config?: Linter.Config) {
// TSRuleTester is broken
// https://github.com/typescript-eslint/typescript-eslint/issues/9676
// https://github.com/typescript-eslint/typescript-eslint/issues/10191
return new RuleTester({
return new TSRuleTester({
...config,
languageOptions: {
...config?.languageOptions,
Expand All @@ -59,5 +56,5 @@ export function createTsRuleTester(config?: Linter.Config) {
...config?.languageOptions?.parserOptions,
},
},
}) as unknown as TSRuleTester
})
}

0 comments on commit 9ec9233

Please sign in to comment.