Skip to content

Conversation

@mensfeld
Copy link
Owner

Summary

Fixes #5 by dynamically identifying and skipping all ignore file parsers when using the --skip-ignore-files flag.

Problem

The --skip-ignore-files flag was using a hardcoded list of parser names:

const ignoreParserNames = ['gitignore', 'dockerignore', 'prettierignore', 'eslintignore'];

This was missing 'stylelintignore' and would require manual updates for any future ignore file parsers.

Solution

Replace the hardcoded list with dynamic filtering based on parser names ending with 'ignore':

const ignoreParserNames = skipIgnoreFiles
  ? parsers.filter((p) => p.name.endsWith('ignore')).map((p) => p.name)
  : [];

This now automatically skips all ignore file parsers:

  • gitignore
  • dockerignore
  • eslintignore
  • prettierignore
  • stylelintignore
  • markdownlintignore
  • semgrepignore
  • alexignore

Changes

  • src/cli.ts - Dynamic filtering logic with safety comments
  • README.md - Updated documentation to reflect all ignore files are skipped
  • tests/integration/cli.test.ts - Added 2 new integration tests

Test Coverage

Added two integration tests:

  1. should skip ignore files with --skip-ignore-files - Tests all ignore files are skipped together
  2. should skip stylelintignore specifically with --skip-ignore-files - Specifically tests the reported bug case

All 298 tests pass ✅

Benefits

  • Fixes the reported issue
  • Future-proof: automatically includes any new ignore file parsers
  • More maintainable: no need to update hardcoded lists
  • Safe: filters parser names (defined in code), not filesystem paths

Fixes #5

Previously, --skip-ignore-files used a hardcoded list that was missing
'stylelintignore' and other ignore file parsers. This caused .stylelintignore
files to still be checked even with the flag enabled.

Changes:
- Replace hardcoded list with dynamic filtering based on parser names ending with 'ignore'
- Automatically handles all current ignore parsers (gitignore, dockerignore, eslintignore,
  prettierignore, stylelintignore, markdownlintignore, semgrepignore, alexignore)
- Future-proof: automatically includes any new ignore file parsers
- Update README.md to reflect that all ignore files are skipped
- Add tests to verify .stylelintignore and other ignore files are properly skipped

This solution is safer and more maintainable than maintaining a hardcoded list.
@mensfeld mensfeld merged commit 7517f09 into master Jan 27, 2026
4 checks passed
@mensfeld mensfeld deleted the fix/issue-5-skip-ignore-files-stylelint branch January 27, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[request] support stylelint ignore + more

1 participant