123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- /**
- * @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"],
- },
- plugins: ["@typescript-eslint"],
- extends: [
- "eslint:recommended",
- "plugin:@typescript-eslint/recommended",
- "plugin:@typescript-eslint/recommended-requiring-type-checking",
- "plugin:vue/vue3-recommended",
- "prettier",
- ],
- rules: {
- // 和 $ref let 冲突, fixed vue@3.2.26
- // "prefer-const": "off",
- "@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",
- // TODO: https://github.com/vuejs/rfcs/discussions/369 defineProps deconstructure retain reactivity
- // eslint-disable-next-line vue/no-setup-props-destructure
- "vue/no-setup-props-destructure": "off",
- "vue/multi-word-component-names": "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>": "@typescript-eslint/parser",
- },
- project: ["tsconfig.json"],
- },
- globals: {
- $ref: true,
- $computed: true,
- $$: true,
- },
- },
- ],
- };
|