简体   繁体   English

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

[英]How to disable ts-loader (tslint) checking in vue-cli 3 project?

When I run yarn test:unit the process runs and then after a few seconds it shows Type checking in progress... and a long list of errors follows. 当我运行yarn test:unit该过程将运行,然后在几秒钟后显示Type checking in progress...并显示一长串错误。

I tried following the advice to remove eslint but it didn't work. 我尝试按照建议删除eslint,但没有成功。

Here is my tsconfig.json (I don't have a tslint.json) 这是我的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"]
}

Try to change flag "strict" in "tsconfig:json" "strict": false 尝试更改“ tsconfig:json” "strict": false标志"strict": false

Also create tslint.json file in same folder with following content: 还要在同一文件夹中创建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
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM