-
Notifications
You must be signed in to change notification settings - Fork 6
✨ JavaScript #53
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
✨ JavaScript #53
Conversation
WalkthroughA new JavaScript language package, Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (7)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (5)
packages/javascript/README.md (1)
14-24
: Usage example is concise and demonstrates the key functionality.The example demonstrates the essential steps for using the package:
- Importing the JavaScript language module and NAPI functions
- Registering the dynamic language
- Parsing JavaScript code and accessing the root node
Consider adding another example demonstrating a more complex pattern matching use case to help users understand the full capabilities of the package.
packages/javascript/index.js (2)
6-7
: LGTM! Consider adding TypeScript extensions if applicable.The extension list correctly includes common JavaScript file extensions. If this parser is intended to support TypeScript files as well, consider adding 'ts' and 'tsx' extensions to the list.
8-8
: Consider adding a comment explaining the expandoChar's purpose.The
expandoChar
property is set to '$', but its purpose isn't immediately clear to someone unfamiliar with the codebase. A brief comment explaining how this character is used in AST queries would improve maintainability.packages/javascript/package.json (2)
4-4
: Add a package description.The description field is empty. Consider adding a brief description of what this package does, such as "JavaScript language support for ast-grep" to improve discoverability and provide context.
22-22
: Add author information.The author field is empty. Consider adding the author's name, email, or organization to properly attribute the package.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
packages/javascript/README.md
(1 hunks)packages/javascript/index.d.ts
(1 hunks)packages/javascript/index.js
(1 hunks)packages/javascript/nursery.js
(1 hunks)packages/javascript/package.json
(1 hunks)packages/javascript/postinstall.js
(1 hunks)
🔇 Additional comments (7)
packages/javascript/postinstall.js (1)
1-4
: Looks good!The postinstall script correctly imports and calls the postinstall function from the
@ast-grep/setup-lang
package, passing the current directory. This is a common pattern for Node.js packages that need to perform setup steps after installation.packages/javascript/nursery.js (1)
1-16
: Testing setup looks good and verifies the JavaScript parsing functionality.The nursery setup correctly configures the testing environment for JavaScript:
- It imports necessary dependencies
- Sets up the test environment with appropriate configuration
- Includes a test runner that verifies the parser can correctly identify a lexical declaration
This follows the pattern used by other language packages in the ast-grep ecosystem.
packages/javascript/index.d.ts (2)
1-7
: Type definition looks good.The
LanguageRegistration
type correctly defines the expected structure for language registration:
- Required properties:
libraryPath
andextensions
- Optional properties:
languageSymbol
,metaVarChar
, andexpandoChar
This type follows the standard pattern used by other language packages and provides clear typing information.
9-10
: Default export is properly typed.The registration constant is correctly typed as
LanguageRegistration
and exported as the default export.packages/javascript/README.md (1)
1-12
: Installation instructions are clear and complete.The README correctly specifies the necessary installation steps for a pnpm project:
- Installing the language package itself
- Installing the required
@ast-grep/napi
dependency- Optional installation of
@tree-sitter/cli
for environments lacking prebuilt binariesThis provides users with the information they need to get started.
packages/javascript/package.json (2)
1-47
: LGTM! Package structure follows npm conventions.The package.json is well-structured with appropriate scripts, dependencies, and configuration for integration into the ast-grep ecosystem. The build process using tree-sitter and the postinstall script for setup follow good practices for native modules.
23-23
:✅ Verification successful
Verify if ISC license is intended.
The package specifies ISC license. Please verify if this matches the license used by other ast-grep packages or if it should be aligned with the project's overall licensing strategy.
🏁 Script executed:
#!/bin/bash # Check licenses of other ast-grep packages echo "Checking licenses of other ast-grep packages:" find . -name "package.json" | grep -v "node_modules" | xargs grep -l "\"license\":" | xargs grep "\"license\":"Length of output: 907
Licensing Consistency Confirmed
The verification shows that the vast majority of the ast-grep subpackages—including packages in Angular, C, C++, C#, Go, Python, SQL, and others—use the ISC license. The packages/javascript/package.json already aligns with this pattern by specifying ISC on line 23. (Note that the root package.json uses MIT, which appears to be an intentional difference in overall licensing strategy.)
Thus, no changes are required regarding the ISC license in packages/javascript.
de054f7
to
6579d68
Compare
6579d68
to
c135b3a
Compare
Summary by CodeRabbit
New Features
Tests
Chores