80 lines
1.8 KiB
JavaScript
80 lines
1.8 KiB
JavaScript
import tsParser from "@typescript-eslint/parser";
|
|
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
|
import vuePlugin from "eslint-plugin-vue";
|
|
import vueParser from "vue-eslint-parser";
|
|
import autoImportConfig from "./.eslintrc-auto-import.json" with { type: "json" };
|
|
|
|
const browserGlobals = {
|
|
document: "readonly",
|
|
File: "readonly",
|
|
HTMLCanvasElement: "readonly",
|
|
HTMLInputElement: "readonly",
|
|
HTMLElement: "readonly",
|
|
localStorage: "readonly",
|
|
MouseEvent: "readonly",
|
|
Touch: "readonly",
|
|
TouchEvent: "readonly",
|
|
URL: "readonly",
|
|
window: "readonly"
|
|
};
|
|
|
|
const nodeGlobals = {
|
|
console: "readonly",
|
|
process: "readonly"
|
|
};
|
|
|
|
export default [
|
|
{
|
|
ignores: [
|
|
"dist/**",
|
|
"node_modules/**",
|
|
"auto-imports.d.ts",
|
|
"components.d.ts"
|
|
]
|
|
},
|
|
...vuePlugin.configs["flat/essential"],
|
|
{
|
|
files: ["**/*.ts", "**/*.vue"],
|
|
languageOptions: {
|
|
parser: vueParser,
|
|
parserOptions: {
|
|
parser: tsParser,
|
|
ecmaVersion: "latest",
|
|
sourceType: "module",
|
|
extraFileExtensions: [".vue"]
|
|
},
|
|
globals: {
|
|
...browserGlobals,
|
|
...nodeGlobals,
|
|
...autoImportConfig.globals
|
|
}
|
|
},
|
|
plugins: {
|
|
"@typescript-eslint": tsPlugin
|
|
},
|
|
rules: {
|
|
...tsPlugin.configs.recommended.rules,
|
|
camelcase: "error",
|
|
"comma-dangle": ["error", "never"],
|
|
eqeqeq: ["error", "always"],
|
|
"max-len": ["error", { code: 220 }],
|
|
"no-console": ["warn", { allow: ["warn", "error"] }],
|
|
"no-debugger": "warn",
|
|
"no-tabs": ["error", { allowIndentationTabs: true }],
|
|
quotes: ["error", "double"],
|
|
semi: ["error", "always"],
|
|
"space-before-function-paren": [
|
|
"error",
|
|
{
|
|
anonymous: "always",
|
|
named: "never",
|
|
asyncArrow: "always"
|
|
}
|
|
],
|
|
"vue/multi-word-component-names": "off",
|
|
"vue/no-v-html": "off",
|
|
"@typescript-eslint/no-explicit-any": "off"
|
|
}
|
|
}
|
|
];
|