Repository navigation
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.
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 BackendThen run:
npm run lintPrettier 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 formatBefore performing a push, run:
npm run format
npm run lintIf 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