mrm-task-lint-staged

7.1.14 • Public • Published

mrm-task-lint-staged

Mrm task that adds lint-staged.

Note: supports only Prettier, ESLint and Stylelint now, pull requests are welcome.

What it does

  • Creates a config in package.json
  • Sets up a pre-commit Git hook
  • Installs dependencies

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.

Usage

npx mrm lint-staged

Options

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.

Changelog

The changelog can be found in CHANGELOG.md.

Contributing

Everyone is welcome to contribute. Please take a moment to review the contributing guidelines.

Authors and license

Artem Sapegin and contributors.

MIT License, see the included License.md file.

Install

npm i mrm-task-lint-staged

DownloadsWeekly Downloads

1,603

Version

7.1.14

License

MIT

Unpacked Size

9.36 kB

Total Files

4

Last publish

Collaborators

  • sapegin