Format codebase to ensure consistent style
Ce commit applique un formatage uniforme au code en utilisant des guillemets doubles. Cela améliore la lisibilité et maintient une style cohérente à travers tous les fichiers. De plus, une configuration Biome a été ajoutée pour automatiser ce processus à l'avenir.
This commit is contained in:
parent
3b8f3565d4
commit
0bb8185247
@ -1,19 +1,19 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export default {
|
export default {
|
||||||
displayName: 'backend-e2e',
|
displayName: "backend-e2e",
|
||||||
preset: '../../jest.preset.js',
|
preset: "../../jest.preset.js",
|
||||||
globalSetup: '<rootDir>/src/support/global-setup.ts',
|
globalSetup: "<rootDir>/src/support/global-setup.ts",
|
||||||
globalTeardown: '<rootDir>/src/support/global-teardown.ts',
|
globalTeardown: "<rootDir>/src/support/global-teardown.ts",
|
||||||
setupFiles: ['<rootDir>/src/support/test-setup.ts'],
|
setupFiles: ["<rootDir>/src/support/test-setup.ts"],
|
||||||
testEnvironment: 'node',
|
testEnvironment: "node",
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.[tj]s$': [
|
"^.+\\.[tj]s$": [
|
||||||
'ts-jest',
|
"ts-jest",
|
||||||
{
|
{
|
||||||
tsconfig: '<rootDir>/tsconfig.spec.json',
|
tsconfig: "<rootDir>/tsconfig.spec.json",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
moduleFileExtensions: ['ts', 'js', 'html'],
|
moduleFileExtensions: ["ts", "js", "html"],
|
||||||
coverageDirectory: '../../coverage/backend-e2e',
|
coverageDirectory: "../../coverage/backend-e2e",
|
||||||
};
|
};
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import axios from 'axios';
|
import axios from "axios";
|
||||||
|
|
||||||
describe('GET /api', () => {
|
describe("GET /api", () => {
|
||||||
it('should return a message', async () => {
|
it("should return a message", async () => {
|
||||||
const res = await axios.get(`/api`);
|
const res = await axios.get(`/api`);
|
||||||
|
|
||||||
expect(res.status).toBe(200);
|
expect(res.status).toBe(200);
|
||||||
expect(res.data).toEqual({ message: 'Hello API' });
|
expect(res.data).toEqual({ message: "Hello API" });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
var __TEARDOWN_MESSAGE__: string;
|
var __TEARDOWN_MESSAGE__: string;
|
||||||
|
|
||||||
module.exports = async function () {
|
module.exports = async () => {
|
||||||
// Start services that that the app needs to run (e.g. database, docker-compose, etc.).
|
// Start services that that the app needs to run (e.g. database, docker-compose, etc.).
|
||||||
console.log('\nSetting up...\n');
|
console.log("\nSetting up...\n");
|
||||||
|
|
||||||
// Hint: Use `globalThis` to pass variables to global teardown.
|
// Hint: Use `globalThis` to pass variables to global teardown.
|
||||||
globalThis.__TEARDOWN_MESSAGE__ = '\nTearing down...\n';
|
globalThis.__TEARDOWN_MESSAGE__ = "\nTearing down...\n";
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
module.exports = async function () {
|
module.exports = async () => {
|
||||||
// Put clean up logic here (e.g. stopping services, docker-compose, etc.).
|
// Put clean up logic here (e.g. stopping services, docker-compose, etc.).
|
||||||
// Hint: `globalThis` is shared between setup and teardown.
|
// Hint: `globalThis` is shared between setup and teardown.
|
||||||
console.log(globalThis.__TEARDOWN_MESSAGE__);
|
console.log(globalThis.__TEARDOWN_MESSAGE__);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from "axios";
|
||||||
|
|
||||||
module.exports = async function () {
|
module.exports = async () => {
|
||||||
// Configure axios for tests to use.
|
// Configure axios for tests to use.
|
||||||
const host = process.env.HOST ?? 'localhost';
|
const host = process.env.HOST ?? "localhost";
|
||||||
const port = process.env.PORT ?? '3000';
|
const port = process.env.PORT ?? "3000";
|
||||||
axios.defaults.baseURL = `http://${host}:${port}`;
|
axios.defaults.baseURL = `http://${host}:${port}`;
|
||||||
};
|
};
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export default {
|
export default {
|
||||||
displayName: 'backend',
|
displayName: "backend",
|
||||||
preset: '../../jest.preset.js',
|
preset: "../../jest.preset.js",
|
||||||
testEnvironment: 'node',
|
testEnvironment: "node",
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
|
"^.+\\.[tj]s$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }],
|
||||||
},
|
},
|
||||||
moduleFileExtensions: ['ts', 'js', 'html'],
|
moduleFileExtensions: ["ts", "js", "html"],
|
||||||
coverageDirectory: '../../coverage/apps/backend',
|
coverageDirectory: "../../coverage/apps/backend",
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { Test, TestingModule } from '@nestjs/testing';
|
import { Test, TestingModule } from "@nestjs/testing";
|
||||||
|
|
||||||
import { AppController } from './app.controller';
|
import { AppController } from "./app.controller";
|
||||||
import { AppService } from './app.service';
|
import { AppService } from "./app.service";
|
||||||
|
|
||||||
describe('AppController', () => {
|
describe("AppController", () => {
|
||||||
let app: TestingModule;
|
let app: TestingModule;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
@ -13,10 +13,10 @@ describe('AppController', () => {
|
|||||||
}).compile();
|
}).compile();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getData', () => {
|
describe("getData", () => {
|
||||||
it('should return "Hello API"', () => {
|
it('should return "Hello API"', () => {
|
||||||
const appController = app.get<AppController>(AppController);
|
const appController = app.get<AppController>(AppController);
|
||||||
expect(appController.getData()).toEqual({ message: 'Hello API' });
|
expect(appController.getData()).toEqual({ message: "Hello API" });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Controller, Get } from '@nestjs/common';
|
import { Controller, Get } from "@nestjs/common";
|
||||||
|
|
||||||
import { AppService } from './app.service';
|
import { AppService } from "./app.service";
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
export class AppController {
|
export class AppController {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from "@nestjs/common";
|
||||||
|
|
||||||
import { AppController } from './app.controller';
|
import { AppController } from "./app.controller";
|
||||||
import { AppService } from './app.service';
|
import { AppService } from "./app.service";
|
||||||
|
import { DbModule } from "./db/db.module";
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [],
|
imports: [DbModule],
|
||||||
controllers: [AppController],
|
controllers: [AppController],
|
||||||
providers: [AppService],
|
providers: [AppService],
|
||||||
})
|
})
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { Test } from '@nestjs/testing';
|
import { Test } from "@nestjs/testing";
|
||||||
|
|
||||||
import { AppService } from './app.service';
|
import { AppService } from "./app.service";
|
||||||
|
|
||||||
describe('AppService', () => {
|
describe("AppService", () => {
|
||||||
let service: AppService;
|
let service: AppService;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
@ -13,9 +13,9 @@ describe('AppService', () => {
|
|||||||
service = app.get<AppService>(AppService);
|
service = app.get<AppService>(AppService);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getData', () => {
|
describe("getData", () => {
|
||||||
it('should return "Hello API"', () => {
|
it('should return "Hello API"', () => {
|
||||||
expect(service.getData()).toEqual({ message: 'Hello API' });
|
expect(service.getData()).toEqual({ message: "Hello API" });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from "@nestjs/common";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AppService {
|
export class AppService {
|
||||||
getData(): { message: string } {
|
getData(): { message: string } {
|
||||||
return { message: 'Hello API' };
|
return { message: "Hello API" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
apps/backend/src/app/db/db.module.ts
Normal file
7
apps/backend/src/app/db/db.module.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { Module } from "@nestjs/common";
|
||||||
|
import { DbService } from "./db.service";
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
providers: [DbService],
|
||||||
|
})
|
||||||
|
export class DbModule {}
|
18
apps/backend/src/app/db/db.service.spec.ts
Normal file
18
apps/backend/src/app/db/db.service.spec.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { Test, TestingModule } from "@nestjs/testing";
|
||||||
|
import { DbService } from "./db.service";
|
||||||
|
|
||||||
|
describe("DbService", () => {
|
||||||
|
let service: DbService;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
|
providers: [DbService],
|
||||||
|
}).compile();
|
||||||
|
|
||||||
|
service = module.get<DbService>(DbService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should be defined", () => {
|
||||||
|
expect(service).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
4
apps/backend/src/app/db/db.service.ts
Normal file
4
apps/backend/src/app/db/db.service.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import { Injectable } from "@nestjs/common";
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class DbService {}
|
@ -3,19 +3,19 @@
|
|||||||
* This is only a minimal backend to get started.
|
* This is only a minimal backend to get started.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Logger } from '@nestjs/common';
|
import { Logger } from "@nestjs/common";
|
||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from "@nestjs/core";
|
||||||
|
|
||||||
import { AppModule } from './app/app.module';
|
import { AppModule } from "./app/app.module";
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
const globalPrefix = 'api';
|
const globalPrefix = "api";
|
||||||
app.setGlobalPrefix(globalPrefix);
|
app.setGlobalPrefix(globalPrefix);
|
||||||
const port = process.env.PORT || 3000;
|
const port = process.env.PORT || 3000;
|
||||||
await app.listen(port);
|
await app.listen(port);
|
||||||
Logger.log(
|
Logger.log(
|
||||||
`🚀 Application is running on: http://localhost:${port}/${globalPrefix}`
|
`🚀 Application is running on: http://localhost:${port}/${globalPrefix}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
|
import { nxE2EPreset } from "@nx/cypress/plugins/cypress-preset";
|
||||||
|
|
||||||
import { defineConfig } from 'cypress';
|
import { defineConfig } from "cypress";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
...nxE2EPreset(__filename, {
|
...nxE2EPreset(__filename, {
|
||||||
cypressDir: 'src',
|
cypressDir: "src",
|
||||||
webServerCommands: { default: 'nx run frontend:start' },
|
webServerCommands: { default: "nx run frontend:start" },
|
||||||
ciWebServerCommand: 'nx run frontend:serve-static',
|
ciWebServerCommand: "nx run frontend:serve-static",
|
||||||
}),
|
}),
|
||||||
baseUrl: 'http://localhost:3000',
|
baseUrl: "http://localhost:3000",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { getGreeting } from '../support/app.po';
|
import { getGreeting } from "../support/app.po";
|
||||||
|
|
||||||
describe('frontend-e2e', () => {
|
describe("frontend-e2e", () => {
|
||||||
beforeEach(() => cy.visit('/'));
|
beforeEach(() => cy.visit("/"));
|
||||||
|
|
||||||
it('should display welcome message', () => {
|
it("should display welcome message", () => {
|
||||||
// Custom command example, see `../support/commands.ts` file
|
// Custom command example, see `../support/commands.ts` file
|
||||||
cy.login('my-email@something.com', 'myPassword');
|
cy.login("my-email@something.com", "myPassword");
|
||||||
|
|
||||||
// Function helper example, see `../support/app.po.ts` file
|
// Function helper example, see `../support/app.po.ts` file
|
||||||
getGreeting().contains(/Welcome/);
|
getGreeting().contains(/Welcome/);
|
||||||
|
@ -1 +1 @@
|
|||||||
export const getGreeting = () => cy.get('h1');
|
export const getGreeting = () => cy.get("h1");
|
||||||
|
@ -19,8 +19,8 @@ declare namespace Cypress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -- This is a parent command --
|
// -- This is a parent command --
|
||||||
Cypress.Commands.add('login', (email, password) => {
|
Cypress.Commands.add("login", (email, password) => {
|
||||||
console.log('Custom command example: Login', email, password);
|
console.log("Custom command example: Login", email, password);
|
||||||
});
|
});
|
||||||
//
|
//
|
||||||
// -- This is a child command --
|
// -- This is a child command --
|
||||||
|
@ -14,4 +14,4 @@
|
|||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
|
|
||||||
// Import commands.ts using ES2015 syntax:
|
// Import commands.ts using ES2015 syntax:
|
||||||
import './commands';
|
import "./commands";
|
||||||
|
2
apps/frontend/index.d.ts
vendored
2
apps/frontend/index.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
declare module '*.svg' {
|
declare module "*.svg" {
|
||||||
const content: any;
|
const content: any;
|
||||||
export const ReactComponent: any;
|
export const ReactComponent: any;
|
||||||
export default content;
|
export default content;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export default {
|
export default {
|
||||||
displayName: 'frontend',
|
displayName: "frontend",
|
||||||
preset: '../../jest.preset.js',
|
preset: "../../jest.preset.js",
|
||||||
transform: {
|
transform: {
|
||||||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
|
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "@nx/react/plugins/jest",
|
||||||
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }],
|
"^.+\\.[tj]sx?$": ["babel-jest", { presets: ["@nx/next/babel"] }],
|
||||||
},
|
},
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
|
||||||
coverageDirectory: '../../coverage/apps/frontend',
|
coverageDirectory: "../../coverage/apps/frontend",
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
return new Response('Hello, from API!');
|
return new Response("Hello, from API!");
|
||||||
}
|
}
|
||||||
|
44
biome.json
Normal file
44
biome.json
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://biomejs.dev/schemas/1.6.4/schema.json",
|
||||||
|
"organizeImports": {
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
"files": {
|
||||||
|
"include": [
|
||||||
|
"./apps/**/*.ts"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"vcs": {
|
||||||
|
"enabled": true,
|
||||||
|
"clientKind": "git"
|
||||||
|
},
|
||||||
|
"linter": {
|
||||||
|
"enabled": true,
|
||||||
|
"rules": {
|
||||||
|
"recommended": true,
|
||||||
|
"performance": {
|
||||||
|
"recommended": true,
|
||||||
|
"noDelete": "off"
|
||||||
|
},
|
||||||
|
"suspicious": {
|
||||||
|
"noExplicitAny": "warn"
|
||||||
|
},
|
||||||
|
"complexity": {
|
||||||
|
"useLiteralKeys": "off"
|
||||||
|
},
|
||||||
|
"style": {
|
||||||
|
"useImportType": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"formatter": {
|
||||||
|
"indentStyle": "tab",
|
||||||
|
"indentWidth": 2,
|
||||||
|
"lineWidth": 80
|
||||||
|
},
|
||||||
|
"javascript": {
|
||||||
|
"parser": {
|
||||||
|
"unsafeParameterDecoratorsEnabled": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,11 +2,14 @@
|
|||||||
"name": "@app/source",
|
"name": "@app/source",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {},
|
"scripts": {
|
||||||
|
"check": "biome check --skip-errors --apply apps"
|
||||||
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nestjs/common": "^10.4.1",
|
"@nestjs/common": "^10.4.1",
|
||||||
"@nestjs/core": "^10.4.1",
|
"@nestjs/core": "^10.4.1",
|
||||||
|
"@nestjs/mapped-types": "*",
|
||||||
"@nestjs/platform-express": "^10.4.1",
|
"@nestjs/platform-express": "^10.4.1",
|
||||||
"axios": "^1.7.4",
|
"axios": "^1.7.4",
|
||||||
"next": "14.2.3",
|
"next": "14.2.3",
|
||||||
|
@ -10,11 +10,17 @@
|
|||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"target": "es2015",
|
"target": "es2015",
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"lib": ["es2020", "dom"],
|
"lib": [
|
||||||
|
"es2020",
|
||||||
|
"dom"
|
||||||
|
],
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"skipDefaultLibCheck": true,
|
"skipDefaultLibCheck": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {}
|
"paths": {}
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "tmp"]
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"tmp"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user