Skip to content

解决了 webpack eslint-loader不能和eslint命令行,公用一个ignore文件的问题

Notifications You must be signed in to change notification settings

shuizhongyue120/eslintIgnore-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

eslintIgnore

eslintIgnore webpack eslint-loader


项目中推广eslint规范,在使用发现了一个问题; eslintignore文件只能在 eslint xxx 命令行形式中生效; webpack eslint-loader则不可以,因为webpack loader中规定了 忽略文件要通过exclude方式。

故写了一个简单的loader来读取eslintignore的内容,并且以数字的形式返回给exclude。 使用方式如下:


    preLoaders: [{
            test: /\w+[^Tpl]\.js$/,
            loader: 'eslint-loader',
            include: path.resolve(__dirname, "../js"),
            exclude: new EslintIgnore()
            /*exclude:[ // 排除第三方库,插件之类的
                path.resolve(__dirname, "../js/lib"),
                path.resolve(__dirname, "../js/com/thunderAgent.js"),
                path.resolve(__dirname, "../js/com/pv_click_v2.mini.js"),
                path.resolve(__dirname, "../js/util/debug.js")
            ]*/
        }]

About

解决了 webpack eslint-loader不能和eslint命令行,公用一个ignore文件的问题

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published