Shared ECMAScript Config (TypeScript, oxlint, oxfmt, optional eslint)
-
Install
pnpm add -D @nihalgonsalves/esconfig typescript oxlint oxlint-tsgolint oxfmt # optionally for react: pnpm add -D eslint -
tsconfig.json{ "extends": "@nihalgonsalves/esconfig/tsconfig.shared.json", "compilerOptions": { "outDir": "./build", "rootDir": "./src" }, "include": ["./src"] } -
copy
.oxlintrc.json -
.oxlintrc.json{ "extends": ["node_modules/@nihalgonsalves/esconfig/.oxlintrc.json"], "options": { "typeAware": true, "typeCheck": true } } -
If you're using React,
eslint.config.js:import tseslint from "typescript-eslint"; import sharedConfig from "@nihalgonsalves/esconfig/eslint.config.react-shared"; export default tseslint.config( { ignores: [] }, ...sharedConfig, // ... others );
-
package.json{ "scripts": { "build": "tsc", "lint": "oxlint --type-aware --report-unused-disable-directives-severity=error && eslint ./src/", "format": "oxfmt", "format:check": "oxfmt --check" } } -
Done! Don't forget to run
build,lintandformat:checkin your CI workflow.