mirror of https://github.com/vuejs/core.git
chore(lint): replace deprecated `tseslint.config` and `prefer-ts-expect-error` (#13942)
This commit is contained in:
parent
5689884c8e
commit
8ca2b3fbb7
|
|
@ -1,5 +1,6 @@
|
||||||
import importX from 'eslint-plugin-import-x'
|
import importX from 'eslint-plugin-import-x'
|
||||||
import tseslint from 'typescript-eslint'
|
import tseslint from 'typescript-eslint'
|
||||||
|
import { defineConfig } from 'eslint/config'
|
||||||
import vitest from '@vitest/eslint-plugin'
|
import vitest from '@vitest/eslint-plugin'
|
||||||
import { builtinModules } from 'node:module'
|
import { builtinModules } from 'node:module'
|
||||||
|
|
||||||
|
|
@ -12,7 +13,7 @@ const banConstEnum = {
|
||||||
'Please use non-const enums. This project automatically inlines enums.',
|
'Please use non-const enums. This project automatically inlines enums.',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default tseslint.config(
|
export default defineConfig(
|
||||||
{
|
{
|
||||||
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
|
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
|
||||||
extends: [tseslint.configs.base],
|
extends: [tseslint.configs.base],
|
||||||
|
|
@ -60,7 +61,10 @@ export default tseslint.config(
|
||||||
],
|
],
|
||||||
// This rule enforces the preference for using '@ts-expect-error' comments in TypeScript
|
// This rule enforces the preference for using '@ts-expect-error' comments in TypeScript
|
||||||
// code to indicate intentional type errors, improving code clarity and maintainability.
|
// code to indicate intentional type errors, improving code clarity and maintainability.
|
||||||
'@typescript-eslint/prefer-ts-expect-error': 'error',
|
'@typescript-eslint/ban-ts-comment': [
|
||||||
|
'error',
|
||||||
|
{ minimumDescriptionLength: 0 },
|
||||||
|
],
|
||||||
// Enforce the use of 'import type' for importing types
|
// Enforce the use of 'import type' for importing types
|
||||||
'@typescript-eslint/consistent-type-imports': [
|
'@typescript-eslint/consistent-type-imports': [
|
||||||
'error',
|
'error',
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* eslint-disable @typescript-eslint/prefer-ts-expect-error */
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||||
import type { NativeElements, ReservedProps, VNode } from '@vue/runtime-dom'
|
import type { NativeElements, ReservedProps, VNode } from '@vue/runtime-dom'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* eslint-disable @typescript-eslint/prefer-ts-expect-error */
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||||
// global JSX namespace registration
|
// global JSX namespace registration
|
||||||
// somehow we have to copy=pase the jsx-runtime types here to make TypeScript happy
|
// somehow we have to copy=pase the jsx-runtime types here to make TypeScript happy
|
||||||
import type { NativeElements, ReservedProps, VNode } from '@vue/runtime-dom'
|
import type { NativeElements, ReservedProps, VNode } from '@vue/runtime-dom'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue