Skip to content

Commit e356c0e

Browse files
authored
Add linting and formatting checks for the grammar (#302)
1 parent b6df41d commit e356c0e

11 files changed

Lines changed: 1956 additions & 461 deletions

File tree

‎.editorconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,7 @@ indent_size = 2
4444

4545
[{alloc,array,parser}.h]
4646
indent_size = 2
47+
48+
[test/**.txt]
49+
indent_size = 2
50+
indent_style = space

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ jobs:
1818
os: [ubuntu-latest, windows-2022, macos-latest]
1919
steps:
2020
- name: Checkout repository
21-
uses: actions/checkout@v6
21+
uses: actions/checkout@v7
2222

2323
- name: Set up tree-sitter
2424
uses: tree-sitter/setup-action/cli@v2
2525
with:
26-
tree-sitter-ref: v0.26.10
26+
tree-sitter-ref: v0.26.11
2727

2828
- name: Run tests
2929
uses: tree-sitter/parser-test-action@v3
@@ -34,7 +34,7 @@ jobs:
3434
test-python: true
3535
test-go: true
3636

37-
- name: Run test wild
37+
- name: Run tests wild
3838
if: runner.os != 'Windows'
3939
continue-on-error: true
4040
run: node scripts/test_wild.mjs

‎.github/workflows/gh-pages.yml‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,15 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Checkout repository
22-
uses: actions/checkout@v4
22+
uses: actions/checkout@v7
2323

2424
- name: Setup Node.js
25-
uses: actions/setup-node@v4
25+
uses: actions/setup-node@v6
2626
with:
2727
node-version-file: .nvmrc
2828

29-
# Instruct a C++ compiler to use the C++20 standard
30-
# Required to install tree-sitter dev dependencie
31-
# See # https://github.com/tree-sitter/node-tree-sitter/issues/268
3229
- name: Install dependencies
33-
run: CXXFLAGS="-std=c++20" npm ci
30+
run: npm ci
3431

3532
- name: Build WASM
3633
run: npx tree-sitter build --wasm
@@ -43,10 +40,10 @@ jobs:
4340
sed -i 's|LANGUAGE_BASE_URL = ""|LANGUAGE_BASE_URL = "/tree-sitter-rescript"|' ./public/index.html
4441
4542
- name: Setup Pages
46-
uses: actions/configure-pages@v5
43+
uses: actions/configure-pages@v6
4744

4845
- name: Upload artifact
49-
uses: actions/upload-pages-artifact@v3
46+
uses: actions/upload-pages-artifact@v5
5047
with:
5148
path: ./public
5249

‎.github/workflows/lint.yml‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- grammar.js
8+
pull_request:
9+
paths:
10+
- grammar.js
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v7
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v6
20+
with:
21+
node-version-file: .nvmrc
22+
- name: Install modules
23+
run: npm ci
24+
- name: Run ESLint
25+
run: npm run lint
26+
- name: Checkformat
27+
run: npm run checkformat
28+
- name: Generate parser
29+
run: npm run generate
30+
- name: Check for diffs in parse files
31+
run: git diff --exit-code

‎.nvmrc‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
v24.11.1
1+
# Using v22 due https://github.com/tree-sitter/node-tree-sitter/issues/268
2+
v22

‎eslint.config.mjs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import treesitter from 'eslint-config-treesitter';
2+
3+
export default [
4+
...treesitter,
5+
];

0 commit comments

Comments
 (0)