如何在vue-cli 3项目中禁用ts-loader(tslint)检查?

时间:2018-12-12 14:28:06

标签: typescript vue.js vue-cli-3

当我运行yarn test:unit时,该过程开始运行,然后在几秒钟后显示Type checking in progress...,随后出现一长串错误。

我尝试按照建议删除eslint,但没有成功。

这是我的tsconfig.json(我没有tslint.json)

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true, //noImplicitAny, noImplicitThis, alwaysStrict, strictNullChecks, strictFunctionTypes, strictPropertyInitialization
    "allowJs": true,
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": ["webpack-env", "mocha", "chai"],
    "paths": {
      "@/*": ["src/*"]
    },
    "lib": ["esnext", "dom", "dom.iterable", "scripthost"]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": ["node_modules"]
}

1 个答案:

答案 0 :(得分:0)

尝试更改“ tsconfig:json”中的标志“ strict” "strict": false

还要在具有以下内容的同一文件夹中创建tslint.json文件:

{
  "defaultSeverity": "warning",
  "extends": [
    "tslint:recommended"
  ],
  "linterOptions": {
    "exclude": [
      "node_modules/**"
    ]
  },
  "rules": {
    "quotemark": [
      true,
      "single"
    ],
    "indent": [
      true,
      "spaces",
      2
    ],
    "interface-name": false,
    "ordered-imports": false,
    "object-literal-sort-keys": false,
    "no-consecutive-blank-lines": false
  }
}