Introduce eslint #4
|
|
@ -6,12 +6,12 @@
|
|||
"private": true,
|
||||
"license": "UNLICENSED",
|
||||
"scripts": {
|
||||
"build": "nest build",
|
||||
"build": "npm run lint && nest build",
|
||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"start": "nest start --watch",
|
||||
"start": "npm run build && nest start --watch",
|
||||
"start:debug": "nest start --debug --watch",
|
||||
"start:prod": "node dist/main",
|
||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||
"lint": "eslint \"src/**/*.ts\" --fix",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"test:cov": "jest --coverage",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { MessageBody, SubscribeMessage, WebSocketGateway } from '@nestjs/websockets';
|
||||
import {
|
||||
MessageBody,
|
||||
SubscribeMessage,
|
||||
WebSocketGateway,
|
||||
} from '@nestjs/websockets';
|
||||
|
||||
@WebSocketGateway({ cors: true })
|
||||
@Injectable()
|
||||
|
|
@ -9,6 +13,9 @@ export class AppService {
|
|||
@SubscribeMessage('example-request')
|
||||
handleCustomEvent(@MessageBody() data: string): unknown {
|
||||
this.logger.debug(`Received request in backend with data: ${data}`);
|
||||
return {event: "example-response", data: `Replying from backend, received data: ${data}`};
|
||||
return {
|
||||
event: 'example-response',
|
||||
data: `Replying from backend, received data: ${data}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
module.exports = {
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: {
|
||||
project: "tsconfig.json",
|
||||
tsconfigRootDir: __dirname,
|
||||
sourceType: "module",
|
||||
},
|
||||
plugins: ["@typescript-eslint/eslint-plugin"],
|
||||
extends: ["plugin:@typescript-eslint/strict", "plugin:prettier/recommended"],
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
jest: true,
|
||||
},
|
||||
ignorePatterns: [".eslintrc.js", "dist/"],
|
||||
rules: {},
|
||||
};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
export enum TrackType {
|
||||
RAIL = "RAIL",
|
||||
ROAD = "ROAD"
|
||||
};
|
||||
ROAD = "ROAD",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
export * from "./constants/TrackType"
|
||||
export * from "./constants/TrackType";
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -5,13 +5,21 @@
|
|||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "tsc"
|
||||
"build": "npm run lint && tsc",
|
||||
"lint": "eslint \"*.ts\" \"*/**/*.ts\" --fix"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^8.0.0",
|
||||
"@types/node": "^22.9.0",
|
||||
"typescript": "^5.6.3"
|
||||
"@typescript-eslint/eslint-plugin": "^8.15.0",
|
||||
"@typescript-eslint/parser": "^8.15.0",
|
||||
"eslint": "^8.0.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"globals": "^15.12.0",
|
||||
"typescript": "^5.6.3",
|
||||
"typescript-eslint": "^8.15.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
module.exports = {
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: {
|
||||
project: "tsconfig.json",
|
||||
tsconfigRootDir: __dirname,
|
||||
sourceType: "module",
|
||||
},
|
||||
plugins: ["@typescript-eslint/eslint-plugin"],
|
||||
extends: ["plugin:@typescript-eslint/strict", "plugin:prettier/recommended"],
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
jest: true,
|
||||
},
|
||||
ignorePatterns: [".eslintrc.js", "dist/"],
|
||||
rules: {},
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -22,9 +22,10 @@
|
|||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"build": "npm run lint && react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
"eject": "react-scripts eject",
|
||||
"lint": "eslint \"*/**/*.tsx\" \"*/**/*.ts\" --fix"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
|
|
@ -43,5 +44,13 @@
|
|||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^8.15.0",
|
||||
"eslint": "^8.0.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"typescript-eslint": "^8.15.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
import React from "react";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import App from "./App";
|
||||
|
||||
test('Renders hello world', () => {
|
||||
test("Renders hello world", () => {
|
||||
render(<App />);
|
||||
expect(screen.getByText("Hello World! Front")).toBeInTheDocument();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,17 +1,18 @@
|
|||
import React from 'react';
|
||||
import React from "react";
|
||||
import { io } from "socket.io-client";
|
||||
|
||||
function App() {
|
||||
const socket = io("http://localhost:3010");
|
||||
const emitData = () => console.log(socket.emit("example-request", "custom-request"));
|
||||
socket.on("example-response", (data) => console.log(`Received response in front end with data: ${data}`));
|
||||
const emitData = () =>
|
||||
console.log(socket.emit("example-request", "custom-request"));
|
||||
socket.on("example-response", (data) =>
|
||||
console.log(`Received response in front end with data: ${data}`),
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<button onClick={emitData}>
|
||||
Emit Data
|
||||
</button>
|
||||
<button onClick={emitData}>Emit Data</button>
|
||||
Hello World! Front
|
||||
</header>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import App from './App';
|
||||
import './App.scss'
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import App from "./App";
|
||||
import "./App.scss";
|
||||
|
||||
const root = ReactDOM.createRoot(
|
||||
document.getElementById('root') as HTMLElement
|
||||
document.getElementById("root") as HTMLElement,
|
||||
);
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
</React.StrictMode>,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
||||
import "@testing-library/jest-dom";
|
||||
|
|
|
|||
Loading…
Reference in New Issue