Skip to content

Flag path-like codes in diagnosticFilters - #1753

Open
markwpearce wants to merge 4 commits into
rokucommunity:v1from
markwpearce:markp/1384-flag-path-like-diagnostic-codes
Open

Flag path-like codes in diagnosticFilters#1753
markwpearce wants to merge 4 commits into
rokucommunity:v1from
markwpearce:markp/1384-flag-path-like-diagnostic-codes

Conversation

@markwpearce

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a new diagnostic that warns when a v1-style diagnosticFilters entry looks like a file path or glob (contains ./, ../, **, or ends in .bs/.brs/.xml) rather than a diagnostic code — a common mistake when migrating a v0-style bsconfig, where diagnosticFilters entries were file globs.
  • Skipped when diagnosticFiltersV0Compatibility is enabled, since those filters are legitimately file globs.

Closes #1384

Test plan

  • Added unit tests for DiagnosticFilterer.getPathLikeDiagnosticFilterCodes
  • Added an integration test in Program.spec.ts verifying the diagnostic is emitted/not emitted during program.validate()
  • npm run build, npm run lint, and npm run test:nocover all pass

🤖 Generated with Claude Code

Warn when a v1-style diagnosticFilters entry looks like a file path or
glob (contains `./`, `../`, `**`, or ends in `.bs`/`.brs`/`.xml`)
instead of a diagnostic code, since that's a common leftover from
migrating a v0-style config. Skipped when
diagnosticFiltersV0Compatibility is enabled, since those filters are
legitimately file globs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@markwpearce markwpearce added this to the v1.0.0 milestone Jul 21, 2026
Comment thread src/DiagnosticFilterer.ts
}
const lowerValue = value.toLowerCase();
return (
value.includes('./') ||

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about windows? .\

Comment thread src/DiagnosticManager.ts
* This is a common mistake when migrating a bsconfig.json from the v0-style filters (which were file globs)
*/
public detectPathLikeDiagnosticFilterCodes(config: FinalizedBsConfig, context?: DiagnosticContext) {
const pathLikeCodes = this.diagnosticFilterer.getPathLikeDiagnosticFilterCodes(config);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth checking to see if the pattern is exactly a path to a known file in the files array? like source/main.json or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants