Getting started
Requirements
- Node.js
^22.21or>=24.10 - ESLint
^9.24or^10(flat config) - A
package.jsonin your project root
Node floor
The minimum supported Node version is 22. If a project is on something older, upgrade Node rather than pinning old plugin versions — see Versioning.
The fast path: the installer
From the root of your project:
npx eslint-config-mocg initThe wizard will:
- Detect your package manager (from the lockfile) and framework (from your dependencies).
- Ask which stack you're on (pre-selecting the detected one) and which add-ons you want.
- Install
eslint-config-mocgplus any optional plugins your stack needs. - Write an
eslint.config.mjs. - Add
lintandlint:fixscripts to yourpackage.json.
For most projects it's two Enter presses. A Next.js project is detected from its next dependency and offered as its own stack (Next = React + Next rules). See the installer reference for non-interactive flags.
Non-interactive (CI, templates, scripts)
npx eslint-config-mocg init --preset react --extras vitest,zod --yesThe manual path
If you'd rather not run the wizard, install the package and the plugins your stack needs, then write the config yourself.
npm i -D eslint-config-mocg eslintnpm i -D eslint-config-mocg eslint \
eslint-plugin-react eslint-plugin-react-hooksnpm i -D eslint-config-mocg eslint \
@next/eslint-plugin-next \
eslint-plugin-react eslint-plugin-react-hooks \
eslint-plugin-react-refreshnpm i -D eslint-config-mocg eslint \
eslint-plugin-vue vue-eslint-parsernpm i -D eslint-config-mocg eslint \
@darraghor/eslint-plugin-nestjs-typedThen create eslint.config.mjs:
import { mocg } from 'eslint-config-mocg';
export default mocg();mocg() auto-detects your stack. To be explicit:
import { mocg } from 'eslint-config-mocg';
export default mocg({
react: true,
vitest: true,
});Not sure you installed the right plugins? Run the doctor:
npx eslint-config-mocg doctorInstall without a public registry
There is no public registry yet. Both paths work; the package is authored in TypeScript and compiles itself to dist/ on install via the prepare script (for Git installs npm pulls the build devDependencies and runs the build for you):
{
"devDependencies": {
"eslint-config-mocg": "git+ssh://git@github.com/moc-global/eslint-config.git#semver:^2"
}
}# In the config repo (build first; the tarball ships dist/):
npm run build && npm pack # → eslint-config-mocg-2.2.0.tgz
# In your project:
npm i -D ./vendor/eslint-config-mocg-2.2.0.tgzOnce published to a registry, the tarball carries the prebuilt dist/ (with .d.ts) and no install-time build runs.
Run it
npm run lint # or: npx eslint
npm run lint:fix # autofix what can be fixedAdopting into a codebase that already has violations? Don't fix them all at once — see Existing & legacy projects.