Skip to content

bentinata/fmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@bentinata/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/*.js

This would format index.js, all supported files inside src/, and all .js files inside lib/.

Install it with:

npm install --save-dev @bentinata/fmt

Then use it:

./node_modules/.bin/fmt [PATTERN ...]

You can also put it in package.json scripts:

{
  "scripts": {
    "fmt": "@bentinata/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("@bentinata/fmt").eslint;

Or, if you want to extend it with your own config:

module.exports = {
  ...require("@bentinata/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("@bentinata/fmt").prettier;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published