Files
regulatory-management-system/code/web/regulatory-management-util/eslint.config.ts

62 lines
2.4 KiB
TypeScript
Raw Normal View History

2026-02-03 19:25:24 +08:00
import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";
import { defineConfig } from "eslint/config";
import stylistic from "@stylistic/eslint-plugin";
export default defineConfig([
2026-02-04 11:45:47 +08:00
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts}",],
plugins: { js, },
2026-02-03 19:25:24 +08:00
extends: ["js/recommended",],
2026-02-04 11:45:47 +08:00
languageOptions: {
2026-02-03 19:25:24 +08:00
globals: {
...globals.browser,
2026-02-04 11:45:47 +08:00
...globals.node,}, },
2026-02-03 19:25:24 +08:00
},
tseslint.configs.recommended,
{
files: ["src/**/*.ts", "eslint.config.ts",],
plugins: {
"@stylistic": stylistic,
},
rules: {
"spaced-comment": "error",
"space-before-function-paren": "off",
"semi-spacing": ["error", {"before": false,
"after": true,},],
"@typescript-eslint/no-unused-vars": "warn",
"@stylistic/indent": ["error", 4, { SwitchCase: 1, },],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/member-delimiter-style": "off",
"@stylistic/semi": ["error", "always",], // 控制行尾部分号
"@stylistic/brace-style": ["error", "allman", { allowSingleLine: true, },],
"@stylistic/comma-dangle": [
"error",
{
arrays: "always",
objects: "always",
imports: "never",
exports: "never",
functions: "never",
},
], // 数组和对象键值对最后一个逗号
"@stylistic/quotes": ["error", "double",],
"@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/comma-spacing": ["off", { before: false,
after: true, },], // 使用eslint的不用ts的
// "@typescript-eslint/strict-boolean-expressions": ["error", {
// allowString: false,
// },],
"@stylistic/object-property-newline": "warn",
},
},
2026-02-04 11:45:47 +08:00
pluginVue.configs["flat/essential"],
{ files: ["**/*.vue",],
languageOptions: { parserOptions: { parser: tseslint.parser, }, }, },
2026-02-03 19:25:24 +08:00
]);