'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.



Solution 1:[1]

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.

Solution 2:[2]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Guy
Solution 2