alleyinteractive / sasslint-webpack-plugin

A webpack plugin to lint your SCSS/SASS code
MIT License
33 stars 12 forks source link

How to ignore files from 'node_modules'. #27

Open andriibuts opened 7 years ago

andriibuts commented 7 years ago

Could someone suggest how to configure sassLintPlugin to ignore files from node_modules folder (or any other)?

The ignoreFiles option only works for me if I add the path to every file.

Here is my config:

module.exports = {
    ...
    plugins: [
        new HtmlWebpackPlugin({
            inject: true,
            template: path.resolve('index.html'),
            favicon: path.resolve('favicon.ico')
        }),
        new ExtractTextPlugin('build/styles.css'),
        new sassLintPlugin({
            ignoreFiles: [
                path.resolve('node_modules/sasslint-webpack-plugin/test/testfiles/test7/_second.scss'),
                path.resolve('node_modules/sasslint-webpack-plugin/test/testfiles/test6/test.scss'),
                path.resolve('node_modules/sasslint-webpack-plugin/test/testfiles/test3/test.scss')            ],
            ignorePlugins: ['extract-text-webpack-plugin']
        })
    ]
};

With this setup, only those three files are ignored but there are plenty of files from node_modules which produce a lot of warnings.

Thanks.

andriibuts commented 7 years ago

All my files are placed in src folder so I solve this by setting the glob option to src/**/*.s?(a|c)ss.

module.exports = {
    ...
    plugins: [
        ...
        new sassLintPlugin({
            glob: 'src/**/*.s?(a|c)ss',
            ignorePlugins: ['extract-text-webpack-plugin']
        })
    ]
};

Hope it will help someone.

kevincaradant commented 7 years ago

Nice ! Thank you, it's exactly that I want :). Maybe you can close this issue, now it's solved ;)

andriibuts commented 7 years ago

I still hope that someone will eventually answer my original question)

mikeerickson commented 7 years ago

@andriibuts Good day sir

Here is how I do it (I have a .sass-lint.yml file)

options:
  formatter: stylish
files:
  include:
    - "src/**/*.s+(a|c)ss"
  ignore:
    - "src/sass/disabled/**/*.s+(a|c)ss"
    - "src/sass/modules/*.s+(a|c)ss"
    - "node_modules/**/*.s+(a|c)ss"
rules:
jackmarketon commented 7 years ago

@andriibuts There currently isn't a method for glob ignoring files, we set the glob option internally to target the specific files we want linted when we internally utilize this plugin.

We accept PRs for improvements although.