Skip to content
Draft
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
54 changes: 54 additions & 0 deletions .github/workflows/ores-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Managed by .ores-lint/ - regenerated by the rollout script.
name: ores-lint

on:
pull_request:
workflow_dispatch:
# Add `push:` here once this repo's lint debt is paid down.

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Detect project types
id: detect
run: |
{ [ -f package.json ] || git ls-files '*.js' '*.mjs' '*.cjs' '*.ts' '*.tsx' | grep -q .; } \
&& echo "js=true" >> "$GITHUB_OUTPUT" || echo "js=false" >> "$GITHUB_OUTPUT"
{ [ -f Cargo.toml ] || git ls-files '*.rs' | grep -q .; } \
&& echo "rs=true" >> "$GITHUB_OUTPUT" || echo "rs=false" >> "$GITHUB_OUTPUT"
{ [ -f pubspec.yaml ] || git ls-files '*.dart' | grep -q .; } \
&& echo "dart=true" >> "$GITHUB_OUTPUT" || echo "dart=false" >> "$GITHUB_OUTPUT"
{ [ -f gleam.toml ] || git ls-files '*.gleam' | grep -q .; } \
&& echo "gleam=true" >> "$GITHUB_OUTPUT" || echo "gleam=false" >> "$GITHUB_OUTPUT"

# Node is the runner for ESLint and for the cross-language require-send
# scanner, so it is installed whenever any supported language is present.
- uses: actions/setup-node@v4
if: steps.detect.outputs.js == 'true' || steps.detect.outputs.rs == 'true' || steps.detect.outputs.dart == 'true' || steps.detect.outputs.gleam == 'true'
with:
node-version: '22'

# ESLint is a global tool here, not a repo dependency - so this job never
# runs `npm install` and never needs the repo's node_modules.
- name: Install eslint globally
if: steps.detect.outputs.js == 'true'
run: npm i -g eslint typescript-eslint

- name: Install clippy
if: steps.detect.outputs.rs == 'true'
run: rustup component add clippy || true

# Dart/Gleam SDKs are optional. When absent, dart.sh / gleam.sh skip
# with an actionable message; require-send.mjs still runs via Node.
- uses: dart-lang/setup-dart@v1
if: steps.detect.outputs.dart == 'true'
continue-on-error: true

- name: Run ores-lint
run: sh .ores-lint/lint.sh
env:
# Warn-only. Set to 1 here to make lint findings fail this repo's CI.
ORES_LINT_STRICT: '0'
11 changes: 11 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// ores-lint house ESLint config.
// Managed by .ores-lint/ - see .ores-lint/README.md before editing.
// Repo-specific tweaks go in the options object below; the rollout script will
// not overwrite this file once you have changed it.
import oresConfig from './.ores-lint/eslint/base.mjs';

export default await oresConfig({
// requireSend: { loggerNames: ['myLogger'], terminalMethods: ['send', 'flush'] },
// rules: { 'no-console': 'warn' },
// ignores: ['**/generated/**'],
});
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
"test:internal": "node --test test/node-test/internal.test.js",
"test:internal:standalone": "node test/internal/linked-list-integrity.js && node test/internal/head-tail-fuzz.js && node test/internal/lookup-consistency.js",
"test:legacy": "node test/src/test-fuzz.js && node test/src/linked-queue-fuzz.js && node test/src/queue-fuzz.js && node test/src/basic-queue-fuzz.js",
"test:all": "npm run test && npm run test:internal:standalone && npm run test:legacy"
"test:all": "npm run test && npm run test:internal:standalone && npm run test:legacy",
"lint:ores": "if [ -f .ores-lint/lint.sh ]; then sh .ores-lint/lint.sh; else echo 'ores-lint not installed'; fi",
"prepublishOnly": "npm run lint:ores",
"prebuild": "npm run lint:ores"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -61,5 +64,13 @@
},
"r2g": {
"test": "node .r2g/tests/phase-contract.cjs --phase-z"
},
"oresLint": {
"note": "Declared, not installed. ores-lint resolves these from a global install - see .ores-lint/README.md",
"requires": {
"eslint": ">=9",
"typescript-eslint": ">=8 (optional; without it .ts files are skipped)"
},
"install": "npm i -g eslint typescript-eslint"
}
}
Loading