|
@@ -0,0 +1,73 @@
|
|
|
+/**
|
|
|
+ * @type {import("eslint").Linter.Config}
|
|
|
+ */
|
|
|
+module.exports = {
|
|
|
+ root: true,
|
|
|
+ env: {
|
|
|
+ node: true,
|
|
|
+ browser: true,
|
|
|
+ "vue/setup-compiler-macros": true,
|
|
|
+ },
|
|
|
+ parser: "@typescript-eslint/parser",
|
|
|
+ parserOptions: {
|
|
|
+ ecmaVersion: "2021",
|
|
|
+ sourceType: "module",
|
|
|
+ ecmaFeatures: {
|
|
|
+ jsx: true,
|
|
|
+ },
|
|
|
+ tsconfigRootDir: "./",
|
|
|
+ project: ["tsconfig.json"],
|
|
|
+ extraFileExtensions: [".vue", ".config.js"],
|
|
|
+ },
|
|
|
+ plugins: ["@typescript-eslint"],
|
|
|
+ extends: [
|
|
|
+ "eslint:recommended",
|
|
|
+ "plugin:@typescript-eslint/recommended",
|
|
|
+ "plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
|
+ "plugin:vue/vue3-recommended",
|
|
|
+ "prettier",
|
|
|
+ ],
|
|
|
+ rules: {
|
|
|
+ "@typescript-eslint/no-explicit-any": "off",
|
|
|
+ "@typescript-eslint/ban-ts-comment": "off",
|
|
|
+ "@typescript-eslint/no-unsafe-assignment": "off",
|
|
|
+ "@typescript-eslint/no-unsafe-member-access": "off",
|
|
|
+ "@typescript-eslint/restrict-plus-operands": "off",
|
|
|
+ "@typescript-eslint/restrict-template-expressions": "off",
|
|
|
+ "@typescript-eslint/no-non-null-assertion": "off",
|
|
|
+ // 一处使用hypen和一处不使用hypen,让字符搜索变得困难
|
|
|
+ "vue/attribute-hyphenation": ["error", "never"],
|
|
|
+ "vue/v-on-event-hyphenation": ["error", "never", { autofix: true }],
|
|
|
+ "vue/no-v-html": "off",
|
|
|
+ },
|
|
|
+ ignorePatterns: [
|
|
|
+ ".eslintrc.js",
|
|
|
+ "vite.config.ts",
|
|
|
+ "src/test",
|
|
|
+ "prebuild.mjs",
|
|
|
+ ],
|
|
|
+ overrides: [
|
|
|
+ {
|
|
|
+ files: ["src/**/**.vue"],
|
|
|
+ parser: "vue-eslint-parser",
|
|
|
+ parserOptions: {
|
|
|
+ parser: {
|
|
|
+ // Script parser for `<script>`
|
|
|
+ js: "espree",
|
|
|
+ // Script parser for `<script lang="ts">`
|
|
|
+ ts: "@typescript-eslint/parser",
|
|
|
+ // Script parser for vue directives (e.g. `v-if=` or `:attribute=`)
|
|
|
+ // and vue interpolations (e.g. `{{variable}}`).
|
|
|
+ // If not specified, the parser determined by `<script lang ="...">` is used.
|
|
|
+ "<template>": "espree",
|
|
|
+ },
|
|
|
+ project: ["tsconfig.json"],
|
|
|
+ },
|
|
|
+ globals: {
|
|
|
+ $ref: true,
|
|
|
+ $computed: true,
|
|
|
+ $$: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+};
|