Skip to content

Commit 59144d0

Browse files
chore: repo setup.
0 parents  commit 59144d0

11 files changed

+5298
-0
lines changed

.github/workflows/ci.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
ci:
13+
name: CI
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4.2.2
18+
- name: Setup Node
19+
uses: actions/setup-node@v4.3.0
20+
with:
21+
node-version: '22.14.0'
22+
- name: Install Dependencies
23+
run: npm ci
24+
- name: Save error log
25+
uses: actions/upload-artifact@v4.6.2
26+
if: ${{ failure() }}
27+
with:
28+
name: npm-debug-log-${{ hashFiles('package-lock.json') }}
29+
path: npm-debug.log
30+
- name: Lint
31+
run: npm run lint
32+
- name: Pack
33+
run: npm pack

.github/workflows/publish.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
if: contains('["knightedcodemonkey"]', github.actor)
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4.2.2
14+
- name: Setup Node
15+
uses: actions/setup-node@v4.3.0
16+
with:
17+
node-version: '22.14.0'
18+
- name: Install Dependencies
19+
run: npm ci
20+
- name: Save error log
21+
uses: actions/upload-artifact@v4.6.2
22+
if: ${{ failure() }}
23+
with:
24+
name: npm-debug-log-${{ hashFiles('package-lock.json') }}
25+
path: npm-debug.log
26+
- name: Lint
27+
run: npm run lint
28+
- name: Pack
29+
run: npm pack
30+
- name: Push to NPM registry
31+
uses: JS-DevTools/npm-publish@v3.1.1
32+
with:
33+
token: ${{ secrets.NPM_AUTH_TOKEN }}
34+
access: public

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
coverage
4+
*.tgz

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 KCM
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# [`@knighted/walk`](https://www.npmjs.com/package/@knighted/walk)
2+
3+
![CI](https://github.com/knightedcodemonkey/walk/actions/workflows/ci.yml/badge.svg)
4+
[![NPM version](https://img.shields.io/npm/v/@knighted/walk.svg)](https://www.npmjs.com/package/@knighted/walk)
5+
6+
Walk an [`oxc-parser`](https://www.npmjs.com/package/oxc-parser) AST with nodes typed correctly.
7+
8+
Same API as [`estree-walker`](https://www.npmjs.com/package/estree-walker).
9+
10+
```ts
11+
import { parseSync } from 'oxc-parser'
12+
import { walk } from '@knighted/walk'
13+
14+
const ast = parseSync('file.ts', code)
15+
16+
walk(ast, {
17+
enter(node) {
18+
// node is correctly typed
19+
},
20+
})
21+
```

babel.config.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"targets": "node >= 20",
3+
"comments": false,
4+
"presets": [
5+
[
6+
"@babel/preset-env",
7+
{
8+
"modules": false
9+
}
10+
],
11+
"@babel/preset-typescript"
12+
]
13+
}

eslint.config.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import eslint from '@eslint/js'
2+
import tseslint from 'typescript-eslint'
3+
import nodePlugin from 'eslint-plugin-n'
4+
5+
export default tseslint.config(
6+
eslint.configs.recommended,
7+
nodePlugin.configs['flat/recommended'],
8+
...tseslint.configs.recommended,
9+
{
10+
rules: {
11+
'no-console': 'error',
12+
'n/no-missing-import': [
13+
'error',
14+
{
15+
allowModules: ['estree'],
16+
},
17+
],
18+
},
19+
},
20+
)

0 commit comments

Comments
 (0)