@aia-sg/fmt v1.0.0
@aia-sg/fmt
Main goal is to have formatting without hassle like rustfmt/cargo fmt or gofmt/go fmt.
Installation & Usage
fmt [PATTERN ...]With PATTERN being:
- file
- directory
- glob
Running without specifying PATTERN would run as if PATTERN is . (fmt .),
and would run recursively on all file within current directories.
Example:
fmt index.js src lib/*.jsThis would format index.js,
all supported files inside src/,
and all .js files inside lib/.
Install it with:
npm install --save-dev @aia-sg/fmtThen use it:
./node_modules/.bin/fmt [PATTERN ...]You can also put it in package.json scripts:
{
  "scripts": {
    "fmt": "@aia-sg/fmt"
  }
}And run it like:
npm run fmt [PATTERN ...]Note:
npx cannot be used because eslint require plugin to be installed.
Read more about it here.
Running eslint yourself / Extending (Optional)
fmt job is just to format.
If you want to know what the eslint error is, you need to run it yourself.
eslint:
You need to use JS config instead of JSON/YAML.
Put this in your .eslintrc.js:
module.exports = require("@aia-sg/fmt").eslint;Or, if you want to extend it with your own config:
module.exports = {
  ...require("@aia-sg/fmt").eslint,
};prettier:
Same as eslint.
You need to use JS config instead of JSON/YAML.
Put this in your .prettierrc.js:
module.exports = require("@aia-sg/fmt").prettier;