Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 29 additions & 32 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"name": "Node.js",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm",
"name": "Node.js",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {
// "ghcr.io/devcontainers/features/go:1": {}
// },
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {
// "ghcr.io/devcontainers/features/go:1": {}
// },

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": {
"Configure Build Tools": "npm install -g pnpm"
},
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": {
"Configure Build Tools": "npm install -g pnpm"
},

// Configure tool-specific properties.
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash",
"icon": "terminal-bash"
}
}
},
"extensions": [
"dbaeumer.vscode-eslint",
"dprint.dprint"
]
// Configure tool-specific properties.
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash",
"icon": "terminal-bash"
}
}
},
},
"extensions": ["dbaeumer.vscode-eslint", "dprint.dprint"]
}
},

// More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "node"
// More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "node"
}
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ jobs:
- name: Install dependencies
run: pnpm install --ignore-scripts
- name: Run linting/formatting checks
run: pnpm lint:ci
run: |
pnpm lint:ci
pnpm format:ci
59 changes: 31 additions & 28 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"ignore": []
},
"formatter": {
"enabled": true,
"indentStyle": "tab"
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"ignore": []
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"useTemplate": "off"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
}
},
"javascript": {
"formatter": {
"arrowParentheses": "asNeeded",
"quoteStyle": "single",
"semicolons": "asNeeded",
"trailingCommas": "all"
}
}
}
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "@ast-grep/langs",
"private": true,
"workspaces": [
"packages/*",
"scripts/*"
],
"workspaces": ["packages/*", "scripts/*"],
"version": "0.0.1",
"description": "Monorepo for `@ast-grep/lang-*` packages",
"scripts": {
"postinstall": "pnpm -r compile-ts",
"format": "biome format --write",
"format:ci": "biome format",
"lint": "biome lint --fix",
"lint:ci": "biome lint",
"prepare": "husky"
Expand All @@ -21,8 +20,6 @@
"husky": "9.1.7"
},
"pnpm": {
"onlyBuiltDependencies": [
"tree-sitter-cli"
]
"onlyBuiltDependencies": ["tree-sitter-cli"]
}
}
2 changes: 1 addition & 1 deletion packages/angular/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const libPath = path.join(__dirname, 'parser.so')

module.exports = {
libraryPath: libPath,
extensions: ["html"],
extensions: ['html'],
languageSymbol: 'tree_sitter_angular',
expandoChar: 'z',
}
4 changes: 2 additions & 2 deletions packages/angular/nursery.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ setup({
name: 'angular',
treeSitterPackage: 'tree-sitter-angular',
languageRegistration,
testRunner: (parse) => {
testRunner: parse => {
const a = parse('<div></div>')
const b = a.root().find('<$TAG></$TAG>')
console.log(b.kind(), b.getMatch('TAG').text())
}
},
})
9 changes: 2 additions & 7 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
"src",
"prebuilds"
],
"keywords": [
"ast-grep",
"ast-grep-lang"
],
"keywords": ["ast-grep", "ast-grep-lang"],
"author": "",
"license": "ISC",
"dependencies": {
Expand All @@ -45,8 +42,6 @@
"registry": "https://registry.npmjs.org/"
},
"pnpm": {
"onlyBuiltDependencies": [
"tree-sitter-cli"
]
"onlyBuiltDependencies": ["tree-sitter-cli"]
}
}
2 changes: 1 addition & 1 deletion packages/c/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const libPath = path.join(__dirname, 'parser.so')

module.exports = {
libraryPath: libPath,
extensions: ["c","h"],
extensions: ['c', 'h'],
languageSymbol: 'tree_sitter_c',
expandoChar: '_',
}
4 changes: 2 additions & 2 deletions packages/c/nursery.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ setup({
name: 'c',
treeSitterPackage: 'tree-sitter-c',
languageRegistration,
testRunner: (parse) => {
testRunner: parse => {
const sg = parse('int a = 123;')
const root = sg.root()
const node = root.find('$T $A = 123')
assert.equal(node.kind(), 'declaration')
}
},
})
10 changes: 2 additions & 8 deletions packages/c/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
"src",
"prebuilds"
],
"keywords": [
"ast-grep",
"ast-grep-lang"
],
"keywords": ["ast-grep", "ast-grep-lang"],
"author": "",
"license": "ISC",
"dependencies": {
Expand All @@ -45,9 +42,6 @@
"registry": "https://registry.npmjs.org/"
},
"pnpm": {
"onlyBuiltDependencies": [
"@ast-grep/lang-c",
"tree-sitter-cli"
]
"onlyBuiltDependencies": ["@ast-grep/lang-c", "tree-sitter-cli"]
}
}
2 changes: 1 addition & 1 deletion packages/cpp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const libPath = path.join(__dirname, 'parser.so')

