Skip to content
Merged
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
46 changes: 46 additions & 0 deletions .github/workflows/benchmark-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Benchmark CLI

on:
workflow_call:

jobs:
benchmark-cli:
name: Run CLI benchmarks
runs-on: ubuntu-22.04
permissions:
contents: read
id-token: write
env:
GOMAXPROCS: 8
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
submodules: true
fetch-depth: 1

- name: Setup Go
uses: ./.github/actions/setup-go
with:
go-version: '1.26.0'
cache-name: benchmark-cli

- name: Setup Node.js
uses: ./.github/actions/setup-node

- name: Build JS package
run: pnpm --filter @rslint/core run build

- name: Run CLI benchmarks
uses: CodSpeedHQ/action@d872884a306dd4853acf0f584f4b706cf0cc72a2
timeout-minutes: 30
env:
RAYON_NUM_THREADS: 1
CODSPEED_EXPERIMENTAL_FAIR_SCHED: true
GH_MATRIX: '${{ toJson(matrix) }}'
GH_STRATEGY: '${{ toJson(strategy) }}'
with:
mode: walltime
run: pnpm run bench:cli
runner-version: 4.13.0
go-runner-version: 1.1.0
33 changes: 33 additions & 0 deletions .github/workflows/benchmark-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Benchmark Go

on:
workflow_call:

jobs:
benchmark-go:
name: Run Go benchmarks
runs-on: ubuntu-22.04
permissions:
contents: read
id-token: write
env:
GOMAXPROCS: 8
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
submodules: true
fetch-depth: 1

- name: Setup Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version: '1.26.0'
cache: false

- name: Run benchmarks
uses: CodSpeedHQ/action@d872884a306dd4853acf0f584f4b706cf0cc72a2
with:
mode: walltime
run: go test -bench=. -benchtime=5s ./tests/bench-go/
go-runner-version: 1.1.0
24 changes: 24 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Benchmarks

on:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
benchmark-go:
permissions:
contents: read
id-token: write
uses: ./.github/workflows/benchmark-go.yml

benchmark-cli:
permissions:
contents: read
id-token: write
uses: ./.github/workflows/benchmark-cli.yml
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,21 @@ jobs:

- name: Run tests
run: cargo test --verbose

benchmark-go:
if: ${{ startsWith(github.ref_name, 'chore/release-') || startsWith(github.head_ref, 'chore/release-') }}
permissions:
contents: read
id-token: write
uses: ./.github/workflows/benchmark-go.yml

benchmark-cli:
if: ${{ startsWith(github.ref_name, 'chore/release-') || startsWith(github.head_ref, 'chore/release-') }}
permissions:
contents: read
id-token: write
uses: ./.github/workflows/benchmark-cli.yml

done:
needs:
- test-go
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,12 @@ npm/tsgo/*/local
## vscode settings
.vscode/settings.json


# go cache
packages/rslint/pkg/

# rust
target/

# generated rule manifest
website/generated/
website/generated/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<a href="https://npmjs.com/package/@rslint/core?activeTab=readme"><img src="https://img.shields.io/npm/v/@rslint/core?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" /></a>
<a href="https://npmcharts.com/compare/@rslint/core?minimal=true"><img src="https://img.shields.io/npm/dm/@rslint/core.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
<a href="https://github.com/web-infra-dev/rslint/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" /></a>
<a href="https://codspeed.io/web-infra-dev/rslint?utm_source=badge"><img src="https://img.shields.io/endpoint?url=https://codspeed.io/badge.json" alt="CodSpeed"/></a>
</p>

> [!NOTE]
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"build": "pnpm -r --filter=!@typescript/api --filter=!@typescript/ast --filter=@rslint/test-tools... --filter=rslint... build",
"build:npm": "zx scripts/build-npm.mjs",
"build:website": "pnpm --filter @rslint/core run build:js && pnpm --filter=!@typescript/api --filter=!@typescript/ast --filter=!@rslint/core --filter @rslint/website... -r build",
"bench:cli": "pnpm --filter rslint-bench-cli run bench",
"bench:go": "go test -bench=. -benchtime=5s ./tests/bench-go/",
"check-spell": "pnpx cspell lint --no-progress --show-context",
"version": "zx scripts/version.mjs",
"release": "pnpm publish -r --no-git-checks",
Expand Down
19 changes: 19 additions & 0 deletions packages/rslint/tests/api.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,25 @@ describe('lint api', async (t) => {
});
expect(diags).toMatchSnapshot();
});

test('explicit files filter limits lint scope', async () => {
const config = path.resolve(import.meta.dirname, '../fixtures/rslint.json');
const targetFile = path.resolve(cwd, 'src/index.ts');
const diags = await lint({
config,
files: [targetFile],
ruleOptions: {
'@typescript-eslint/no-unsafe-member-access': 'error',
},
workingDirectory: cwd,
});

expect(diags.fileCount).toBe(1);
expect(diags.diagnostics.length).toBeGreaterThan(0);
expect(new Set(diags.diagnostics.map((diag) => diag.filePath))).toEqual(
new Set(['src/index.ts']),
);
});
});

describe('applyFixes api', async (t) => {
Expand Down
Loading
Loading