66 lines
1.4 KiB
JavaScript
66 lines
1.4 KiB
JavaScript
// @ts-check
|
||
import tsParser from '@typescript-eslint/parser'
|
||
import simpleImportSort from 'eslint-plugin-simple-import-sort'
|
||
import vueParser from 'vue-eslint-parser'
|
||
|
||
import withNuxt from './.nuxt/eslint.config.mjs'
|
||
|
||
export default withNuxt(
|
||
{
|
||
ignores: [
|
||
'**/app/components/ui/**',
|
||
],
|
||
},
|
||
// .ts/.tsx 文件直接使用 TypeScript parser
|
||
{
|
||
files: ['**/*.ts', '**/*.tsx'],
|
||
languageOptions: {
|
||
parser: tsParser,
|
||
parserOptions: {
|
||
ecmaVersion: 'latest',
|
||
sourceType: 'module',
|
||
},
|
||
},
|
||
},
|
||
|
||
// .vue 文件:顶层用 vue-eslint-parser,<script> 块内用 ts parser
|
||
{
|
||
files: ['**/*.vue'],
|
||
languageOptions: {
|
||
parser: vueParser,
|
||
parserOptions: {
|
||
parser: tsParser,
|
||
ecmaVersion: 'latest',
|
||
sourceType: 'module',
|
||
},
|
||
},
|
||
},
|
||
|
||
// import 自动排序
|
||
{
|
||
plugins: {
|
||
'simple-import-sort': simpleImportSort,
|
||
},
|
||
rules: {
|
||
'simple-import-sort/imports': 'error',
|
||
'simple-import-sort/exports': 'error',
|
||
},
|
||
},
|
||
|
||
{
|
||
files: ['**/type.ts', '**/types.ts', '**/*.d.ts'],
|
||
rules: {
|
||
'no-unused-vars': 'off',
|
||
},
|
||
},
|
||
|
||
{
|
||
rules: {
|
||
'@typescript-eslint/no-explicit-any': 'off',
|
||
'vue/html-self-closing': ['error', { html: { void: 'any' } }],
|
||
'no-unused-vars': 'warn',
|
||
'@typescript-eslint/no-unused-vars': 'warn',
|
||
"@typescript-eslint/no-extraneous-class": "off",
|
||
},
|
||
},
|
||
) |