ESLint Addon

The ESLint addon in Servest sets up linting for your project to help you maintain a consistent and error-free codebase.

It automatically installs recommended dependencies, creates configuration files, and updates your scripts.


How It Works

When you run:

Loading code snippet…

Servest will:

  1. Check the framework
    Ensures your project uses a supported Node.js framework. If not, the operation is canceled.

  2. Detect whether your project uses JavaScript or TypeScript, and accordingly names the generated files with .js or .ts.

  3. Install the Prettier package using your selected package manager (npm, pnpm, yarn, or bun).

    Packages installed (with versions):

    • eslint@9.34.0
    • globals@16.3.0
    • @eslint/js@9.34.0
    • typescript-eslint@8.41.0 (only if project language is TypeScript)
  4. Create ESLint configuration

    • Generates .eslintrc.js or .eslintrc.ts depending on your language.
    • Adds recommended rules and presets.
  5. Update package.json scripts
    Adds or preserves the following scripts:

    Loading code snippet…

Example

After adding ESLint in a TypeScript MVC project:

Loading code snippet…

This gives you a ready-to-use linting setup without manually installing packages or creating config files.


Notes

  • ESLint can be safely re-run — existing configurations and scripts are preserved.
  • Works seamlessly with the Prettier Addon for combined linting and formatting workflows.
  • Confirmation Messages:
    • ✅ Shows when configuration and scripts are successfully added.
    • 👍 Appears if ESLint is already installed.
    • 🎉 Confirms successful setup.

Why Use ESLint?

  • Consistency → ensures coding standards are followed across the project.
  • Error prevention → detects potential bugs before runtime.
  • Integration-friendly → works well with other Servest addons like Prettier and lint-staged.
  • Safe to re-run → won’t overwrite existing setup, avoiding accidental data loss.