我正在使用該包在應用程序中開發時處理Angular/TypeScript組件的包。我用npm鏈接來設置共享組件。在構建時,似乎tslint爲鏈接的包打開了一堆警告。如何禁止npm鏈接包中的tslint警告?
例如在我們的tslint.json中,我們有一個前綴「ta
」。在包中它是「fn
」。因爲我們在tsconfig中排除了node_modules,所以我們從來沒有遇到過問題。但是,一旦我們將npm鏈接到了包中,它現在也在我們包中的文件中找到了。然後在構建中的控制檯中觸發一堆警告。
WARNING in ../fn-library/src/popover/popover.component.ts
[10, 15]: The selector of the component "PopoverComponent" should have prefix "ta"
任何關於抑制npm鏈接包的tslint警告的建議?
這裏是父項目我目前tsconfig.json文件:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
"noEmitHelpers": true,
"strictNullChecks": false,
"importHelpers": true,
"baseUrl": "./src",
"paths": [],
"lib": [
"dom",
"es6"
],
"typeRoots": [
"node_modules/@types"
],
"types": [
"jasmine",
"node"
]
},
"exclude": [
"node_modules/**/*",
"dist/**/*"
],
"angularCompilerOptions": {
"skipMetadataEmit": true
},
"compileOnSave": false,
"buildOnSave": false
}
這裏是我的tslint文件:
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"directive-selector": [
true,
"attribute",
"ta",
"camelCase"
],
"component-selector": [
true,
"element",
"ta",
"kebab-case"
],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-attribute-parameter-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"no-forward-ref": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"pipe-naming": [
true,
"camelCase",
"ta"
],
"component-class-suffix": true,
"directive-class-suffix": true,
"import-destructuring-spacing": true
}
}
場所內'/ * tslint塊:禁用* /' – Aravind
我會建議什麼@Aravind是在暗示,但是你的父項目tslint不應掉毛文件在'node_modules'中,我很好奇你如何爲父項目添加內容?你可以發佈配置文件以及你如何觸發它? –
@Aravind問題是我想在單獨的項目中單獨進行linting。就像我說的,當包通過npm安裝時,這工作得很好。但當npm中的軟件包鏈接時,它會開始踢出錯誤。 –