stylelint: ignoreFiles and .stylelintignore not being respected

Describe the issue. Is it a bug or a feature request (new rule, new option, etc.)?

A bug where ignoreFiles and .stylelintignore seem to be ignored. I upgraded our project packages/dependencies and our stylelint postcss task seems to be including (and erroring) on files specified in the ignore. I have tried using a .stylelintignore instead but neither seem to be respected.

Our previous package versions before the upgrade are: stylelint: 6.6.0 and style-lint-config: 9.0.0

Our config is unchanged before/after the dependency update.

Which rule, if any, is this issue related to?

Doesn’t look to be related to a specific rule

What stylelint configuration is needed to reproduce this issue?

{
  "extends": "stylelint-config-standard",
  "ignoreFiles": "./static/components/**",
  "rules": {
    "color-no-invalid-hex": true,
    "selector-no-id": true,
    "function-linear-gradient-no-nonstandard-direction": null,

    "rule-non-nested-empty-line-before": null,
    "comment-empty-line-before": null,
    "at-rule-empty-line-before": null,

    "selector-pseudo-element-colon-notation": "single",
    "string-quotes": "single",
    "function-url-quotes": "always",
    "font-family-name-quotes": "always-unless-keyword",

    "color-hex-length": null,
    "color-hex-case": null,

    "declaration-no-important": true,
    "selector-max-specificity": "0,4,3",
    "declaration-block-no-ignored-properties": null,
    "function-name-case": null,
    "no-extra-semicolons": true,
    "no-duplicate-selectors": true
  }
}

Which version of stylelint are you using?

stylelint: 7.0.3 stylelint-config-standard: 11.0.0

How are you running stylelint:

via grunt-postcss plugin. here is the config we use for that task module.exports = { options: { processors: [ require('stylelint')(), require('postcss-reporter')({ clearMessages: true, throwError: true, }), require('autoprefixer')({ browsers: ['last 2 versions'], }), ], }, dist: { src: 'static/css/apps.css', }, };

What did you expect to happen?

No warnings to be flagged.

What actually happened (e.g. what warnings or errors you are getting)?

A warning is flagged from a file within the ignored directory.

screen shot 2016-07-21 at 08 59 42

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 23 (17 by maintainers)

Most upvoted comments

Sadly this appears to make no difference. I am still getting the same error out using your recommendations.

im using webpack with it, same problem occured. turns out the problem was the sequance of my configuration

wrong

postcss: function(webpack) {
    return [
      stylelint({
        ignorePath: '../../node_modules/',
        extends: 'stylelint-config-standard',
        rules: stylelintRules,
      }),
      postcssImport({addDependencyTo: webpack}),
      cssnext({autoprefixer: {browsers: "ie >= 9, ..."}}),
      postcssReporter({clearMessages: true})
    ]
  }

correct

  postcss: function(webpack) {
    return [
      postcssImport({addDependencyTo: webpack}),
      stylelint({
        ignorePath: '../../node_modules/',
        extends: 'stylelint-config-standard',
        rules: stylelintRules,
      }),
      cssnext({autoprefixer: {browsers: "ie >= 9, ..."}}),
      postcssReporter({clearMessages: true})
    ]
  }

it just wont ignore no matter what path I specifed

[mischka@mischka-laptop test-stylelint]$ tree -a
.
├── css
│   └── main.scss
├── node_modules
│   └── stylelint-config-standard
│       ├── CHANGELOG.md
│       ├── index.js
│       ├── LICENSE
│       ├── package.json
│       └── README.md
├── package.json
└── .stylelintrc.json

3 directories, 8 files
[mischka@mischka-laptop test-stylelint]$ cat .stylelintrc.json 
{
    "extends": "stylelint-config-standard",
    "ignoreFiles": [
        "./css/main.scss"
    ],
    "rules": {
        "indentation": "tab",
        "color-hex-case": "lower",
        "at-rule-empty-line-before": "always",
        "rule-nested-empty-line-before": "always",
        "max-empty-lines": 3
    }
}
[mischka@mischka-laptop test-stylelint]$ stylelint css/*

css/main.scss
 1:1  ✖  Unknown word   CssSyntaxError

Edit: Oops sorry forgot process.cwd()

[mischka@mischka-laptop test-stylelint]$ node -e "console.log(process.cwd())"
/home/mischka/projects/test-stylelint
[mischka@mischka-laptop test-stylelint]$ pwd
/home/mischka/projects/test-stylelint

Edit again: https://github.com/jacobmischka/test-stylelint