如何禁用特定目录上的 Angular cli ng build linting?

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

我有这个目录,它是模板的一部分,我想在 linting 中排除它。我已经在 tsconfig 和 eslint 中排除了它。 runnig eslint 它工作正常,但是当执行

ng build
时,它将包含 linting 上的目录并会产生错误。

主题目录是

src/fuse.

我已经将其添加到我的配置中。

eslintignore

build/
dist/
www/
src/@fuse/

eslintrc

    "ignorePatterns": [
        "src/@fuse/**/*",
        "./src/@fuse/**/*",
        "src/@fuse",
        "./src/@fuse"
    ],

tsconfig

    "exclude": ["./src/@fuse", "src/@fuse"]

ng build
时我会得到这个。即使被排除,它仍然应用 linting

javascript node.js angular typescript eslint
1个回答
0
投票

我认为它们不是 lint 错误,只有当您执行

ng lint
时才会出现 lint 错误,这些是由于
tsconfig.json
的配置导致的构建错误。

/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
  ...
  "compilerOptions": {
    ...
    "strict": false, 
    "noImplicitOverride": true,
    "noPropertyAccessFromIndexSignature": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "esModuleInterop": true,
    ...
  },
  ...
}

尝试切换这些属性并检查其是否有效。否则只需修复这些错误,因为它是构建运行所必需的!

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