升级 nx/angular 后,Linting 非常慢。插件:导入/不弃用

use*_*429 11 nomachine-nx typescript eslint angular

在 nx 升级过程中,项目已从 升级为11.2.11( )12.2.10nx migrate

\n

现在,代码检查时间从 30 秒增加到 4 分钟:

\n
 time TIMING=1 ng lint my-app\n\n> nx run my-app:lint \n\nLinting "my-app"...\n\nAll files pass linting.\n\nRule                                       |  Time (ms) | Relative\n:------------------------------------------|-----------:|--------:\nimport/no-deprecated                       | 204887.182 |    99.6%\n@nrwl/nx/enforce-module-boundaries         |    260.016 |     0.1%\n@typescript-eslint/naming-convention       |     83.345 |     0.0%\nmax-len                                    |     66.311 |     0.0%\ncomma-dangle                               |     40.576 |     0.0%\nno-global-assign                           |     23.094 |     0.0%\n@typescript-eslint/no-unused-vars          |     22.934 |     0.0%\n@typescript-eslint/type-annotation-spacing |     22.831 |     0.0%\nno-misleading-character-class              |     18.360 |     0.0%\n@typescript-eslint/triple-slash-reference  |     16.281 |     0.0%\n\n\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\n\n>  NX   SUCCESS  Running target "lint" succeeded\n\n\n\nreal    3m41.726s\nuser    4m19.102s\nsys     0m23.049s\n
Run Code Online (Sandbox Code Playgroud)\n
    "@angular-devkit/build-angular": "12.2.10",\n    "@angular-eslint/eslint-plugin": "12.3.1",\n    "@angular-eslint/eslint-plugin-template": "12.3.1",\n    "@angular-eslint/template-parser": "12.3.1",\n    "@angular/cli": "12.2.10",\n    "@angular/compiler-cli": "12.2.10",\n    "@angular/language-service": "12.2.10",\n    "@angular/localize": "^12.2.10",\n    ...\n    "@nrwl/eslint-plugin-nx": "12.10.0",\n    ...\n    "eslint-plugin-import": "2.22.1",\n
Run Code Online (Sandbox Code Playgroud)\n

eslint 设置:"import/no-deprecated": "warn",

\n

是否更改了任何设置或者我应该删除此导入?

\n

小智 0

检查您的应用程序 tsConfig,在我的例子中,缺少“include”属性,因此 lint 时间太长。

    {
       "include": ["./src/**/*.ts"],
       "files": ["./src/main.ts", "./src/polyfills.ts"],
       "exclude": ["./src/test.ts", "**/*.spec.ts"]
   }
Run Code Online (Sandbox Code Playgroud)