mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-06 08:32:51 +08:00
🔧 调整格式化配置
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
import eslint_jsonc from "eslint-plugin-jsonc";
|
||||
import jsonc_parser from "jsonc-eslint-parser";
|
||||
import pluginJsonc from "eslint-plugin-jsonc";
|
||||
import parserJsonc from "jsonc-eslint-parser";
|
||||
|
||||
const pkgJsonConfig = {
|
||||
files: ["package.json"],
|
||||
plugins: {
|
||||
jsonc: eslint_jsonc,
|
||||
},
|
||||
languageOptions: {
|
||||
parser: jsonc_parser,
|
||||
},
|
||||
plugins: { jsonc: pluginJsonc },
|
||||
languageOptions: { parser: parserJsonc },
|
||||
rules: {
|
||||
"jsonc/comma-dangle": ["error", "never"],
|
||||
"jsonc/sort-keys": [
|
||||
@@ -38,12 +34,8 @@ const pkgJsonConfig = {
|
||||
|
||||
const tscJsonConfig = {
|
||||
files: ["tsconfig.json"],
|
||||
plugins: {
|
||||
jsonc: eslint_jsonc,
|
||||
},
|
||||
languageOptions: {
|
||||
parser: jsonc_parser,
|
||||
},
|
||||
plugins: { jsonc: pluginJsonc },
|
||||
languageOptions: { parser: parserJsonc },
|
||||
rules: {
|
||||
"jsonc/comma-dangle": ["error", "never"],
|
||||
"jsonc/sort-keys": [
|
||||
@@ -66,29 +58,12 @@ const tscJsonConfig = {
|
||||
|
||||
const jsoncConfig = {
|
||||
files: ["source/data/out/**/*.json", ".vscode/**/*.json"],
|
||||
plugins: {
|
||||
jsonc: eslint_jsonc,
|
||||
},
|
||||
languageOptions: {
|
||||
parser: jsonc_parser,
|
||||
},
|
||||
plugins: { jsonc: pluginJsonc },
|
||||
languageOptions: { parser: parserJsonc },
|
||||
rules: {
|
||||
"jsonc/comma-dangle": ["error", "never"],
|
||||
"jsonc/sort-keys": [
|
||||
"error",
|
||||
{
|
||||
pathPattern: "^$",
|
||||
order: {
|
||||
type: "asc",
|
||||
},
|
||||
},
|
||||
],
|
||||
"jsonc/sort-keys": ["error", { pathPattern: "^$", order: { type: "asc" } }],
|
||||
},
|
||||
};
|
||||
|
||||
export const jsonEslintConfig = [
|
||||
...eslint_jsonc.configs["flat/recommended-with-json"],
|
||||
pkgJsonConfig,
|
||||
tscJsonConfig,
|
||||
jsoncConfig,
|
||||
];
|
||||
export const jsonEslintConfig = [pkgJsonConfig, tscJsonConfig, jsoncConfig];
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import eslint_js from "@eslint/js";
|
||||
import eslint_import from "eslint-plugin-import";
|
||||
import eslint_prettier from "eslint-plugin-prettier";
|
||||
import eslint_vue from "eslint-plugin-vue";
|
||||
import pluginImport from "eslint-plugin-import";
|
||||
import pluginPrettier from "eslint-plugin-prettier";
|
||||
import pluginVue from "eslint-plugin-vue";
|
||||
import globals from "globals";
|
||||
import eslint_ts from "typescript-eslint";
|
||||
@@ -32,35 +30,20 @@ const tsConfigRules = {
|
||||
};
|
||||
|
||||
const tsConfig = {
|
||||
files: ["*.ts"],
|
||||
plugins: {
|
||||
typescript: eslint_ts,
|
||||
import: eslint_import,
|
||||
prettier: eslint_prettier,
|
||||
},
|
||||
files: ["*.ts", "*.d.ts", "src/**/*.ts", "src/**/*.d.ts"],
|
||||
plugins: { typescript: eslint_ts, import: pluginImport, prettier: pluginPrettier },
|
||||
languageOptions: {
|
||||
parser: eslint_ts.parser,
|
||||
parserOptions: {
|
||||
project: "tsconfig.json",
|
||||
tsconfigRootDir: ".",
|
||||
},
|
||||
parserOptions: { project: "tsconfig.json", tsconfigRootDir: "." },
|
||||
},
|
||||
rules: tsConfigRules,
|
||||
};
|
||||
|
||||
const vueConfig = {
|
||||
plugins: {
|
||||
vue: eslint_vue,
|
||||
import: eslint_import,
|
||||
prettier: eslint_prettier,
|
||||
},
|
||||
files: ["src/**/*.vue"],
|
||||
plugins: { vue: pluginVue, import: pluginImport, prettier: pluginPrettier },
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.es2021,
|
||||
TGApp: "readonly",
|
||||
window: "readonly",
|
||||
},
|
||||
globals: { ...globals.browser, ...globals.es2021, TGApp: "readonly", window: "readonly" },
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
parser: vue_parser,
|
||||
@@ -71,17 +54,7 @@ const vueConfig = {
|
||||
tsconfigRootDir: ".",
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
...tsConfigRules,
|
||||
"vue/multi-word-component-names": "off",
|
||||
},
|
||||
rules: { ...tsConfigRules, "vue/multi-word-component-names": "off" },
|
||||
};
|
||||
|
||||
export const vueEslintConfig = [
|
||||
eslint_js.configs.recommended,
|
||||
...eslint_ts.configs.recommended,
|
||||
...eslint_vue.configs["flat/essential"],
|
||||
...pluginVue.configs["flat/essential"],
|
||||
tsConfig,
|
||||
vueConfig,
|
||||
];
|
||||
export const vueEslintConfig = [tsConfig, vueConfig];
|
||||
|
||||
@@ -1,28 +1,17 @@
|
||||
import eslint_yml from "eslint-plugin-yml";
|
||||
import yml_parser from "yaml-eslint-parser";
|
||||
import pluginYml from "eslint-plugin-yml";
|
||||
import parserYml from "yaml-eslint-parser";
|
||||
|
||||
const ymlEslintConfig = {
|
||||
files: ["**/*.yml", "**/*.yaml"],
|
||||
plugins: {
|
||||
yml: eslint_yml,
|
||||
},
|
||||
plugins: { yml: pluginYml },
|
||||
languageOptions: {
|
||||
parser: yml_parser,
|
||||
parserOptions: {
|
||||
defaultYAMLVersion: "1.2",
|
||||
extraFileExtensions: [".yaml", ".yml"],
|
||||
},
|
||||
parser: parserYml,
|
||||
parserOptions: { defaultYAMLVersion: "1.2", extraFileExtensions: [".yaml", ".yml"] },
|
||||
},
|
||||
rules: {
|
||||
"yml/indent": ["error", 2],
|
||||
"yml/key-spacing": ["error"],
|
||||
"yml/quotes": [
|
||||
"error",
|
||||
{
|
||||
prefer: "double",
|
||||
avoidEscape: true,
|
||||
},
|
||||
],
|
||||
"yml/quotes": ["error", { prefer: "double", avoidEscape: true }],
|
||||
"yml/sort-keys": ["error", "asc"],
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user