$ npm install mrm-task-lint-staged
Mrm task that adds lint-staged.
Note: supports only Prettier, ESLint and Stylelint now, pull requests are welcome.
package.json
This tasks will try to infer extensions from your npm scripts. For example, if you have lint
script that runs ESLint for js
and ts
files, the task will add lint-staged rule that runs ESLint for the same extensions. And will overwrite an existing rule if you change it manually and run the task again, but it will try to keepy your custom rules.
npx mrm lint-staged
See Mrm docs and lint-staged docs for more details.
lintStagedRules
(default: infer)Overrides and custom rules. By default will try to infer by project dependencies.
For example, a custom extension:
{
"lintStagedRules": {
"eslint": {
"extensions": ["js", "jsx", "mjs"]
}
}
}
Or a custom command:
{
"lintStagedRules": {
"eslint": {
"command": "eslint --fix"
}
}
}
Or you can disable one of the default rules:
{
"lintStagedRules": {
"prettier": {
"enabled": false
}
}
}
Or add a custom rule:
{
"lintStagedRules": {
"jest": {
"extensions": ["js"],
"command": "jest --bail --findRelatedTests"
}
}
}
Available rules are prettier
, eslint
and stylelint
.
The changelog can be found in CHANGELOG.md.
Everyone is welcome to contribute. Please take a moment to review the contributing guidelines.
Artem Sapegin and contributors.
MIT License, see the included License.md file.
© 2010 - cnpmjs.org x YWFE | Home | YWFE