{"id":25962,"library":"mrm-task-lint-staged","title":"mrm-task-lint-staged","description":"Mrm task that automates adding lint-staged configuration, pre-commit hooks, and dependencies to a JavaScript/TypeScript project. Version 7.1.22 is stable and maintained as part of the Mrm monorepo. Released alongside other Mrm tasks every few months. Supports ESLint, Prettier, and Stylelint; infers file extensions from existing npm scripts. Configures lint-staged within package.json and sets up a Git pre-commit hook using husky or similar. Offers customizable rules via the `lintStagedRules` option. Targeted at developers using Mrm for project scaffolding, contrasting with manual setup or other task runners.","status":"active","version":"7.1.22","language":"javascript","source_language":"en","source_url":"https://github.com/sapegin/mrm","tags":["javascript","mrm","mrm-task","lint-staged","lint"],"install":[{"cmd":"npm install mrm-task-lint-staged","lang":"bash","label":"npm"},{"cmd":"yarn add mrm-task-lint-staged","lang":"bash","label":"yarn"},{"cmd":"pnpm add mrm-task-lint-staged","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core Mrm library required for config file editing and dependency installation.","package":"mrm-core","optional":false}],"imports":[{"note":"Mrm tasks are run via the Mrm CLI, not imported directly. No JavaScript API to import.","wrong":"Requiring this package directly in code","symbol":"package.json","correct":"Run via `npx mrm lint-staged`"},{"note":"task is not a module export; use mrm-core's config functions.","wrong":"import task from 'mrm-task-lint-staged'","symbol":"mrm.config","correct":"import { config } from 'mrm-core'"},{"note":"No named exports; the task is invoked via CLI.","wrong":"import { lintStaged } from 'mrm-task-lint-staged'","symbol":"mrm.task","correct":"npx mrm lint-staged"}],"quickstart":{"code":"npx mrm lint-staged","lang":"javascript","description":"Run the Mrm task for lint-staged. This will create or update package.json with lint-staged config, install lint-staged, and set up a pre-commit hook. Requires npm scripts (e.g., 'lint') to infer rules. Custom rules can be passed via project config."},"warnings":[{"fix":"Use lintStagedRules option to explicitly set rules and prevent overwriting.","message":"Inferring extensions from npm scripts may override manual changes on re-run.","severity":"deprecated","affected_versions":">=1.0"},{"fix":"Manually add custom rules via lintStagedRules option.","message":"Only supports Prettier, ESLint, and Stylelint; other linters are not detected.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure husky is installed; otherwise, manually configure hooks.","message":"Task assumes husky is used for Git hooks; other hook managers may not be set up automatically.","severity":"gotcha","affected_versions":"all"},{"fix":"Add relevant lint scripts before running the task, or specify rules via options.","message":"If no npm lint scripts exist, no rules are added. Task will create empty config.","severity":"gotcha","affected_versions":"all"},{"fix":"Review CHANGELOG.md before upgrading.","message":"Version 7.x may have breaking changes from 6.x; check changelog for migration.","severity":"breaking","affected_versions":">=7.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add appropriate npm scripts, e.g., 'lint': 'eslint .', then re-run the task.","cause":"No lint scripts (e.g., 'eslint', 'prettier') detected in package.json.","error":"No lint-staged rules were created after running `npx mrm lint-staged`"},{"fix":"Install mrm-core: `npm install -g mrm-core` or `npx mrm-core lint-staged` (if bundled).","cause":"mrm-core not installed globally or locally.","error":"Error: Cannot find module 'mrm-core'"},{"fix":"Install mrm and the task: `npm install -g mrm mrm-task-lint-staged`.","cause":"mrm-task-lint-staged package not installed or mrm version incompatible.","error":"Error: Task 'lint-staged' is not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}