Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StyleLint - Ignore specific folders and files

I'm using StyleLint with Webpack.

My current Webpack configuration is:

module.exports.styleLint = (isProd = false) => {
  const options = {
    configFile: './.stylelintrc.json',
    files: '**/*.less',
    format: 'less',
    failOnError: false,
    quiet: false,
    emitErrors: isProd
  };
  return new StyleLintPlugin(options);
};

How can I specify some folders or files to be ignored by StyleLint (I don't want to see any errors in the output)?

Note:

I don't want to add

/* stylelint-disable */

inside these files.

like image 430
Guy Avatar asked Jun 02 '19 11:06

Guy


2 Answers

I used the following configuration in the stylelint config file:

{
    "extends": "stylelint-config-recommended",
    "ignoreFiles": [
        "app/bootstrap/**/*.less"
    ]
}

And it skipped the files in the specified folder.

like image 142
Guy Avatar answered Sep 22 '22 00:09

Guy


Another way to exclude something with a stylelint is to use the .stylelintignore file.


As the documentation says:

You can use a .stylelintignore file to ignore specific files. For example:

**/*.js
vendor/**/*.css

The patterns in your .stylelintignore file must match .gitignore syntax. (Behind the scenes, node-ignore parses your patterns.) Your patterns in .stylelintignore are always analyzed relative to process.cwd().

stylelint looks for a .stylelintignore file in process.cwd(). You can also specify a path to your ignore patterns file (absolute or relative to process.cwd()) using the --ignore-path (in the CLI) and ignorePath (in JS) options.

like image 38
kanlukasz Avatar answered Sep 21 '22 00:09

kanlukasz