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 */
|
||||
export default {
|
||||
displayName: 'backend-e2e',
|
||||
preset: '../../jest.preset.js',
|
||||
globalSetup: '<rootDir>/src/support/global-setup.ts',
|
||||
globalTeardown: '<rootDir>/src/support/global-teardown.ts',
|
||||
setupFiles: ['<rootDir>/src/support/test-setup.ts'],
|
||||
testEnvironment: 'node',
|
||||
displayName: "backend-e2e",
|
||||
preset: "../../jest.preset.js",
|
||||
globalSetup: "<rootDir>/src/support/global-setup.ts",
|
||||
globalTeardown: "<rootDir>/src/support/global-teardown.ts",
|
||||
setupFiles: ["<rootDir>/src/support/test-setup.ts"],
|
||||
testEnvironment: "node",
|
||||
transform: {
|
||||
'^.+\\.[tj]s$': [
|
||||
'ts-jest',
|
||||
"^.+\\.[tj]s$": [
|
||||
"ts-jest",
|
||||
{
|
||||
tsconfig: '<rootDir>/tsconfig.spec.json',
|
||||
tsconfig: "<rootDir>/tsconfig.spec.json",
|
||||
},
|
||||
],
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'js', 'html'],
|
||||
coverageDirectory: '../../coverage/backend-e2e',
|
||||
moduleFileExtensions: ["ts", "js", "html"],
|
||||
coverageDirectory: "../../coverage/backend-e2e",
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
import axios from 'axios';
|
||||
import axios from "axios";
|
||||
|
||||
describe('GET /api', () => {
|
||||
it('should return a message', async () => {
|
||||
describe("GET /api", () => {
|
||||
it("should return a message", async () => {
|
||||
const res = await axios.get(`/api`);
|
||||
|
||||
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 */
|
||||
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.).
|
||||
console.log('\nSetting up...\n');
|
||||
console.log("\nSetting up...\n");
|
||||
|
||||
// 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 */
|
||||
|
||||
module.exports = async function () {
|
||||
module.exports = async () => {
|
||||
// Put clean up logic here (e.g. stopping services, docker-compose, etc.).
|
||||
// Hint: `globalThis` is shared between setup and teardown.
|
||||
console.log(globalThis.__TEARDOWN_MESSAGE__);
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* eslint-disable */
|
||||
|
||||
import axios from 'axios';
|
||||
import axios from "axios";
|
||||
|
||||
module.exports = async function () {
|
||||
module.exports = async () => {
|
||||
// Configure axios for tests to use.
|
||||
const host = process.env.HOST ?? 'localhost';
|
||||
const port = process.env.PORT ?? '3000';
|
||||
const host = process.env.HOST ?? "localhost";
|
||||
const port = process.env.PORT ?? "3000";
|
||||
axios.defaults.baseURL = `http://${host}:${port}`;
|
||||
};
|
||||
|
@ -1,11 +1,11 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'backend',
|
||||
preset: '../../jest.preset.js',
|
||||
testEnvironment: 'node',
|
||||
displayName: "backend",
|
||||
preset: "../../jest.preset.js",
|
||||
testEnvironment: "node",
|
||||
transform: {
|
||||
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
|
||||
"^.+\\.[tj]s$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }],
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'js', 'html'],
|
||||
coverageDirectory: '../../coverage/apps/backend',
|
||||
moduleFileExtensions: ["ts", "js", "html"],
|
||||
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 { AppService } from './app.service';
|
||||
import { AppController } from "./app.controller";
|
||||
import { AppService } from "./app.service";
|
||||
|
||||
describe('AppController', () => {
|
||||
describe("AppController", () => {
|
||||
let app: TestingModule;
|
||||
|
||||
beforeAll(async () => {
|
||||
@ -13,10 +13,10 @@ describe('AppController', () => {
|
||||
}).compile();
|
||||
});
|
||||
|
||||
describe('getData', () => {
|
||||
describe("getData", () => {
|
||||
it('should return "Hello API"', () => {
|
||||
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()
|
||||
export class AppController {
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { Module } from "@nestjs/common";
|
||||
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import { AppController } from "./app.controller";
|
||||
import { AppService } from "./app.service";
|
||||
import { DbModule } from "./db/db.module";
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
imports: [DbModule],
|
||||
controllers: [AppController],
|
||||
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;
|
||||
|
||||
beforeAll(async () => {
|
||||
@ -13,9 +13,9 @@ describe('AppService', () => {
|
||||
service = app.get<AppService>(AppService);
|
||||
});
|
||||
|
||||
describe('getData', () => {
|
||||
describe("getData", () => {
|
||||
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()
|
||||
export class AppService {
|
||||
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.
|
||||
*/
|
||||
|
||||
import { Logger } from '@nestjs/common';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { Logger } from "@nestjs/common";
|
||||
import { NestFactory } from "@nestjs/core";
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { AppModule } from "./app/app.module";
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
const globalPrefix = 'api';
|
||||
const globalPrefix = "api";
|
||||
app.setGlobalPrefix(globalPrefix);
|
||||
const port = process.env.PORT || 3000;
|
||||
await app.listen(port);
|
||||
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({
|
||||
e2e: {
|
||||
...nxE2EPreset(__filename, {
|
||||
cypressDir: 'src',
|
||||
webServerCommands: { default: 'nx run frontend:start' },
|
||||
ciWebServerCommand: 'nx run frontend:serve-static',
|
||||
cypressDir: "src",
|
||||
webServerCommands: { default: "nx run frontend:start" },
|
||||
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', () => {
|
||||
beforeEach(() => cy.visit('/'));
|
||||
describe("frontend-e2e", () => {
|
||||
beforeEach(() => cy.visit("/"));
|
||||
|
||||
it('should display welcome message', () => {
|
||||
it("should display welcome message", () => {
|
||||
// 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
|
||||
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 --
|
||||
Cypress.Commands.add('login', (email, password) => {
|
||||
console.log('Custom command example: Login', email, password);
|
||||
Cypress.Commands.add("login", (email, password) => {
|
||||
console.log("Custom command example: Login", email, password);
|
||||
});
|
||||
//
|
||||
// -- This is a child command --
|
||||
|
@ -14,4 +14,4 @@
|
||||
// ***********************************************************
|
||||
|
||||
// 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 */
|
||||
declare module '*.svg' {
|
||||
declare module "*.svg" {
|
||||
const content: any;
|
||||
export const ReactComponent: any;
|
||||
export default content;
|
||||
|
@ -1,11 +1,11 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'frontend',
|
||||
preset: '../../jest.preset.js',
|
||||
displayName: "frontend",
|
||||
preset: "../../jest.preset.js",
|
||||
transform: {
|
||||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
|
||||
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/next/babel'] }],
|
||||
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "@nx/react/plugins/jest",
|
||||
"^.+\\.[tj]sx?$": ["babel-jest", { presets: ["@nx/next/babel"] }],
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
||||
coverageDirectory: '../../coverage/apps/frontend',
|
||||
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
|
||||
coverageDirectory: "../../coverage/apps/frontend",
|
||||
};
|
||||
|
@ -1,3 +1,3 @@
|
||||
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",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT",
|
||||
"scripts": {},
|
||||
"scripts": {
|
||||
"check": "biome check --skip-errors --apply apps"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^10.4.1",
|
||||
"@nestjs/core": "^10.4.1",
|
||||
"@nestjs/mapped-types": "*",
|
||||
"@nestjs/platform-express": "^10.4.1",
|
||||
"axios": "^1.7.4",
|
||||
"next": "14.2.3",
|
||||
|
@ -10,11 +10,17 @@
|
||||
"importHelpers": true,
|
||||
"target": "es2015",
|
||||
"module": "esnext",
|
||||
"lib": ["es2020", "dom"],
|
||||
"lib": [
|
||||
"es2020",
|
||||
"dom"
|
||||
],
|
||||
"skipLibCheck": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {}
|
||||
},
|
||||
"exclude": ["node_modules", "tmp"]
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"tmp"
|
||||
]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user