Skip to content
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

refactor!: bump typescript-eslint to v8 #112

Merged
merged 37 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8b3ff98
chore/ci: bump Node.js requirement to 18.18
SukkaW Jul 12, 2024
1d45ef5
chore(devDeps): bump typescript eslint to v8
SukkaW Jul 12, 2024
cf1d9b6
refactor: adapt typescript-eslint v8
SukkaW Jul 12, 2024
fe795c4
fix: avoid useless patch
SukkaW Jul 12, 2024
c08d150
ci: test against ESLint v9
SukkaW Jul 12, 2024
467363c
test: FlatRuleTester for both ESLint 8 & 9
SukkaW Jul 12, 2024
4889d3f
chore: housekeeping for ts-eslint 8
SukkaW Aug 2, 2024
980ec75
test: migrate rule tester runner config
SukkaW Aug 2, 2024
c5bf9f6
test: migrate new test cases config
SukkaW Aug 2, 2024
ff5263a
test: migrate new test cases config
SukkaW Aug 2, 2024
dc5d7f4
test: migrate new test cases config
SukkaW Aug 2, 2024
1216dd7
test: migrate new test cases
SukkaW Aug 7, 2024
42ff768
test: migrate new test cases
SukkaW Aug 7, 2024
d45e264
test: migrate new test cases
SukkaW Aug 7, 2024
e12af09
test: fix ts parser not recognizing export identifier
SukkaW Aug 7, 2024
d74394d
test: typescript eslint parser doesn't support export identifier
SukkaW Aug 7, 2024
7d2f452
test: fix cases
SukkaW Aug 7, 2024
29462c0
test: fix another 12 test cases
SukkaW Aug 7, 2024
f40ab8e
test: fix another 3 test cases
SukkaW Aug 7, 2024
ed1d953
test: fix cases
SukkaW Aug 7, 2024
3ef285a
test: fix another 1 case
SukkaW Aug 7, 2024
fc97ca6
chore: bump a few deps
SukkaW Aug 7, 2024
29491d0
chore: make eslint happy
SukkaW Aug 7, 2024
f77b4c2
Fix 88 tests
merrywhether Aug 14, 2024
945e8f8
test(extensions): update test group name
SukkaW Aug 14, 2024
a78a9a3
merge(#3): merrywhether/help-fix-some-tests
SukkaW Aug 14, 2024
152d3e9
test: fix no-absolute-path (#4)
merrywhether Aug 14, 2024
e523937
test: fix another error
SukkaW Aug 14, 2024
4fef125
chore: housekeeping
SukkaW Aug 14, 2024
49edefe
test: fix 4 tests
SukkaW Aug 14, 2024
c98e823
test: fix flow tests
SukkaW Aug 14, 2024
b534ddf
test: add hermes-eslint support
SukkaW Aug 14, 2024
8cc48a4
test: remove 2 meaningless tests
SukkaW Aug 14, 2024
5d4d2e2
test: use legacy eslint for eslintrc test
SukkaW Aug 14, 2024
098d6b7
chore: make lint happy
SukkaW Aug 14, 2024
04c58ed
chore: update eslint and node version
SukkaW Aug 14, 2024
f25124f
chore: add changeset
SukkaW Aug 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
},
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-require-imports': 'off',

'eslint-plugin/consistent-output': ['error', 'always'],
'eslint-plugin/meta-property-ordering': 'error',
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ jobs:
- ubuntu-latest
# - windows-latest
node:
- 16
- 18
- 20
- 22
eslint:
- '8.56'
- '8'
- '9'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
Expand Down
19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"packageManager": "[email protected]",
"engines": {
"node": ">=16"
"node": ">=18.18"
},
"main": "lib/index.js",
"exports": {
Expand Down Expand Up @@ -35,7 +35,7 @@
"codesandbox:install": "yarn --ignore-engines",
"lint": "run-p lint:*",
"lint:docs": "yarn update:eslint-docs --check",
"lint:es": "eslint . --cache",
"lint:es": "ESLINT_USE_FLAT_CONFIG=false eslint . --cache",
"lint:tsc": "tsc -p tsconfig.base.json --noEmit",
"prepare": "patch-package",
"release": "changeset publish",
Expand All @@ -48,7 +48,7 @@
"eslint": "^8.56.0 || ^9.0.0-0"
},
"dependencies": {
"@typescript-eslint/utils": "^7.4.0",
"@typescript-eslint/utils": "^8.0.0",
"debug": "^4.3.4",
"doctrine": "^3.0.0",
"eslint-import-resolver-node": "^0.3.9",
Expand Down Expand Up @@ -82,18 +82,23 @@
"@total-typescript/ts-reset": "^0.5.1",
"@types/debug": "^4.1.12",
"@types/doctrine": "^0.0.9",
"@types/eslint": "^8.56.6",
"@types/eslint": "^9.6.0",
"@types/eslint8.56": "npm:@types/eslint@^8.56.6",
"@types/eslint9": "npm:@types/eslint@^9.6.0",
"@types/is-glob": "^4.0.4",
"@types/jest": "^29.5.12",
"@types/json-schema": "^7.0.15",
"@types/node": "^20.11.30",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@typescript-eslint/rule-tester": "^8.0.0",
"@unts/patch-package": "^8.0.0",
"cross-env": "^7.0.3",
"enhanced-resolve": "^5.16.0",
"escope": "^4.0.0",
"eslint": "^7.2.0 || ^8",
"eslint": "^9.8.0",
"eslint8.56": "npm:eslint@^8.56.0",
"eslint9": "npm:eslint@^9.8.0",
"eslint-config-prettier": "^9.1.0",
"eslint-doc-generator": "^1.7.0",
"eslint-import-resolver-typescript": "^3.6.1",
Expand Down
37 changes: 0 additions & 37 deletions patches/@typescript-eslint+utils+7.4.0.patch

This file was deleted.

2 changes: 1 addition & 1 deletion src/rules/dynamic-import-chunkname.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import vm from 'node:vm'

import type { TSESTree } from '@typescript-eslint/utils'
import type { RuleFixer } from '@typescript-eslint/utils/dist/ts-eslint'
import type { RuleFixer } from '@typescript-eslint/utils/ts-eslint'

import { createRule } from '../utils'

Expand Down
8 changes: 1 addition & 7 deletions src/rules/imports-first.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { ESLintUtils } from '@typescript-eslint/utils'

import { docsUrl } from '../utils/docs-url'
import { createRule } from '../utils'

import first from './first'

const createRule = ESLintUtils.RuleCreator(ruleName =>
docsUrl(ruleName, '7b25c1cb95ee18acc1531002fd343e1e6031f9ed'),
)

export = createRule({
...first,
name: 'imports-first',
Expand Down
16 changes: 10 additions & 6 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { TSESLint, TSESTree } from '@typescript-eslint/utils'
import type { ResolveOptions } from 'enhanced-resolve'
import type { TsResolverOptions } from 'eslint-import-resolver-typescript'
import type { MinimatchOptions } from 'minimatch'
import type { KebabCase, LiteralUnion } from 'type-fest'

Expand All @@ -21,6 +20,12 @@ export type WebpackResolverOptions = {
argv?: Record<string, unknown>
}

export type TsResolverOptions = {
alwaysTryTypes?: boolean
project?: string[] | string
extensions?: string[]
} & Omit<ResolveOptions, 'fileSystem' | 'useSyncFileSystemCalls'>

export type FileExtension = `.${string}`

export type DocStyle = 'jsdoc' | 'tomdoc'
Expand Down Expand Up @@ -89,11 +94,10 @@ export type ParseError = {
column: number
} & Error

// eslint-disable-next-line @typescript-eslint/ban-types
export type CustomESTreeNode<Type extends string, T extends object = {}> = Omit<
TSESTree.BaseNode,
'type'
> & {
export type CustomESTreeNode<
Type extends string,
T extends object = object,
> = Omit<TSESTree.BaseNode, 'type'> & {
type: Type
} & T

Expand Down
11 changes: 10 additions & 1 deletion src/utils/create-rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@ import { ESLintUtils } from '@typescript-eslint/utils'

import { docsUrl } from './docs-url'

export const createRule = ESLintUtils.RuleCreator(docsUrl)
type ImportXPluginDocs = {
/**
* The category the rule falls under
*/
category?: string

recommended?: true
}

export const createRule = ESLintUtils.RuleCreator<ImportXPluginDocs>(docsUrl)
File renamed without changes.
2 changes: 2 additions & 0 deletions test/fixtures/deep/cache-2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as c from './c'
export { c }
26 changes: 15 additions & 11 deletions test/rules/consistent-type-specifier-style.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TSESLint, TSESTree } from '@typescript-eslint/utils'
import { RuleTester as TSESLintRuleTester } from '@typescript-eslint/rule-tester'
import { TSESTree } from '@typescript-eslint/utils'

import { parsers, test } from '../utils'

Expand Down Expand Up @@ -445,11 +446,12 @@ const FLOW_ONLY = {
} as const

describe('TypeScript', () => {
const ruleTester = new TSESLint.RuleTester({
parser: parsers.TS,
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
const ruleTester = new TSESLintRuleTester({
languageOptions: {
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
},
},
})
ruleTester.run('consistent-type-specifier-style', rule, {
Expand All @@ -459,11 +461,13 @@ describe('TypeScript', () => {
})

describe('Babel/Flow', () => {
const ruleTester = new TSESLint.RuleTester({
parser: parsers.BABEL,
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
const ruleTester = new TSESLintRuleTester({
languageOptions: {
parser: require(parsers.BABEL),
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
},
},
})
ruleTester.run('consistent-type-specifier-style', rule, {
Expand Down
Loading
Loading