Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了angular – 如何从npm链接包中抑制tslint警告?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我在使用该软件包在应用程序中进行开发时正在开发一个Angular / TypeScript组件包.我使用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","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
    }
}
@H_675_18@ 您可以使用内联注释来禁用该行上的tslint
SELEctor: 'component',// tslint:disable-line

要排除一组文件,请将以下行添加到tsconfig文件

"tslint.exclude": "**/folder/**/*.ts"

你的情况下

"tslint.exclude": "**/fn-library/**/*.ts"

大佬总结

以上是大佬教程为你收集整理的angular – 如何从npm链接包中抑制tslint警告?全部内容,希望文章能够帮你解决angular – 如何从npm链接包中抑制tslint警告?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。