Overview

Learn how to keep your code clean and consistent using formatting (standardizing code style) and linting (catching code errors).

Tools

  • Nuxt ESLint: Checks your code for errors and enforces Nuxt/Vue standards.
  • Prettier: Automatically formats your code for a consistent look.
  • simple-git-hooks: Runs formatting and linting when you save changes to your project.

Usage

  • Linting: Run npm run lint to check for issues in your code.
  • Auto Fix Lint Errors: Run npm run lint-fix to automatically fix common problems.
  • Formatting: Run npm run format to style your code automatically.
  • Full Cleanup: Run npm run format:all to lint and format your entire codebase in one go.
  • Auto-Formatting: Code is automatically linted and formatted when you commit changes.

Configuration Files

Modify these only if you need custom settings:

  • eslint.config.mjs: Sets rules for code error checking.
  • .prettierignore: Lists files to skip during formatting.
  • .prettierrc: Defines formatting styles (e.g., tabs, quotes).
  • package.json (Git Hooks): Sets up auto-formatting when saving changes.