📖 This document is also available in Portuguese (Brazil)
If you want to set up everything automatically, just run:
npx cloud-crafter-cli run quickstart-js
This command will handle all steps for you—creating necessary files, installing dependencies, and configuring ESLint, Husky, and Lint-staged. After running it, you're ready to go! 🎉
If you prefer a hands-on approach, follow these steps:
- Create package.json. ("y" flag tells the generator to use the defaults instead of asking questions.)
- Create .gitignore file.
- Add "node_modules" to .gitinore.
- Install ESLint, Husky and Lint-staged as devDependencies
npm init -y
touch .gitignore
echo 'node_modules' > .gitignore
npm i -D eslint husky lint-staged
- Initialize eslint configuration
npm init @eslint/config
- Add "lint" and "prepare" scripts to package.json scripts.
- Setup Lint-staged.
- Setup Husky "pre-commit" git hook.
npm pkg set scripts.lint="npx eslint"
npx husky init
touch .lintstagedrc
echo '{
"*.js": "npm run lint -- --fix"
}' > .lintstagedrc
npx husky add .husky/pre-commit "npx lint-staged"