简体   繁体   中英

How to disable tslint for an unused import in Angular

I've a small project. I wanted to create a production built for the same. I used this command:

ng build --prod

But it was throwing some build errors. So I asked my tech lead and she told me add this import:

import ResizeObserver from 'resize-observer-polyfill'

The build was successful after this but now the files are not passing linting test. Since the import is not used anywhere else in this code. I'm getting this error:

ERROR: C:/Users/320035648/Angular/pinc-insights-ui/src/app/app.module.ts:29:1 - All imports on this line are unused. Lint errors found in the listed files.

So I added this line before the import:

/* tslint: disable: no-unused-variable */

But still I'm getting same error. Please help me.

如果您不使用ResizeObserver ,因此只使用库导入副作用,为什么不简单地以这种方式导入库:

import 'resize-observer-polyfill'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM