feat: 更新 ESLint 配置,支持更多语言,调整 npm 镜像源
This commit is contained in:
1
.npmrc
1
.npmrc
@ -7,6 +7,7 @@ registry=https://nexus.oo1.dev/repository/npm/
|
|||||||
# https://pnpm.io/zh/npmrc#node-mirrorltreleasedir
|
# https://pnpm.io/zh/npmrc#node-mirrorltreleasedir
|
||||||
use-node-version=22.13.0
|
use-node-version=22.13.0
|
||||||
node-mirror:release=https://npmmirror.com/mirrors/node/ # pnpm config set node-mirror:release=https://npmmirror.com/mirrors/node/
|
node-mirror:release=https://npmmirror.com/mirrors/node/ # pnpm config set node-mirror:release=https://npmmirror.com/mirrors/node/
|
||||||
|
node-mirror:release=https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/
|
||||||
node-mirror:rc=https://npmmirror.com/mirrors/node-rc/
|
node-mirror:rc=https://npmmirror.com/mirrors/node-rc/
|
||||||
node-mirror:nightly=https://npmmirror.com/mirrors/node-nightly/
|
node-mirror:nightly=https://npmmirror.com/mirrors/node-nightly/
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { includeIgnoreFile } from '@eslint/compat';
|
import { includeIgnoreFile } from '@eslint/compat';
|
||||||
import pluginVitest from '@vitest/eslint-plugin';
|
import pluginVitest from '@vitest/eslint-plugin';
|
||||||
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
|
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
|
||||||
import vueTsEslintConfig from '@vue/eslint-config-typescript';
|
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
|
||||||
import oxlint from 'eslint-plugin-oxlint';
|
import oxlint from 'eslint-plugin-oxlint';
|
||||||
import perfectionist from 'eslint-plugin-perfectionist';
|
import perfectionist from 'eslint-plugin-perfectionist';
|
||||||
import pluginVue from 'eslint-plugin-vue';
|
import pluginVue from 'eslint-plugin-vue';
|
||||||
@ -12,10 +12,12 @@ const __filename = fileURLToPath(import.meta.url);
|
|||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
const gitignorePath = path.resolve(__dirname, '.gitignore');
|
const gitignorePath = path.resolve(__dirname, '.gitignore');
|
||||||
|
|
||||||
/**
|
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
|
||||||
* @type import('eslint').Linter.Config[]
|
import { configureVueProject } from '@vue/eslint-config-typescript';
|
||||||
*/
|
configureVueProject({ scriptLangs: ['ts', 'tsx', 'js', 'jsx'] });
|
||||||
export default [
|
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
|
||||||
|
|
||||||
|
export default defineConfigWithVueTs(
|
||||||
includeIgnoreFile(gitignorePath), // oxlint . --fix -D correctness --ignore-path .gitignore
|
includeIgnoreFile(gitignorePath), // oxlint . --fix -D correctness --ignore-path .gitignore
|
||||||
{
|
{
|
||||||
name: 'app/files-to-lint',
|
name: 'app/files-to-lint',
|
||||||
@ -27,14 +29,18 @@ export default [
|
|||||||
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
|
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
|
||||||
},
|
},
|
||||||
|
|
||||||
...pluginVue.configs['flat/essential'],
|
pluginVue.configs['flat/essential'],
|
||||||
...vueTsEslintConfig({ supportedScriptLangs: { ts: true, tsx: true, js: true, jsx: true } }),
|
vueTsConfigs.recommended,
|
||||||
|
|
||||||
{
|
{
|
||||||
...pluginVitest.configs.recommended,
|
...pluginVitest.configs.recommended,
|
||||||
files: ['src/**/__tests__/*'],
|
files: ['src/**/__tests__/*'],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// {
|
||||||
|
// ...pluginCypress.configs.recommended,
|
||||||
|
// files: ['cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}', 'cypress/support/**/*.{js,ts,jsx,tsx}'],
|
||||||
|
// },
|
||||||
oxlint.configs['flat/recommended'],
|
oxlint.configs['flat/recommended'],
|
||||||
skipFormatting,
|
skipFormatting,
|
||||||
|
|
||||||
@ -62,4 +68,4 @@ export default [
|
|||||||
'perfectionist/sort-imports': ['error'],
|
'perfectionist/sort-imports': ['error'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
);
|
@ -6,6 +6,7 @@
|
|||||||
"cypress.config.*",
|
"cypress.config.*",
|
||||||
"nightwatch.conf.*",
|
"nightwatch.conf.*",
|
||||||
"playwright.config.*",
|
"playwright.config.*",
|
||||||
|
"eslint.config.*",
|
||||||
"fake/**/*"
|
"fake/**/*"
|
||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
Reference in New Issue
Block a user