保存进度!

This commit is contained in:
2026-02-04 11:45:47 +08:00
parent 9f2bc65a0e
commit 3382fe7b3f
4 changed files with 162 additions and 113 deletions

View File

@@ -2,94 +2,20 @@ import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";
// import json from "@eslint/json";
import css from "@eslint/css";
import { defineConfig } from "eslint/config";
import stylistic from "@stylistic/eslint-plugin";
export default defineConfig([
{
files: [
"src/**/*.{js,mjs,cjs,ts,mts,cts,vue}",
"eslint.config.ts",
],
plugins: {
js,
"@stylistic": stylistic,
},
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts}",],
plugins: { js, },
extends: ["js/recommended",],
languageOptions: {
languageOptions: {
globals: {
...globals.browser,
...globals.node, },
},
rules: {
"no-trailing-spaces": ["error", {"ignoreComments": true,},],
"space-in-parens": ["error", "always", { exceptions: ["{}", "[]", "()", "empty",], },],
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-unused-vars": "warn",
"semi-spacing": ["error", {"before": false,
"after": true,},], // 控制行尾部分号
"quotes": ["error", "double",],
"comma-dangle": ["error", {
arrays: "always",
objects: "always",
imports: "never",
exports: "never",
functions: "never",
},], // 数组和对象键值对最后一个逗号
"comma-style": ["error", "last",], // 逗号在行位
"no-undef-init": "error",
"no-invalid-this": "error",
"no-use-before-define": "error",
"no-shadow-restricted-names": "error", // 禁止对一些关键字或者保留字进行赋值操作比如NaN、Infinity、undefined、eval、arguments等
"brace-style": ["error", "allman", { allowSingleLine: true, },],
"prefer-const": "warn",
"space-before-function-paren": ["error", {
anonymous: "always",
named: "never",
asyncArrow: "always",
},],
"array-bracket-spacing": ["error", "never", {
singleValue: false,
objectsInArrays: false,
arraysInArrays: false,
},],
"comma-spacing": ["error", {
before: false,
after: true, },],
"@stylistic/quotes": ["error", "double",],
},
...globals.node,}, },
},
tseslint.configs.recommended,
pluginVue.configs["flat/essential"],
{
files: ["src/**/*.vue",],
languageOptions: {
parserOptions: {
parser: tseslint.parser,
},
},
rules: {
"vue/html-indent": ["error", 4,],
"vue/max-attributes-per-line": ["error", {
"singleline": {
"max": 3,
},
"multiline": {
"max": 2,
},
},],
},
},
{
files: ["**/*.css",],
plugins: { css, },
language: "css/css",
extends: ["css/recommended",],
},
{
files: ["src/**/*.ts", "eslint.config.ts",],
plugins: {
@@ -129,22 +55,7 @@ export default defineConfig([
"@stylistic/object-property-newline": "warn",
},
},
// {
// files: ["**/*.json"],
// plugins: { json },
// language: "json/json",
// extends: ["json/recommended"],
// },
// {
// files: ["**/*.jsonc"],
// plugins: { json },
// language: "json/jsonc",
// extends: ["json/recommended"],
// },
// {
// files: ["**/*.json5"],
// plugins: { json },
// language: "json/json5",
// extends: ["json/recommended"],
// },
pluginVue.configs["flat/essential"],
{ files: ["**/*.vue",],
languageOptions: { parserOptions: { parser: tseslint.parser, }, }, },
]);