Skip to content

Commit

Permalink
test: add SYNTAX_VALID_CASES casting
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalexiei committed Nov 20, 2024
1 parent 71e410b commit 9a4ee87
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions test/rules/dynamic-import-chunkname.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { RuleTester as TSESLintRuleTester } from '@typescript-eslint/rule-tester
import { AST_NODE_TYPES } from '@typescript-eslint/utils'

import { SYNTAX_VALID_CASES, parsers } from '../utils'
import type { GetRuleModuleOptions } from '../utils'
import type { GetRuleModuleOptions, RuleRunTests } from '../utils'

import rule from 'eslint-plugin-import-x/rules/dynamic-import-chunkname'

Expand Down Expand Up @@ -428,7 +428,7 @@ ruleTester.run('dynamic-import-chunkname', rule, {
options,
languageOptions: { parser: babelParser },
},
...SYNTAX_VALID_CASES,
...(SYNTAX_VALID_CASES as RuleRunTests<typeof rule>['valid']),
],

invalid: [
Expand Down
3 changes: 2 additions & 1 deletion test/rules/export.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
parsers,
createRuleTestCaseFunctions,
} from '../utils'
import type { RuleRunTests } from '../utils'

import rule from 'eslint-plugin-import-x/rules/export'

Expand Down Expand Up @@ -34,7 +35,7 @@ ruleTester.run('export', rule, {
// #328: "export * from" does not export a default
tValid({ code: 'export default foo; export * from "./bar"' }),

...SYNTAX_VALID_CASES,
...(SYNTAX_VALID_CASES as RuleRunTests<typeof rule>['valid']),

tValid({
code: `
Expand Down
2 changes: 1 addition & 1 deletion test/rules/named.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ ruleTester.run('named', rule, {
options: [{ commonjs: true }],
}),

...SYNTAX_VALID_CASES,
...(SYNTAX_VALID_CASES as RuleRunTests<typeof rule>['valid']),

tValid({
code: `import { ExtfieldModel, Extfield2Model } from './models';`,
Expand Down
4 changes: 2 additions & 2 deletions test/rules/no-deprecated.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SYNTAX_VALID_CASES,
parsers,
} from '../utils'
import type { GetRuleModuleMessageIds } from '../utils'
import type { GetRuleModuleMessageIds, RuleRunTests } from '../utils'

import rule from 'eslint-plugin-import-x/rules/no-deprecated'

Expand Down Expand Up @@ -63,7 +63,7 @@ ruleTester.run('no-deprecated', rule, {
code: "import { deepDep } from './deep-deprecated'; function x(deepDep) { console.log(deepDep.MY_TERRIBLE_ACTION) }",
}),

...SYNTAX_VALID_CASES,
...(SYNTAX_VALID_CASES as RuleRunTests<typeof rule>['valid']),
],
invalid: [
// reports on parse errors even without specifiers
Expand Down
4 changes: 2 additions & 2 deletions test/rules/no-named-as-default-member.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SYNTAX_VALID_CASES,
parsers,
} from '../utils'
import type { GetRuleModuleMessageIds } from '../utils'
import type { GetRuleModuleMessageIds, RuleRunTests } from '../utils'

import rule from 'eslint-plugin-import-x/rules/no-named-as-default-member'

Expand Down Expand Up @@ -41,7 +41,7 @@ ruleTester.run('no-named-as-default-member', rule, {
},
}),

...SYNTAX_VALID_CASES,
...(SYNTAX_VALID_CASES as RuleRunTests<typeof rule>['valid']),
],

invalid: [
Expand Down
4 changes: 2 additions & 2 deletions test/rules/no-named-as-default.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SYNTAX_VALID_CASES,
parsers,
} from '../utils'
import type { GetRuleModuleMessageIds } from '../utils'
import type { GetRuleModuleMessageIds, RuleRunTests } from '../utils'

import rule from 'eslint-plugin-import-x/rules/no-named-as-default'

Expand Down Expand Up @@ -99,7 +99,7 @@ ruleTester.run('no-named-as-default', rule, {
},
}),

...SYNTAX_VALID_CASES,
...(SYNTAX_VALID_CASES as RuleRunTests<typeof rule>['valid']),
],

invalid: [
Expand Down
3 changes: 2 additions & 1 deletion test/rules/no-named-default.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
SYNTAX_VALID_CASES,
parsers,
} from '../utils'
import type { RuleRunTests } from '../utils'

import rule from 'eslint-plugin-import-x/rules/no-named-default'

Expand All @@ -28,7 +29,7 @@ ruleTester.run('no-named-default', rule, {
languageOptions: { parser: require(parsers.BABEL) },
}),

...SYNTAX_VALID_CASES,
...(SYNTAX_VALID_CASES as RuleRunTests<typeof rule>['valid']),
],

invalid: [
Expand Down
4 changes: 2 additions & 2 deletions test/rules/no-unresolved.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
parsers,
testFilePath,
} from '../utils'
import type { GetRuleModuleMessageIds } from '../utils'
import type { GetRuleModuleMessageIds, RuleRunTests } from '../utils'

import rule from 'eslint-plugin-import-x/rules/no-unresolved'
import { CASE_SENSITIVE_FS } from 'eslint-plugin-import-x/utils'
Expand Down Expand Up @@ -470,7 +470,7 @@ ruleTester.run('no-unresolved electron', rule, {
})

ruleTester.run('no-unresolved syntax verification', rule, {
valid: SYNTAX_VALID_CASES,
valid: SYNTAX_VALID_CASES as RuleRunTests<typeof rule>['valid'],
invalid: [],
})

Expand Down

0 comments on commit 9a4ee87

Please sign in to comment.