如何禁用Angular的tslint错误visual studio?

问题描述 投票:1回答:3

Visual Studio 2017,正在检查Angular本身的核心文件,并打破构建。我已经添加了@ jasmine / types,并尝试在tslintconfig上进行尽可能多的更改。我该如何解决这个问题?我发布了我的包裹。

enter image description here

{
  "name": "client-app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/core": "^7.3.6",
    "@angular/animations": "^7.2.9",
    "@angular/cdk": "^7.3.4",
    "@angular/common": "^7.2.9",
    "@angular/compiler": "^7.2.9",
    "@angular/core": "^7.2.9",
    "@angular/flex-layout": "^7.0.0-beta.23",
    "@angular/forms": "^7.2.9",
    "@angular/http": "^7.2.9",
    "@angular/platform-browser": "^7.2.9",
    "@angular/platform-browser-dynamic": "^7.2.9",
    "@angular/platform-server": "^7.2.9",
    "@angular/router": "^7.2.9",
    "@handsontable/angular": "^4.0.0",
    "@ng-bootstrap/ng-bootstrap": "^4.1.0",
    "@swimlane/dragula": "^3.7.3",
    "@swimlane/ngx-datatable": "^14.0.0",
    "@swimlane/ngx-dnd": "^6.0.0",
    "@types/dragula": "^2.1.34",
    "@types/file-saver": "^2.0.0",
    "@types/html2canvas": "0.0.35",
    "ang-jsoneditor": "^1.7.3",
    "angular-confirmation-popover": "^4.2.0",
    "angular-font-awesome": "^3.1.2",
    "angular-split": "^2.0.1",
    "angular2-multiselect-dropdown": "^4.2.1",
    "angular2-prettyjson": "^3.0.1",
    "buffer": "^5.2.1",
    "core-js": "^2.6.5",
    "deep-object-diff": "^1.1.0",
    "easy-json-schema": "0.0.2-beta",
    "file-saver": "^2.0.1",
    "flatted": "^2.0.0",
    "font-awesome": "^4.7.0",
    "handsontable": "^7.0.0",
    "html2canvas": "^1.0.0-alpha.12",
    "jquery": "^3.3.1",
    "json-to-json-transformer": "^1.0.0",
    "jsoneditor": "^5.31.1",
    "jspdf": "^1.5.3",
    "lodash": "^4.17.11",
    "nested-property": "0.0.7",
    "ng-block-ui": "^2.1.1",
    "ng-multiselect-dropdown": "^0.2.3",
    "ng-sidebar": "^8.0.0",
    "ng2-bootstrap-modal": "https://github.com/Sky4CE/ng2-bootstrap-modal/tarball/v.1.0.2",
    "ng2-dragula": "^2.1.1",
    "ng2-eonasdan-datetimepicker": "^0.1.4",
    "ng2-file-upload": "^1.3.0",
    "ngx-accordion": "0.0.17",
    "ngx-bootstrap": "^3.2.0",
    "ngx-clipboard": "^12.0.0",
    "ngx-cookie-service": "^2.1.0",
    "ngx-datetime-picker": "^2.0.0",
    "ngx-owl-carousel": "^2.0.7",
    "ngx-papaparse": "^3.0.2",
    "ngx-popover": "0.0.16",
    "ngx-select-dropdown": "^1.0.1",
    "ngx-toasta": "^0.1.0",
    "ngx-tooltip": "0.0.9",
    "npm": "^6.9.0",
    "pretty-easy-date-check": "^1.2.4",
    "replaceall": "^0.1.6",
    "rxjs": "^6.4.0",
    "rxjs-compat": "^6.4.0",
    "tslib": "^1.9.0",
    "xml2js": "^0.4.19",
    "zone.js": "^0.8.29",
    "timers": "^0.1.1",
    "path": "^0.12.7",
    "lodash-es": "^4.17.11",
    "object-rename-keys": "^1.2.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.13.6",
    "@angular/cli": "^7.3.6",
    "@angular/compiler-cli": "^7.2.9",
    "@angular/language-service": "^7.2.9",
    "@types/jquery": "^3.3.29",
    "@types/node": "^11.11.3",
    "codelyzer": "^5.0.0-beta.1",
    "rxjs-tslint": "^0.1.7",
    "ts-node": "~8.0.3",
    "tslint": "^5.14.0",
    "typescript": "3.2.2",
    "jasmine-core": "^3.3.0",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "^4.0.1",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "^2.0.0",
    "karma-coverage-istanbul-reporter": "^2.0.5",
    "karma-jasmine": "^2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "^5.4.2",
    "@types/jasmine": "^3.3.9",
    "@types/jasminewd2": "~2.0.6"
  }
}

以上是我的package.json文件,下面是tslint文件。

{
  "compileOnSave": false,
  "compilerOptions": {
    "importHelpers": true,
    "outDir": "./dist",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "es6",
    "types": [
      "jasmine",
      "node"
    ],
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ],
    "module": "es2015",
    "baseUrl": "./",
    "exclude": [
      "../node_modules",
      "../typings/main",
      "**/*.spec.ts"
    ]
  }
}
angular angular7
3个回答
1
投票

就我而言,我在VSCODE中删除了添加的扩展名TSLint(已弃用)


0
投票

如果要禁用,只需打开tslint.json文件并将所有true参数替换为false。

之后它不会检查任何错误!


0
投票

在这里你需要在node_modules文件中的lint配置中排除angular.json,以忽略来自check node_modules错误的tslint

angular.json

"projects": {
     ...
     ...
     "architect": {
       ...
       ...

       "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },

希望这会有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.