umi3-plugin-lint
raw JSON → 1.0.2 verified Fri May 01 auth: no javascript maintenance
Umi.js v3 plugin that integrates ESLint, Stylelint, Prettier, Husky, lint-staged, and commitlint into the build and development workflow. Provides commands to generate lint configuration files and run lint tasks. Currently at v1.0.2 with low release cadence (last update 2021). Requires umi@3.x as a peer dependency. Key differentiator: opinionated, one-stop lint setup for Umi projects, wrapping multiple tools under a unified plugin interface.
Common errors
error Error: Cannot find module 'umi3-plugin-lint' ↓
cause Plugin not installed or not listed in plugins config.
fix
Install with 'npm install umi3-plugin-lint --save-dev' and add to '.umirc.ts' plugins array.
error Unknown command: use-lint ↓
cause Command run outside Umi or plugin not registered.
fix
Ensure plugin is in '.umirc.ts' and run 'npx umi use-lint' (not 'npx use-lint').
error Cannot find module 'eslint' ↓
cause ESLint not installed; plugin expects user to install peer deps.
fix
Run 'npm install eslint --save-dev' and other needed linters.
Warnings
breaking Only works with Umi 3.x; not compatible with Umi 4. ↓
fix Use Umi 4's built-in lint or alternative lint plugin.
deprecated Plugin has not been updated since 2021; may not support latest ESLint/Prettier versions. ↓
fix Pin dependency versions or migrate to separate linting setup.
gotcha The 'use-lint' command may override existing prettierrc/eslintrc files. ↓
fix Backup your config files before running 'npx umi use-lint'.
gotcha Husky setup via use-lint may conflict with existing git hooks. ↓
fix Check .husky directory after generation; manually merge hooks.
gotcha '@umijs/fabric' is not automatically installed; user must install it separately for recommended configs. ↓
fix Install '@umijs/fabric' as devDependency if needed.
Install
npm install umi3-plugin-lint yarn add umi3-plugin-lint pnpm add umi3-plugin-lint Imports
- default plugin function wrong
// common mistake: import { lintPlugin } from 'umi3-plugin-lint'correct// .umirc.ts export default { plugins: ['umi3-plugin-lint'] } - commands wrong
// common mistake: npx use-lint (without 'umi')correctnpx umi use-lint - lint and format scripts wrong
// common mistake: running eslint directly without umi wrappercorrect// package.json scripts automatically added "lint": "umi lint"
Quickstart
// 1. Install and add plugin
npm install umi3-plugin-lint --save-dev
// .umirc.ts
export default {
lint: {
eslint: true,
stylelint: true,
},
plugins: ['umi3-plugin-lint']
}
// 2. Generate lint configs
npx umi use-lint
// 3. Run lint
npm run lint