-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upgrade to
@typescript-eslint
v8 (#7)
- Loading branch information
Showing
17 changed files
with
663 additions
and
770 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/rules/__snapshots__/no-array-push.project-service-custom.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`no-array-push > invalid > const foo = [1, 2, 3]; foo.push(4) 1`] = `"const foo = [1, 2, 3]; foo.push(4)"`; |
3 changes: 3 additions & 0 deletions
3
test/rules/__snapshots__/no-array-push.project-service.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`no-array-push > invalid > const foo = [1, 2, 3]; foo.push(4) 1`] = `"const foo = [1, 2, 3]; foo.push(4)"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`no-array-push > invalid > const foo = [1, 2, 3]; foo.push(4) 1`] = `"const foo = [1, 2, 3]; foo.push(4)"`; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { expect } from 'vitest' | ||
import type { RuleTesterInitOptions, TestCasesOptions } from '../../src' | ||
import rule, { RULE_NAME } from './no-array-push' | ||
|
||
const valids = [ | ||
'const foo = [1, 2, 3]; foo.pop()', | ||
'const foo = { push: () => {} }; foo.push()', | ||
] | ||
|
||
const invalids = [ | ||
'const foo = [1, 2, 3]; foo.push(4)', | ||
] | ||
|
||
export const common = { | ||
name: RULE_NAME, | ||
rule: rule as any, | ||
|
||
valid: valids, | ||
invalid: invalids.map(i => ({ | ||
code: i, | ||
errors: [{ messageId: 'noArrayPush' }], | ||
})), | ||
|
||
onResult(_case, result) { | ||
if (_case.type === 'invalid') | ||
expect(result.output).toMatchSnapshot() | ||
}, | ||
} satisfies TestCasesOptions & RuleTesterInitOptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import path from 'node:path' | ||
import tsParser from '@typescript-eslint/parser' | ||
import { run } from '../../src' | ||
import { common } from './no-array-push.cases' | ||
|
||
// Using `projectService` - custom fixture. | ||
run({ | ||
...common, | ||
languageOptions: { | ||
parser: tsParser, | ||
parserOptions: { | ||
tsconfigRootDir: path.join(import.meta.dirname, './ts-fixture'), | ||
projectService: { | ||
// Ensure we're not using the default project | ||
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 0, | ||
}, | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import tsParser from '@typescript-eslint/parser' | ||
import { run } from '../../src' | ||
import { common } from './no-array-push.cases' | ||
|
||
// Using `projectService` - default project. | ||
run({ | ||
...common, | ||
languageOptions: { | ||
parser: tsParser, | ||
parserOptions: { | ||
projectService: { | ||
allowDefaultProject: ['*.ts'], | ||
}, | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import path from 'node:path' | ||
import tsParser from '@typescript-eslint/parser' | ||
import { run } from '../../src' | ||
import { common } from './no-array-push.cases' | ||
|
||
// Using `project` - custom fixture. | ||
run({ | ||
...common, | ||
languageOptions: { | ||
parser: tsParser, | ||
parserOptions: { | ||
tsconfigRootDir: path.join(import.meta.dirname, './ts-fixture'), | ||
project: true, | ||
}, | ||
}, | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters