浏览代码

成功的eslint配置

Michael Wang 3 年之前
父节点
当前提交
dc98f150fe
共有 4 个文件被更改,包括 5 次插入4 次删除
  1. 2 1
      .eslintrc.js
  2. 1 1
      package.json
  3. 1 1
      src/App.vue
  4. 1 1
      tsconfig.json

+ 2 - 1
.eslintrc.js

@@ -16,7 +16,7 @@ module.exports = {
       jsx: true,
     },
     tsconfigRootDir: "./",
-    project: ["./tsconfig.json"],
+    project: ["tsconfig.json"],
     extraFileExtensions: [".vue"],
   },
   plugins: ["@typescript-eslint"],
@@ -48,6 +48,7 @@ module.exports = {
           // If not specified, the parser determined by `<script lang ="...">` is used.
           "<template>": "espree",
         },
+        project: ["tsconfig.json"],
       },
       globals: {
         $ref: true,

+ 1 - 1
package.json

@@ -9,7 +9,7 @@
     "build-without-type-check": "vite build",
     "typecheck": "vue-tsc --noEmit --skipLibCheck",
     "serve": "vite preview",
-    "lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
+    "lint": "eslint --ext .js,.ts,.vue --ignore-path .gitignore --fix src",
     "format": "prettier .  --write"
   },
   "dependencies": {

+ 1 - 1
src/App.vue

@@ -12,7 +12,7 @@
 </template>
 
 <script setup lang="ts">
-import { watch, watchEffect, computed } from "vue";
+import { watch, watchEffect } from "vue";
 import { store } from "@/store/store";
 import zhCN from "ant-design-vue/es/locale/zh_CN";
 

+ 1 - 1
tsconfig.json

@@ -11,7 +11,7 @@
     "resolveJsonModule": true,
     "esModuleInterop": true,
     "lib": ["esnext", "dom"],
-    "types": ["vite/client", "./node_modules/vue/ref-macros"],
+    "types": ["./node_modules/vite/client", "./node_modules/vue/ref-macros"],
     "baseUrl": "./",
     "paths": {
       "@/*": ["src/*"]