umi-lint
raw JSON → 2.0.2 verified Fri May 01 auth: no javascript
Configless lint tool that bundles eslint, tslint, stylelint, prettier, lint-staged, and husky into a single zero-config command-line interface. Version 2.0.2 is the latest stable release, with an active maintenance status. It simplifies code quality and formatting by reducing the number of dependencies and configuration files needed for a typical linting setup. Key differentiator: provides a unified CLI that supports linting entire directories, only staged files (via --staged), and integrates multiple linters and formatters with a single command.
Common errors
error Error: No eslint configuration found ↓
cause Missing .eslintrc file in project root
fix
Create .eslintrc file (e.g., .eslintrc.json) with basic configuration.
error Cannot find module 'umi-lint' ↓
cause umi-lint not installed or not in node_modules
fix
Run npm install umi-lint --save-dev or use npx umi-lint.
error Error: --staged requires a git repository ↓
cause Not inside a git repository
fix
Initialize git with 'git init' or run the command inside a git repository.
error Error: Unknown option: --eslint.ext='.ts,.tsx' ↓
cause Using equals sign for sub-parameters instead of dot notation
fix
Use --eslint.ext '.ts,.tsx' or --eslint.ext=.ts,.tsx (no space before value) but prefer dot notation: --eslint.ext='.ts,.tsx'.
Warnings
gotcha umi-lint does not include its own configuration; you must create .eslintrc, .stylelintrc, and .prettierrc files manually. ↓
fix Create configuration files in project root as documented by each linter.
gotcha The --eslint flag does not automatically detect TypeScript files; you must specify --eslint.ext='.ts,.tsx' to lint TypeScript. ↓
fix Use umi-lint --eslint --eslint.ext='.ts,.tsx' or pass options via dot notation: --eslint.ext='.ts,.tsx'.
gotcha When using --staged, the tool only lints files that are staged in git; ensure you have staged changes before running. ↓
fix Run 'git add' to stage files before executing umi-lint --staged.
deprecated tslint is bundled but deprecated by the TypeScript team; recommend using eslint with TypeScript parsers instead. ↓
fix Use --eslint instead of --tslint and configure eslint with @typescript-eslint/parser.
gotcha Options with sub-parameters must use dot notation, e.g., --eslint.debug or -s.formatter=json; incorrect syntax like --eslint-debug may be ignored. ↓
fix Ensure sub-parameters are passed with dots: --eslint.debug, -s.formatter=json, -p.no-semi.
Install
npm install umi-lint yarn add umi-lint pnpm add umi-lint Imports
- umi-lint wrong
import umi-lint from 'umi-lint'correctnpx umi-lint [options] - umi-lint (direct require)
const umiLint = require('umi-lint') - umi-lint (ESM) wrong
import { umiLint } from 'umi-lint'correctimport umiLint from 'umi-lint'
Quickstart
// Add to package.json scripts:
"lint": "umi-lint --eslint src/",
"prepare": "umi-lint --staged --eslint --stylelint --prettier --fix"
// Run lint:
npm run lint