Skip to content

feat: add no-backticks rule - #5

Open
nzakas wants to merge 1 commit into
rule-utilsfrom
rule/no-backticks
Open

nzakas wants to merge 1 commit into
rule-utilsfrom
rule/no-backticks

Conversation

@nzakas

@nzakas nzakas commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Adds shell/no-backticks, which mirrors ShellCheck SC2006: use $(...) instead of legacy backtick command substitution.

Behavior

  • Reports every backtick command substitution, including ones inside double quotes. Nested backticks are reported separately.
  • Autofix: rewrites `cmd` to $(cmd). The fix is skipped when the substitution contains a backslash or a nested backtick, because escaping rules differ inside backticks and a textual rewrite could change the meaning.
  • Recommended config: "error".

Also in this PR

This is the first rule in the stack, so besides registering the rule it:

  • adds the README's Rules table and a manual-configuration example;
  • adds a generic index.spec.ts check that every rule has docs, messages, and schema metadata, and that meta.docs.url points at the rule's file in docs/rules;
  • adds tests/rule-docs.test.ts, which checks every registered rule's doc: the title and description match the rule's metadata, the standard sections are present, every incorrect example is reported by the rule, and every correct example produces no messages;
  • creates tests/autofix.test.ts.

Every rule PR registers its rule in the same three places: src/index.ts (the rules map and the recommended config), the rule list in src/index.spec.ts, and the README table. Each rule PR also adds the rule's doc in docs/rules.

Documentation

Adds docs/rules/no-backticks.md, following the format of the @eslint/json, @eslint/css, and @eslint/markdown rule docs: description, background, rule details with incorrect and correct examples, options, when not to use it, and the ShellCheck reference. The rule's meta.docs.url points at that file, and its README table entry links to it.

Testing

  • 9 RuleTester cases, including fixed output, a no-fix case, and exact report positions.
  • An end-to-end verifyAndFix test.
  • The metadata check.
  • 5 documentation checks from the new docs test.

170 tests total; build, lint, and format checks pass.

🤖 Generated with Claude Code


Stack created with GitHub Stacks CLI • Give Feedback 💬

@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: af1167fa-ca93-49a8-9166-015212d150b7

📥 Commits

Reviewing files that changed from the base of the PR and between dde227f and ee025fe.

📒 Files selected for processing (8)
  • README.md
  • docs/rules/no-backticks.md
  • src/index.spec.ts
  • src/index.ts
  • src/rules/no-backticks.spec.ts
  • src/rules/no-backticks.ts
  • tests/autofix.test.ts
  • tests/rule-docs.test.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nzakas
nzakas added this pull request to stack #16 September 18, 2026 15:00
@nzakas
nzakas marked this pull request as ready for review September 18, 2026 15:01
@nzakas
nzakas force-pushed the rule/no-backticks branch 2 times, most recently from add0728 to 34075ff Compare September 22, 2026 19:56
@nzakas
nzakas requested a balanced review from Copilot September 28, 2026 18:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation, conservative fix behavior, registration, documentation, and tests are consistent and complete.

Review effort: Balanced
Findings: None

What changed in this PR

Adds the first Bash lint rule, discouraging legacy backtick command substitution.

Changes:

  • Implements and registers bash/no-backticks with safe autofixing.
  • Adds rule, integration, metadata, and documentation tests.
  • Documents configuration and rule behavior.
File Description
src/​rules/​no-backticks.ts Implements reporting and autofixing.
src/​rules/​no-backticks.spec.ts Tests rule behavior and fixes.
src/​index.ts Registers and recommends the rule.
src/​index.spec.ts Verifies registration and metadata.
tests/​autofix.test.ts Tests end-to-end autofixing.
tests/​rule-docs.test.ts Validates rule documentation examples.
docs/​rules/​no-backticks.md Documents the rule.
README.md Adds configuration and rules guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@nzakas
nzakas force-pushed the rule/no-backticks branch from 6e3fad6 to fe64fa5 Compare October 1, 2026 18:07
@nzakas
nzakas force-pushed the rule/no-backticks branch from 4afe1a3 to cbbea92 Compare October 2, 2026 16:05
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@nzakas
nzakas force-pushed the rule/no-backticks branch from cbbea92 to ee025fe Compare October 2, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants