Skip to main content

Version 0.20

New Feature: Customizable File Extension Ignoring

Sheriff now supports customizing which file extensions are ignored during import traversal through the new ignoreFileExtensions configuration option.

What it does

The ignoreFileExtensions option allows you to control which file types Sheriff should ignore when analyzing dependencies. By default, Sheriff ignores common non-code files like images, styles, fonts, and data files to improve performance and avoid irrelevant dependencies.

Configuration Options

You can configure ignoreFileExtensions in two ways:

1. Extend the defaults (recommended):

export const config: SheriffConfig = {
ignoreFileExtensions: (defaults) => [...defaults, 'env', 'yaml', 'toml'],
// ... other configuration
};

2. Override completely:

export const config: SheriffConfig = {
ignoreFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
// ... other configuration
};

Default Ignored Extensions

If you don't specify ignoreFileExtensions, Sheriff uses these sensible defaults:

  • Images: svg, png, jpg, jpeg, gif, webp, ico
  • Styles: css, scss, sass, less
  • Fonts: woff, woff2, ttf, eot, otf
  • Audio: mp3, wav, ogg
  • Video: mp4, webm, mov
  • Data/Misc: json, csv, xml, txt, md

Use Cases

This feature is particularly useful when:

  • Your project uses custom file extensions that should be ignored
  • You want to add environment-specific files (.env, .yaml) to the ignore list
  • You need to override the defaults for a specific project structure

Migration

No migration is required. Existing configurations will continue to work with the new default ignored extensions. If you want to customize the ignored extensions, simply add the ignoreFileExtensions option to your configuration.

For more details, see the Configuration Reference.