-
Notifications
You must be signed in to change notification settings - Fork 14
fix: Support files configuration option #409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
👷 Deploy request for rslint pending review.Visit the deploys page to approve it
|
5cd9799 to
1b1ad13
Compare
- optimize file matching logic - support negation glob patterns in `files` and `ignores` configurations
1b1ad13 to
c3637ae
Compare
| if isFileIgnored(filePath, entry.Ignores) { | ||
| continue // Skip this config entry for ignored files | ||
| } | ||
| cwd, _ := os.Getwd() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this fails, cwd becomes empty and pattern normalization may behave unexpectedly. Consider referring to the previous logic in isFileIgnoredSimple.
| LanguageOptions *LanguageOptions `json:"languageOptions,omitempty"` | ||
| Rules Rules `json:"rules"` | ||
| Plugins []string `json:"plugins,omitempty"` // List of plugin names | ||
| matcher *fileMatcher // Cache for the file matcher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The matcher field and GetFileMatcher method on ConfigEntry should be removed. Suggest creating matcher inline in GetRulesForFile instead.
| } | ||
|
|
||
| // classifyPatterns splits a list of glob patterns into its positive and negative patterns. | ||
| func classifyPatterns(patterns []string) (positivePatterns []string, negativePatterns []string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This separates patterns into two groups, which differs from how ignores handles negation (sequential "last match wins"). For example, ["src/**", "!**/*.test.ts", "**/important.test.ts"] would exclude important.test.ts because all negative patterns are applied after all positive patterns.
Summary
Add support for
filesconfiguration optionfilesandignoresconfigurationsRelated Links
Fixed #408
Checklist