Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 782 Bytes

fast-setup.md

File metadata and controls

38 lines (28 loc) · 782 Bytes

Fast setup

  1. Create package.json. ("y" flag tells the generator to use the defaults instead of asking questions.)
  2. Create .gitignore file.
  3. Add "node_modules" to .gitinore.
  4. Install ESLint, Husky and Lint-staged as devDependencies
npm init -y

touch .gitignore
echo 'node_modules' > .gitignore

npm i -D eslint husky lint-staged
  1. Initialize eslint configuration
npm init @eslint/config
  1. Add "lint" and "prepare" scripts to package.json scripts.
  2. Setup Lint-staged.
  3. Setup Husky "pre-commit" git hook.
npm pkg set scripts.lint="npx eslint"
npm pkg set scripts.prepare="husky install"

touch .lintstagedrc
echo '{
  "*.js": "npm run lint"
}' > .lintstagedrc

npm run prepare
npx husky add .husky/pre-commit "npx lint-staged"