garou

    0.2.0 • Public • Published

    garou

    Do thing what heroes didn't do.

    npm github node

    Features

    A code refactoring tool, fixing what eslint/stylelint shouldn't care about, what prettier didn't care about. Offering better code comparing for git diff.

    • Sort html/htm attributes
    • Sort jsx/tsx props
    • Sort vue component properties / attributes
    • Handle jsx/vue self closing
    • Sort tsx/ts/jsx/js/mjs/cjs class members
    • Sort tsx/ts/jsx/js/mjs/cjs import
    • Sort css/scss/less properties
    • Handle whitespace, empty line between code
    • ...other fixing

    Installation

    npm install garou --save-dev

    Usage

    npx --no-install garou .
    npx --no-install garou src
    npx --no-install garou **/foo.js

    Run without installation

    npx garou .

    Configuration

    // example: package.json
    {
      "garou": {
        "import-groups": [
          // see: https://github.com/lydell/eslint-plugin-simple-import-sort#custom-grouping
          ["react", "react-dom"],
          // shorthand for ["^@external\\/"]
          "^@external\\/",
          "lodash"
        ]
      }
    }

    Tips

    Using garou with lint-staged

    // package.json
    {
      "lint-staged": {
        "*": ["garou", "prettier", "eslint --fix"]
      }
    }

    Using garou might mess up your format, I suggest run garou before run prettier.

    Read more at the lint-staged repo.

    Inspiration

    This project is inspired by sortier.

    Related

    Install

    npm i garou

    DownloadsWeekly Downloads

    91

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    24.5 kB

    Total Files

    12

    Last publish

    Collaborators

    • airkro