Skip to content

Programming style guide (Backend)

Juan Manuel Gallo Lòpez edited this page Oct 1, 2026 · 2 revisions

Programming Style Guide – Backend

The backend uses ESLint and Prettier, following the same general coding style defined for the frontend.

ESLint is used to detect code quality issues, while Prettier is used for automatic code formatting.


1. ESLint

The ESLint configuration is maintained in:

eslint.config.mjs

ESLint is used to detect issues such as unused variables, unused imports, and violations of the coding rules defined for the project.

Example:

const restaurantName = 'Reservia';
const unusedValue = 10;

If unusedValue is not used, ESLint should report it.

To run ESLint, open a terminal in the backend root folder:

cd Backend

Then run:

npm run lint

2. Prettier

Prettier is used to automatically maintain a consistent code format.

The backend follows the same formatting criteria used in the frontend:

{
  "$schema": "https://json.schemastore.org/prettierrc",
  "semi": true,
  "singleQuote": true,
  "printWidth": 140
}

This configuration defines:

  • Semicolons.
  • Single quotes.
  • A maximum line width of 140.

To run Prettier from the backend root folder:

npm run format

3. When to Run Them

Before performing a push, run:

npm run format
npm run lint

If ESLint reports an issue, it must be reviewed and corrected before pushing the changes.

The expected workflow is:

Modify code
      ↓
Save changes
      ↓
Navigate to Backend/
      ↓
npm run format
      ↓
npm run lint
      ↓
Fix issues if necessary
      ↓
Commit
      ↓
Push

Clone this wiki locally