create-lint-format

Init ESLint and Prettier with Pre-Commit Hook in the project

Usage no npm install needed!

<script type="module">
  import createLintFormat from 'https://cdn.skypack.dev/create-lint-format';
</script>

README

create-lint-format

npm

Init eslint, prettier, and lint-staged with pre-commit git hook


When we start working with a new project, setting up eslint, prettier, and lint-staged is tedious. So, I decide to make an npm script to do these steps for us.

What the Script Does

  • Install devDependencies – ["eslint","prettier","lint-staged","simple-git-hooks","shell-quote","@thaicoding/eslint-config","@thaicoding/prettier-config"]
  • Add simple-git-hooks property to package.json
  • Update pre-commit hook to run lint-staged before we commit code
  • Create lint-staged.config.cjs
  • Create .eslintrc.cjs
  • Create .prettierrc.cjs
  • Create tsconfig.json if not exist

How to Use

In your project directory, run this command.

$ npm init lint-format

License

This project is licensed under the MIT License