Skip to main content

Ignore files

Tools have different ways to ignore files, Git uses .gitignore, and ESLint, Stylelint and Prettier have their own counterparts.

Thankfully, ESLint, Stylelint and Prettier have adopted the .gitignore format, so across these tools, the ignore files are compatible.

When using d2-style you may want to:

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

Look-up behavior

All file look ups are done in relation to the current working directory.

If the .d2styleignore file exists, and there is no specific configuration for a tool, then .d2styleignore will be passed to both ESLint and Prettier.

If you do not have any custom ignore files, then your .gitignore will be used if it exists.

Ignore file priority

It is possible to override the ignore list for specific tools by adding 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)