feat: add configurable file extension support via supportedFileExtensions#254
Open
rainerhahnekamp wants to merge 2 commits into
Open
feat: add configurable file extension support via supportedFileExtensions#254rainerhahnekamp wants to merge 2 commits into
rainerhahnekamp wants to merge 2 commits into
Conversation
…ions Introduces the `supportedFileExtensions` option in `sheriff.config.ts`, allowing users to define which file extensions Sheriff traverses when resolving imports. Defaults to `ts`, `tsx`, `mts`, and `cts`. - ESLint plugin file globs (`all`, `legacy`) are now driven by `defaultSupportedFileExtensions` instead of hardcoded strings - Path resolution in `get-ts-config-context` iterates over supported extensions instead of hardcoding `.ts` - A `[SHERIFF CONFIG MISMATCH]` warning is emitted when ESLint lints a file whose extension is absent from `supportedFileExtensions` - Init order fixed: config is loaded before generating TS data so extensions are available during path resolution - Adds Next.js integration test project covering encapsulation rules on `.tsx` files - Updates docs with `supportedFileExtensions` reference and guidance on scoping ESLint `files` patterns to source directories Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Store config separately from fileInfo in violates-dependency-rule and violates-encapsulation-rule (FileInfo has no config property) - Default supportedFileExtensions to defaultSupportedFileExtensions instead of [] in getTsConfigContext and generateTsData so callers without explicit extensions still resolve .ts paths correctly - Update parse-config tests to include supportedFileExtensions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
supportedFileExtensionsinsheriff.config.ts(array or function), defaulting tots,tsx,mts,cts, giving users control over which file extensions Sheriff traverses when resolving importsall,legacy) are now driven bydefaultSupportedFileExtensionsinstead of hardcoded stringsget-ts-config-contextiterates oversupportedFileExtensionsinstead of hardcoding.ts[SHERIFF CONFIG MISMATCH]warning when ESLint lints a file whose extension is absent fromsupportedFileExtensions.tsxfilessupportedFileExtensionsreference and guidance on scoping ESLintfilespatterns to source directoriesTest plan
yarn test)run-integration-tests.shsupportedFileExtensions: (defaults) => [...defaults, 'js']insheriff.config.tsresolves.jspath mappings correctly.tsxfile linted by ESLint withtsxinsupportedFileExtensionsproduces no mismatch warningsupportedFileExtensionsproduces the[SHERIFF CONFIG MISMATCH]error🤖 Generated with Claude Code