简体   繁体   中英

How do I fix “no-unused-vars” for main entry Browserify js file?

I use Gulp and Browserify to be able to use ES6 imports, as well as ESLint to apply coding standards.

So I need one entry file for Browserify which only imports all my other files:

import Carousel from "./bootstrap/carousel";
import Transition from "./bootstrap/transition";
import Header from "./header/header";

Unfortunately, ESLint complains

data/themes/js/src/main.js
  1:8  error  'Carousel' is defined but never used    no-unused-vars
  2:8  error  'Transition' is defined but never used  no-unused-vars
  3:8  error  'Header' is defined but never used      no-unused-vars

I wouldn't like to disable the rule (although I could do it only for that file)

如果仅出于副作用导入模块,则可以使用

import "module";

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