Conversation
🦋 Changeset detectedLatest commit: 0abca04 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Merging this PR will not alter performance
Comparing Footnotes
|
6cc3176 to
5c6f564
Compare
c6082cc to
328c0e5
Compare
WalkthroughA new linter rule Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
328c0e5 to
0abca04
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.changeset/rude-apples-prove.md (1)
5-7: Changeset description is clear and user-focused.The description accurately conveys the rule's purpose and its type-aware behaviour. A minor clarity improvement: consider adding a comma after "strings" to make the compound structure clearer.
📝 Optional clarity tweak
-The rule uses type information, so it only reports on strings and skips array lookups such as `items[0] === "a"`. +The rule uses type information, so it only reports on strings, and skips array lookups such as `items[0] === "a"`.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.changeset/rude-apples-prove.md around lines 5 - 7, The changeset sentence describing the rule's type-aware behavior needs a comma for clarity: update the sentence that mentions the rule "uses type information" so that the clause reads "so it only reports on strings, and skips array lookups such as `items[0] === \"a\"`" — modify the text referring to useStringStartsEndsWith to insert the comma after "strings" to improve readability.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.changeset/rude-apples-prove.md:
- Around line 5-7: The changeset sentence describing the rule's type-aware
behavior needs a comma for clarity: update the sentence that mentions the rule
"uses type information" so that the clause reads "so it only reports on strings,
and skips array lookups such as `items[0] === \"a\"`" — modify the text
referring to useStringStartsEndsWith to insert the comma after "strings" to
improve readability.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 16cea3ab-836c-48e7-b2c0-84534420d57f
⛔ Files ignored due to path filters (14)
crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rsis excluded by!**/migrate/eslint_any_rule_to_biome.rsand included by**crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_configuration/src/generated/domain_selector.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_configuration/src/generated/linter_options_check.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidCharAt.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidIndex.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidNoFix.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidRegex.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidSearch.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidSlice.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/valid.ts.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (11)
.changeset/rude-apples-prove.mdcrates/biome_js_analyze/src/lint/nursery/use_string_starts_ends_with.rscrates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidCharAt.tscrates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidIndex.tscrates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidNoFix.tscrates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidRegex.tscrates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidSearch.tscrates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidSlice.tscrates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/valid.tscrates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_string_starts_ends_with.rs
✅ Files skipped from review due to trivial changes (9)
- crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidSlice.ts
- crates/biome_rule_options/src/lib.rs
- crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidSearch.ts
- crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidRegex.ts
- crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidNoFix.ts
- crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidIndex.ts
- crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/invalidCharAt.ts
- crates/biome_js_analyze/tests/specs/nursery/useStringStartsEndsWith/valid.ts
- crates/biome_rule_options/src/use_string_starts_ends_with.rs
Summary
This adds
useStringStartsEndsWith, which is a port of https://typescript-eslint.io/rules/prefer-string-starts-ends-with/I chose to use type info (like the source rule) because my hunch is that there would be way too many false positives otherwise. Also, I chose to split the invalid tests into a bunch of files because the rule is very complex, and it makes it easier to spot whether diagnostics are getting emitted.
generated by gpt 5.4, but heavily guided to stop it from doing dumb things.
closes #7653
supersedes and closes #8582
Test Plan
all the tests are from the source rule, excluding the ones depending on the source rule's option
Docs