humanmade / linter-bot

Automatically run the HM Coding Standards on any repository.
https://github.com/apps/hm-linter
16 stars 3 forks source link

Stylelint seems to not respect `.stylelintignore` at project root #154

Open goldenapples opened 3 years ago

goldenapples commented 3 years ago

When running the linterbot with stylelint enabled, any paths ignored by a .stylelintignore at the project root are not properly ignored by the linter. That is, running npx stylelint content/**/*.scss returns no errors, but HM Linter is returning errors in files while should be excluded by the .stylelintignore.

I don't initially see what the error is. What is the first step I should take in troubleshooting this issue?

ntwb commented 3 years ago

I'm pretty sure linter-bot doesn't read the .stylelintignore file, or .eslintignore for that matter

linter-bot uses a custom ignore file, .phpcsignore and I think adding the exclusion paths from the .stylelintignore file to a .phpcsignore file should resolve this

rmccue commented 3 years ago

linter-bot uses a custom ignore file, .phpcsignore and I think adding the exclusion paths from the .stylelintignore file to a .phpcsignore file should resolve this

Actually, this isn't a linter-bot thing, it's part of the PHP coding standards. Shouldn't affect ESLint/Stylelint afaik

goldenapples commented 3 years ago

Yeah, stylelint should be reading the contents of {CWD}/.stylelintignore and {CWD}/.stylelintrc automatically and applying project-defined rules and ignore paths in the same way that eslint and phpcs are. Because the stylelint executable doesn't have a cwd option that you can pass in like eslint does, we're trying to change directory before running the command. I was just wondering why this wasn't working.

For now I've just disabled stylelint on the project so as not to get caught up with lint issues on legacy and third-party code, but I want to come back to this when I have a moment and figure out why it wasn't working.