Setup and configuration

Verze:

19. 06. 2025

Zodpovědná osoba:

Dominik Šlechta

Install ESLint in Your Project

  • Run the following command to install ESLint as a development dependency in your project:

    npm install eslint --save-dev
    
  • This installs ESLint locally in your project and adds it to your package.json file's devDependencies, making it easier to manage versions and ensure consistency across the team.

Set Up the ESLint Configuration File

  • Run the following command to generate the .eslintrc configuration file:

    npx eslint --init
    
  • This command will interactively guide you through the setup process, asking about your coding style, preferred rules, and the type of environment (e.g., Node.js, browser). It will create a .eslintrc file that contains the necessary configuration settings for ESLint.

  • Choose to Extend the Google JavaScript Style Guide

    • During the ESLint initialization process, when prompted to choose a style guide, select Google as your base configuration.

    • Reason: The Google JavaScript Style Guide is a widely adopted, well-established style guide that promotes good practices and consistent code formatting, so extending it will help you maintain quality code.

Summary

  • Install ESLint with npm install eslint --save-dev.

  • Run npx eslint --init to set up your .eslintrc configuration file and choose the Google JavaScript Style Guide.