Skip to content

Commit

Permalink
fix: document ignorefile for stylelint (#468)
Browse files Browse the repository at this point in the history
* feat: resolve ignorefile for stylelint

* docs: add stylelint to ignore docs
  • Loading branch information
ismay committed May 22, 2024
1 parent 4c247e9 commit bb133b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions docs/ignore-files.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Ignore files

Tools have different ways to ignore files, Git uses `.gitignore`, and
[ESLint](https://eslint.org/docs/user-guide/configuring#eslintignore) and
[ESLint](https://eslint.org/docs/user-guide/configuring#eslintignore), [Stylelint](https://stylelint.io/user-guide/ignore-code/#files-entirely) and
[Prettier](https://prettier.io/docs/en/ignore.html#ignoring-files) have their
own counterparts.

Thankfully, ESLint and Prettier have adopted the [`.gitignore`
Thankfully, ESLint, Stylelint and Prettier have adopted the [`.gitignore`
format](https://git-scm.com/docs/gitignore#_pattern_format), so across these
tools, the ignore files are compatible.

When using `d2-style` you may want to:

- Have different ignores for Prettier and ESLint
- Have different ignores for Prettier, Stylelint and ESLint
- Have different ignores for `d2-style` and Git
- Share ignores across all supported tools

Expand All @@ -34,6 +34,7 @@ a corresponding ignore file.
The following files are supported, in prioritised order:

- `.eslintignore` _(ESLint only)_
- `.stylelintignore` _(Stylelint only)_
- `.prettierignore` _(Prettier only)_
- `.d2styleignore` _(All excluding Git)_
- `.gitignore` _(All including Git)_
6 changes: 5 additions & 1 deletion src/tools/stylelint.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ const { PACKAGE_ROOT } = require('../utils/paths.js')
exports.stylelint = ({ files = [], apply = false, callback }) => {
const cmd = 'stylelint'
const cwd = PACKAGE_ROOT
const args = [...(apply ? ['--fix'] : []), ...files]
const args = [
'--report-needless-disables',
...(apply ? ['--fix'] : []),
...files,
]

bin(cmd, { args, cwd }, callback)
}

0 comments on commit bb133b2

Please sign in to comment.