🔧 Replace ESLint and Prettier with oxlint and oxfmt
- Drop .eslintrc.cjs and .prettierrc, add .oxlintrc.json and .oxfmtrc.json - oxlint covers correctness/suspicious/perf/style/restriction categories plus import and typescript plugins; oxfmt reads the same .prettierrc-style options we had before - Update lefthook.yml pre-commit jobs to run oxlint/oxfmt instead of eslint/prettier - Update .vscode/extensions.json (oxc replaces eslint/prettier/vitest) and settings.json (oxc becomes the default formatter for TS/JS) - Add 'oxlint', 'oxfmt', 'oxc', 'nodenext' to cspell dictionary - Rewrite README 'Development' section to describe the new toolchain
This commit is contained in:
1 parent
3530262261
commit
078a8c30fd
11 files changed
+130
-130
No files matched your search
@@ -1,37 +0,0 @@
|
|||||||
// .eslintrc.cjs
|
|
||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
parser: "@typescript-eslint/parser",
|
|
||||||
plugins: [
|
|
||||||
"@typescript-eslint",
|
|
||||||
"import",
|
|
||||||
"unused-imports",
|
|
||||||
"simple-import-sort",
|
|
||||||
],
|
|
||||||
extends: [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"plugin:@typescript-eslint/strict-type-checked",
|
|
||||||
"plugin:@typescript-eslint/stylistic-type-checked",
|
|
||||||
"plugin:import/recommended",
|
|
||||||
"plugin:import/typescript",
|
|
||||||
"plugin:prettier/recommended",
|
|
||||||
],
|
|
||||||
env: {
|
|
||||||
es2022: true,
|
|
||||||
node: true,
|
|
||||||
browser: true,
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
"prettier/prettier": "error",
|
|
||||||
"import/order": "off",
|
|
||||||
"simple-import-sort/imports": "error",
|
|
||||||
"simple-import-sort/exports": "error",
|
|
||||||
"unused-imports/no-unused-imports": "error",
|
|
||||||
"@typescript-eslint/no-unused-vars": [
|
|
||||||
"error",
|
|
||||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
ignorePatterns: ["dist", "node_modules", "public"],
|
|
||||||
};
|
|
||||||
@@ -6,4 +6,4 @@
|
|||||||
"tabWidth": 4,
|
"tabWidth": 4,
|
||||||
"endOfLine": "lf",
|
"endOfLine": "lf",
|
||||||
"arrowParens": "always"
|
"arrowParens": "always"
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||||
|
"plugins": [
|
||||||
|
"typescript",
|
||||||
|
"unicorn",
|
||||||
|
"oxc",
|
||||||
|
"import"
|
||||||
|
],
|
||||||
|
"categories": {
|
||||||
|
"correctness": "error",
|
||||||
|
"suspicious": "error",
|
||||||
|
"perf": "warn",
|
||||||
|
"style": "warn",
|
||||||
|
"restriction": "error",
|
||||||
|
"nursery": "off"
|
||||||
|
},
|
||||||
|
"rules": {},
|
||||||
|
"env": {
|
||||||
|
"builtin": true,
|
||||||
|
"es2024": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["**/*.test.ts"],
|
||||||
|
"rules": {
|
||||||
|
"no-unused-expressions": "off",
|
||||||
|
"no-empty-file": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ignorePatterns": ["dist", "node_modules", "coverage"]
|
||||||
|
}
|
||||||
Vendored
+2
-4
@@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"esbenp.prettier-vscode",
|
"oxc.oxc-vscode",
|
||||||
"dbaeumer.vscode-eslint",
|
|
||||||
"streetsidesoftware.code-spell-checker",
|
"streetsidesoftware.code-spell-checker",
|
||||||
"vitest.explorer",
|
|
||||||
"ms-vscode.vscode-typescript-next"
|
"ms-vscode.vscode-typescript-next"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Vendored
+8
-8
@@ -1,7 +1,11 @@
|
|||||||
{
|
{
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"[typescript]": {
|
"[typescript]": {
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "oxc.oxc-vscode",
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[javascript]": {
|
||||||
|
"editor.defaultFormatter": "oxc.oxc-vscode",
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true
|
||||||
},
|
},
|
||||||
"[json]": {
|
"[json]": {
|
||||||
@@ -12,10 +16,6 @@
|
|||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true
|
||||||
},
|
},
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "oxc.oxc-vscode",
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true
|
||||||
"[javascript]": {
|
}
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
||||||
"editor.formatOnSave": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,20 +7,38 @@ Pattern matching for TypeScript/ESM environments (F#-style, not regex).
|
|||||||
- **Build:** `npm run build`
|
- **Build:** `npm run build`
|
||||||
- **Test:** `npm run test`, `npm run test:ci`
|
- **Test:** `npm run test`, `npm run test:ci`
|
||||||
- **Checks:** `npm run check`, `npm run fix`
|
- **Checks:** `npm run check`, `npm run fix`
|
||||||
|
- **Format/Fix:** `npm run fix:oxfmt`, `npm run fix:oxlint`
|
||||||
|
|
||||||
|
### Tooling
|
||||||
|
|
||||||
|
- **TypeScript 7** — type checker and build (`tsc`).
|
||||||
|
- **node --test** + `--experimental-strip-types` — test runner (Node 22.6+, flag dropped on Node 24).
|
||||||
|
- **c8** — code coverage for `test:ci`.
|
||||||
|
- **oxlint** — Rust-based linter.
|
||||||
|
- **oxfmt** — Rust-based formatter (Prettier-compatible).
|
||||||
|
- **cspell** — spell checking.
|
||||||
|
- **sort-package-json** — keep `package.json` keys alphabetized.
|
||||||
|
- **lefthook** — git pre-commit hooks.
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
|
- Node.js >= 22.6 (>= 24 recommended; `--experimental-strip-types` is unflagged on 24).
|
||||||
|
|
||||||
## VSCode integration
|
## VSCode integration
|
||||||
|
|
||||||
- Debugging
|
- Recommended extensions: see `.vscode/extensions.json` (oxc, cspell).
|
||||||
- Running tests
|
- TypeScript 7 is used via `typescript.tsdk` pointing at `node_modules/typescript/lib`.
|
||||||
|
- oxc extension provides oxlint squiggles and oxfmt format-on-save.
|
||||||
|
|
||||||
## Workflows
|
## Workflows
|
||||||
|
|
||||||
- Version updates
|
- Version updates via `npm version`.
|
||||||
- Changelog automation
|
- Publishing via GitHub Actions on tagged commits (see `.github/workflows/ci.yml`).
|
||||||
- Publishing
|
- Changesets is available as a devDependency for changelog automation if desired.
|
||||||
|
|
||||||
## Contribution guidelines
|
## Contribution guidelines
|
||||||
|
|
||||||
- Commit signing (GPG)
|
- Commit signing (GPG).
|
||||||
- How to set up commit message template
|
- Set up commit message template: `npm run use:git-commit-message`.
|
||||||
- Reference to commit-message-template
|
- See `commit-message-template`.
|
||||||
|
- Type-only tests use `expect-type`'s `expectTypeOf(...)` inside `node --test` cases.
|
||||||
+11
-2
@@ -1,6 +1,15 @@
|
|||||||
{
|
{
|
||||||
"version": "0.2",
|
"version": "0.2",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"words": ["tslib", "typefest", "lefthook"],
|
"words": [
|
||||||
|
"tslib",
|
||||||
|
"typefest",
|
||||||
|
"lefthook",
|
||||||
|
"oxlint",
|
||||||
|
"oxfmt",
|
||||||
|
"oxc",
|
||||||
|
"nodenext",
|
||||||
|
"nocheck"
|
||||||
|
],
|
||||||
"ignorePaths": ["dist", "node_modules", "public", "coverage", "*.svg"]
|
"ignorePaths": ["dist", "node_modules", "public", "coverage", "*.svg"]
|
||||||
}
|
}
|
||||||
+21
-45
@@ -1,45 +1,21 @@
|
|||||||
# EXAMPLE USAGE:
|
pre-commit:
|
||||||
#
|
parallel: true
|
||||||
# Refer for explanation to following link:
|
jobs:
|
||||||
# https://lefthook.dev/configuration/
|
- name: oxlint
|
||||||
#
|
glob: "*.{ts,tsx,js,jsx,mjs,cjs}"
|
||||||
# pre-push:
|
run: npx oxlint {staged_files}
|
||||||
# jobs:
|
- name: oxfmt
|
||||||
# - name: packages audit
|
glob: "*.{ts,tsx,js,jsx,mjs,cjs}"
|
||||||
# tags:
|
run: npx oxfmt --check {staged_files}
|
||||||
# - frontend
|
- name: cspell
|
||||||
# - security
|
run: npx cspell {staged_files}
|
||||||
# run: yarn audit
|
- name: sort-package-json
|
||||||
#
|
run: npx sort-package-json --check
|
||||||
# - name: gems audit
|
- name: typecheck
|
||||||
# tags:
|
run: npx tsc --noEmit
|
||||||
# - backend
|
- name: outdated
|
||||||
# - security
|
run: npx check-outdated
|
||||||
# run: bundle audit
|
|
||||||
#
|
|
||||||
# pre-commit:
|
|
||||||
# parallel: true
|
|
||||||
# jobs:
|
|
||||||
# - run: yarn eslint {staged_files}
|
|
||||||
# glob: "*.{js,ts,jsx,tsx}"
|
|
||||||
#
|
|
||||||
# - name: rubocop
|
|
||||||
# glob: "*.rb"
|
|
||||||
# exclude:
|
|
||||||
# - config/application.rb
|
|
||||||
# - config/routes.rb
|
|
||||||
# run: bundle exec rubocop --force-exclusion {all_files}
|
|
||||||
#
|
|
||||||
# - name: govet
|
|
||||||
# files: git ls-files -m
|
|
||||||
# glob: "*.go"
|
|
||||||
# run: go vet {files}
|
|
||||||
#
|
|
||||||
# - script: "hello.js"
|
|
||||||
# runner: node
|
|
||||||
#
|
|
||||||
# - script: "hello.go"
|
|
||||||
# runner: go run
|
|
||||||
commands:
|
commands:
|
||||||
typecheck:
|
typecheck:
|
||||||
run: npm run check:tsc
|
run: npm run check:tsc
|
||||||
@@ -48,8 +24,8 @@ commands:
|
|||||||
sort:
|
sort:
|
||||||
run: npm run check:package
|
run: npm run check:package
|
||||||
lint:
|
lint:
|
||||||
run: npm run check:eslint
|
run: npm run check:oxlint
|
||||||
format:
|
format:
|
||||||
run: npm run check:prettier
|
run: npm run check:oxfmt
|
||||||
outdated:
|
outdated:
|
||||||
run: npm run check:outdated
|
run: npm run check:outdated
|
||||||
Generated
+2
-2
@@ -9,6 +9,8 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@oxfmt/binding-linux-x64-musl": "^0.66.0",
|
||||||
|
"@oxlint/binding-linux-x64-musl": "^1.81.0",
|
||||||
"@types/node": "^22.10.0",
|
"@types/node": "^22.10.0",
|
||||||
"c8": "^10.1.3",
|
"c8": "^10.1.3",
|
||||||
"check-outdated": "^2.13.0",
|
"check-outdated": "^2.13.0",
|
||||||
@@ -906,7 +908,6 @@
|
|||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"os": [
|
"os": [
|
||||||
"linux"
|
"linux"
|
||||||
],
|
],
|
||||||
@@ -1210,7 +1211,6 @@
|
|||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"os": [
|
"os": [
|
||||||
"linux"
|
"linux"
|
||||||
],
|
],
|
||||||
|
|||||||
+25
-23
@@ -10,51 +10,47 @@
|
|||||||
"adt",
|
"adt",
|
||||||
"typescript"
|
"typescript"
|
||||||
],
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/tmueller/tiny-pattern-ts.git"
|
||||||
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"engines": {
|
"type": "module",
|
||||||
"node": ">=22.6"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"main": "./dist/index.js",
|
|
||||||
"types": "./dist/index.d.ts",
|
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"import": "./dist/index.js"
|
"import": "./dist/index.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
"README.md",
|
"README.md",
|
||||||
"LICENSE"
|
"LICENSE"
|
||||||
],
|
],
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/tmueller/tiny-pattern-ts.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc -p tsconfig.build.json",
|
"build": "tsc -p tsconfig.build.json",
|
||||||
"clean": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\"",
|
|
||||||
"test": "npm run check:tsc && node --test --experimental-strip-types --no-warnings src/",
|
|
||||||
"test:unit": "node --test --experimental-strip-types --no-warnings src/",
|
|
||||||
"test:ci": "c8 --reporter=text --reporter=lcov --reporter=html node --test --experimental-strip-types --no-warnings src/",
|
|
||||||
"check": "npm run check:oxlint && npm run check:oxfmt && npm run check:tsc && npm run check:cspell && npm run check:package && npm run check:outdated",
|
"check": "npm run check:oxlint && npm run check:oxfmt && npm run check:tsc && npm run check:cspell && npm run check:package && npm run check:outdated",
|
||||||
"check:oxlint": "oxlint src",
|
|
||||||
"check:oxfmt": "oxfmt --check src",
|
|
||||||
"check:tsc": "tsc --noEmit",
|
|
||||||
"check:cspell": "cspell .",
|
"check:cspell": "cspell .",
|
||||||
"check:package": "sort-package-json --check",
|
|
||||||
"check:outdated": "check-outdated",
|
"check:outdated": "check-outdated",
|
||||||
"fix:oxlint": "oxlint --fix src",
|
"check:oxfmt": "oxfmt --check src",
|
||||||
|
"check:oxlint": "oxlint src",
|
||||||
|
"check:package": "sort-package-json --check",
|
||||||
|
"check:tsc": "tsc --noEmit",
|
||||||
|
"clean": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\"",
|
||||||
"fix:oxfmt": "oxfmt src",
|
"fix:oxfmt": "oxfmt src",
|
||||||
|
"fix:oxlint": "oxlint --fix src",
|
||||||
"fix:package": "sort-package-json --write",
|
"fix:package": "sort-package-json --write",
|
||||||
|
"test": "npm run check:tsc && node --test --experimental-strip-types --no-warnings src/",
|
||||||
|
"test:ci": "c8 --reporter=text --reporter=lcov --reporter=html node --test --experimental-strip-types --no-warnings src/",
|
||||||
|
"test:unit": "node --test --experimental-strip-types --no-warnings src/",
|
||||||
"use:git-commit-message": "cp commit-message-template .git/COMMIT_EDITMSG || true"
|
"use:git-commit-message": "cp commit-message-template .git/COMMIT_EDITMSG || true"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@oxfmt/binding-linux-x64-musl": "^0.66.0",
|
||||||
|
"@oxlint/binding-linux-x64-musl": "^1.81.0",
|
||||||
"@types/node": "^22.10.0",
|
"@types/node": "^22.10.0",
|
||||||
"c8": "^10.1.3",
|
"c8": "^10.1.3",
|
||||||
"check-outdated": "^2.13.0",
|
"check-outdated": "^2.13.0",
|
||||||
@@ -66,5 +62,11 @@
|
|||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"type-fest": "^4.40.1",
|
"type-fest": "^4.40.1",
|
||||||
"typescript": "^7.0.2"
|
"typescript": "^7.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=22.6"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -288,6 +288,7 @@ Resolves #...
|
|||||||
- `dbaeumer.vscode-eslint` (ESLint)
|
- `dbaeumer.vscode-eslint` (ESLint)
|
||||||
- `streetsidesoftware.code-spell-checker` (cspell)
|
- `streetsidesoftware.code-spell-checker` (cspell)
|
||||||
- `vitest.explorer` (for test integration)
|
- `vitest.explorer` (for test integration)
|
||||||
|
- TODO: Native test extension with node test runner
|
||||||
- `ms-vscode.vscode-typescript-next` (for latest TS features, optional)
|
- `ms-vscode.vscode-typescript-next` (for latest TS features, optional)
|
||||||
|
|
||||||
- Add `.vscode/tasks.json` for common tasks (optional):
|
- Add `.vscode/tasks.json` for common tasks (optional):
|
||||||
|
|||||||
Reference in new issue
Block a user