update 升级部分依赖,优化eslint语法以及scss语法
parent
cc38d23d14
commit
aef5a02097
@ -1,86 +0,0 @@
|
|||||||
import globals from 'globals';
|
|
||||||
import pluginJs from '@eslint/js';
|
|
||||||
import tseslint from 'typescript-eslint';
|
|
||||||
import pluginVue from 'eslint-plugin-vue';
|
|
||||||
import { readFile } from 'node:fs/promises';
|
|
||||||
import prettier from 'eslint-plugin-prettier';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* https://blog.csdn.net/sayUonly/article/details/123482912
|
|
||||||
* 自动导入的配置
|
|
||||||
*/
|
|
||||||
const autoImportFile = new URL('./.eslintrc-auto-import.json', import.meta.url);
|
|
||||||
const autoImportGlobals = JSON.parse(await readFile(autoImportFile, 'utf8'));
|
|
||||||
|
|
||||||
/** @type {import('eslint').Linter.Config[]} */
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 不需要.eslintignore文件 而是在这里配置
|
|
||||||
*/
|
|
||||||
ignores: [
|
|
||||||
'*.sh',
|
|
||||||
'node_modules',
|
|
||||||
'*.md',
|
|
||||||
'*.woff',
|
|
||||||
'*.ttf',
|
|
||||||
'.vscode',
|
|
||||||
'.idea',
|
|
||||||
'dist',
|
|
||||||
'/public',
|
|
||||||
'/docs',
|
|
||||||
'.husky',
|
|
||||||
'.local',
|
|
||||||
'/bin',
|
|
||||||
'.eslintrc.cjs',
|
|
||||||
'prettier.config.js',
|
|
||||||
'src/assets',
|
|
||||||
'tailwind.config.js'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{ files: ['**/*.{js,mjs,cjs,ts,vue}'] },
|
|
||||||
{
|
|
||||||
languageOptions: {
|
|
||||||
globals: globals.browser
|
|
||||||
}
|
|
||||||
},
|
|
||||||
pluginJs.configs.recommended,
|
|
||||||
...tseslint.configs.recommended,
|
|
||||||
...pluginVue.configs['flat/essential'],
|
|
||||||
{
|
|
||||||
files: ['**/*.vue'],
|
|
||||||
languageOptions: {
|
|
||||||
parserOptions: {
|
|
||||||
parser: tseslint.parser
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
languageOptions: {
|
|
||||||
globals: {
|
|
||||||
// 自动导入的配置 undef
|
|
||||||
...autoImportGlobals.globals,
|
|
||||||
DialogOption: 'readonly',
|
|
||||||
LayoutSetting: 'readonly'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: { prettier },
|
|
||||||
rules: {
|
|
||||||
'@typescript-eslint/no-empty-function': 'off',
|
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
|
||||||
'@typescript-eslint/no-unused-vars': 'off',
|
|
||||||
'@typescript-eslint/no-this-alias': 'off',
|
|
||||||
|
|
||||||
// vue
|
|
||||||
'vue/multi-word-component-names': 'off',
|
|
||||||
'vue/valid-define-props': 'off',
|
|
||||||
'vue/no-v-model-argument': 'off',
|
|
||||||
'prefer-rest-params': 'off',
|
|
||||||
// prettier
|
|
||||||
'prettier/prettier': 'error',
|
|
||||||
// 允许使用空Object类型 {}
|
|
||||||
'@typescript-eslint/no-empty-object-type': 'off',
|
|
||||||
'@typescript-eslint/no-unused-expressions': 'off'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
import pluginVue from 'eslint-plugin-vue';
|
||||||
|
import globals from 'globals';
|
||||||
|
import prettier from 'eslint-plugin-prettier';
|
||||||
|
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
|
||||||
|
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
|
||||||
|
|
||||||
|
export default defineConfigWithVueTs(
|
||||||
|
{
|
||||||
|
name: 'app/files-to-lint',
|
||||||
|
files: ['**/*.{js,cjs,ts,mts,tsx,vue}']
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'app/files-to-ignore',
|
||||||
|
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: globals.browser
|
||||||
|
}
|
||||||
|
},
|
||||||
|
pluginVue.configs['flat/essential'],
|
||||||
|
vueTsConfigs.recommended,
|
||||||
|
skipFormatting,
|
||||||
|
{
|
||||||
|
plugins: { prettier },
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-empty-function': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
|
'@typescript-eslint/no-this-alias': 'off',
|
||||||
|
// vue
|
||||||
|
'vue/multi-word-component-names': 'off',
|
||||||
|
'vue/valid-define-props': 'off',
|
||||||
|
'vue/no-v-model-argument': 'off',
|
||||||
|
'prefer-rest-params': 'off',
|
||||||
|
// prettier
|
||||||
|
'prettier/prettier': 'error',
|
||||||
|
// 允许使用空Object类型 {}
|
||||||
|
'@typescript-eslint/no-empty-object-type': 'off',
|
||||||
|
'@typescript-eslint/no-unused-expressions': 'off'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
Loading…
Reference in New Issue