jt-eslint-setup
v1.0.7
Published
A custom setup for ESLint, Prettier, Husky, and lint-staged
Readme
ESLint Setup
A custom setup script for ESLint, Prettier, Husky, and lint-staged for Next.js projects.
Installation
To install the package globally, run:
npm install -g jt-eslint-setup@latestUsage
This command sets up ESLint, Prettier, Husky, and lint-staged for Next.js projects.
Steps:
Create a new project or navigate to an existing project:
- For a new project, create it using
npx create-next-app@latest. - For an existing project, ensure your terminal is pointed to the root directory of your project and you have
srcdirectory in your project.
- For a new project, create it using
Open the terminal and run the setup command:
npx eslint-setup
What This Command Does:
- Installs all necessary packages for ESLint and Prettier.
- Configures ESLint with recommended rules for Next.js.
- Sets up Husky for managing Git hooks.
- Configures lint-staged to run linting and formatting on staged files.
Packages Installed:
eslintprettierhuskylint-staged- And other necessary plugins and configurations for a seamless development experience.
After Running the Command:
Check your project's root directory:
- You should see
.eslintrc.jsor.eslintrc.json,.prettierrc, andlint-stagedconfiguration files. - Husky hooks should be set up in the
.huskydirectory.
- You should see
Ensure your project is properly linted and formatted:
- Use
npm run lint:devto check for linting errors. - Use
npm run formatto format your code according to Prettier's rules.
- Use
Troubleshooting:
- If you face any issues, ensure your terminal is pointed to the root directory of your project before running the command.
- Feel free to reach out for support or sync on a call if you encounter any problems.
By following the steps above, you can easily set up and maintain a clean codebase with consistent linting and formatting rules for your Next.js projects.