module.exports = {
libraryPath: libPath,
extensions: ["cc","hpp","cpp","hh","cxx","cu","ino"],
extensions: ['cc', 'hpp', 'cpp', 'hh', 'cxx', 'cu', 'ino'],
languageSymbol: 'tree_sitter_cpp',
expandoChar: '_',
}
4 changes: 2 additions & 2 deletions packages/cpp/nursery.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ setup({
name: 'cpp',
treeSitterPackage: 'tree-sitter-cpp',
languageRegistration,
testRunner: (parse) => {
testRunner: parse => {
const sg = parse(`
template <typename T>
T add(T a, T b) {
Expand All @@ -22,5 +22,5 @@ setup({
const root = sg.root()
const node = root.find('$T $A = 123')
assert.equal(node.kind(), 'declaration')
}
},
})
10 changes: 2 additions & 8 deletions packages/cpp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
"src",
"prebuilds"
],
"keywords": [
"ast-grep",
"ast-grep-lang"
],
"keywords": ["ast-grep", "ast-grep-lang"],
"author": "",
"license": "ISC",
"dependencies": {
Expand All @@ -45,9 +42,6 @@
"registry": "https://registry.npmjs.org/"
},
"pnpm": {
"onlyBuiltDependencies": [
"@ast-grep/lang-cpp",
"tree-sitter-cli"
]
"onlyBuiltDependencies": ["@ast-grep/lang-cpp", "tree-sitter-cli"]
}
}
2 changes: 1 addition & 1 deletion packages/csharp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const libPath = path.join(__dirname, 'parser.so')

module.exports = {
libraryPath: libPath,
extensions: ["cs"],
extensions: ['cs'],
languageSymbol: 'tree_sitter_c_sharp',
expandoChar: 'µ',
}
4 changes: 2 additions & 2 deletions packages/csharp/nursery.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ setup({
name: 'csharp',
treeSitterPackage: 'tree-sitter-c-sharp',
languageRegistration,
testRunner: (parse) => {
testRunner: parse => {
const sg = parse('var a = 123;')
const root = sg.root()
const node = root.find('var $A = 123')
assert.equal(node.kind(), 'variable_declaration')
}
},
})
10 changes: 2 additions & 8 deletions packages/csharp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
"src",
"prebuilds"
],
"keywords": [
"ast-grep",
"ast-grep-lang"
],
"keywords": ["ast-grep", "ast-grep-lang"],
"author": "",
"license": "ISC",
"dependencies": {
Expand All @@ -45,9 +42,6 @@
"registry": "https://registry.npmjs.org/"
},
"pnpm": {
"onlyBuiltDependencies": [
"@ast-grep/lang-csharp",
"tree-sitter-cli"
]
"onlyBuiltDependencies": ["@ast-grep/lang-csharp", "tree-sitter-cli"]
}
}
2 changes: 1 addition & 1 deletion packages/python/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const libPath = path.join(__dirname, 'parser.so')

module.exports = {
libraryPath: libPath,
extensions: ["py"],
extensions: ['py'],
languageSymbol: 'tree_sitter_python',
expandoChar: 'µ',
}
4 changes: 2 additions & 2 deletions packages/python/nursery.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ setup({
name: 'python',
treeSitterPackage: 'tree-sitter-python',
languageRegistration,
testRunner: (parse) => {
testRunner: parse => {
const sg = parse('a = 123')
const root = sg.root()
const node = root.find('$FIELD = 123')
assert.equal(node.kind(), 'assignment')
}
},
})
10 changes: 2 additions & 8 deletions packages/python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
"src",
"prebuilds"
],
"keywords": [
"ast-grep",
"ast-grep-lang"
],
"keywords": ["ast-grep", "ast-grep-lang"],
"author": "",
"license": "ISC",
"dependencies": {
Expand All @@ -45,9 +42,6 @@
"registry": "https://registry.npmjs.org/"
},
"pnpm": {
"onlyBuiltDependencies": [
"@ast-grep/lang-python",
"tree-sitter-cli"
]
"onlyBuiltDependencies": ["@ast-grep/lang-python", "tree-sitter-cli"]
}
}
Loading