Conversation
|
Warning Review limit reachedYou'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. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (14)
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. Comment |
29743ab to
be54def
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The public visitor type exposes a Comment callback even though comments are intentionally excluded from traversal.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds end-to-end ESLint language support for parsing and linting Bash files.
Changes:
- Implements Bash language parsing, source locations, traversal, and directives.
- Exposes typed rule APIs, visitor keys, and recommended configuration.
- Adds unit and integration coverage plus usage documentation.
| File | Description |
|---|---|
src/languages/bash-language.ts |
Implements the ESLint language interface. |
src/languages/bash-language.spec.ts |
Tests language behavior and variants. |
src/languages/bash-source-code.ts |
Implements traversal, locations, and directives. |
src/languages/bash-source-code.spec.ts |
Tests source-code APIs. |
src/visitor-keys.ts |
Defines AST traversal keys. |
src/visitor-keys.spec.ts |
Tests visitor-key coverage. |
src/types.ts |
Adds language and rule types. |
src/types.spec.ts |
Tests exported types. |
src/index.ts |
Registers and exports the language. |
src/index.spec.ts |
Tests plugin exports and configuration. |
tests/fixtures/test-plugin.ts |
Provides test-only Bash rules. |
tests/plugin.test.ts |
Tests ESLint integration. |
tests/directives.test.ts |
Tests inline configuration directives. |
README.md |
Documents usage and options. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Comments are exposed through Program.comments and are never traversed, so a Comment handler could be declared but would never run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the `variant` language option with one language per shell dialect: `shell/bash`, `shell/posix`, and `shell/mksh`. The dialect is now set with the `mode` option of the `ShellLanguage` constructor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Adds the ESLint language implementation, so ESLint can lint shell scripts with this plugin's parser. After this PR the plugin works end to end; it just has no rules yet.
What's included
ShellLanguage(src/languages/shell-language.ts):modeconstructor option ("bash"default,"posix","mksh") selects the shell dialect. Unknown modes throw aTypeError. There are no language options.ShellSourceCode(src/languages/shell-source-code.ts), built onTextSourceCodeBasefrom@eslint/plugin-kit:getLoc()andgetRange()compute positions from each node'sstart/end, using a lazily built line index.traverse()builds the enter/exit steps once and records parents, which backgetParent()andgetAncestors().# eslint-disable,-enable,-disable-line, and-disable-next-line(with-- justification), plus# eslint rule: severity.src/visitor-keys.ts: traversal order for all 42 node types.src/types.ts: addsShellLanguageOptions, a typedShellRuleVisitor(per-node handlers plus:exitvariants), andShellRuleDefinition, built on plugin-kit'sCustomRuleDefinitionType.src/index.ts:shell/bash,shell/posix, andshell/mksh), an emptyrulesmap, andconfigs.recommended.**/*.shand**/*.bash, useslanguage: "shell/bash", and references the plugin itself. It has no rules yet; each rule PR adds its own entry.ShellLanguage,ShellSourceCode, andvisitorKeys.Integration tests
These tests use
tests/fixtures/test-plugin.ts, a test-only plugin with two trivial rules (test/no-forbidden,test/no-deprecated), so they don't depend on any shipped rule.tests/plugin.test.ts:.sh/.bashand not.js. This test uses code that is valid JavaScript but invalid Bash, so it can actually tell the difference.tests/directives.test.ts: every disable/enable directive form, unused-directive reporting, and inline severity and enable comments.Testing
54 new tests (136 total); build, lint, and format checks pass.
🤖 Generated with Claude Code
Stack created with GitHub Stacks CLI • Give Feedback 💬