Skip to content

Commit

Permalink
style: upgraded eslint and fixed issues
Browse files Browse the repository at this point in the history
  • Loading branch information
theblockstalk committed Jul 11, 2024
1 parent 0edd2d1 commit 137b127
Show file tree
Hide file tree
Showing 10 changed files with 539 additions and 317 deletions.
43 changes: 0 additions & 43 deletions .eslintrc.js

This file was deleted.

51 changes: 51 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import eslint from "@eslint/js";
import tseslint from 'typescript-eslint';
import prettier from 'eslint-plugin-prettier/recommended';
import globals from "globals";

export default [
eslint.configs.recommended,
...tseslint.configs.recommended,
prettier,
{
rules: {
eqeqeq: "error",
"no-console": "warn",
"prettier/prettier": "error",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"padding-line-between-statements": [
"warn",
{ blankLine: "always", prev: "block-like", next: "*" },
{ blankLine: "always", prev: "block", next: "*" },
{ blankLine: "always", prev: "*", next: ["block", "block-like"] },
{ blankLine: "always", prev: ["const", "let", "var"], next: "*" },
{ blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"] },
{ blankLine: "always", prev: ["export", "import"], next: "*" },
{ blankLine: "any", prev: "import", next: "import" },
{ blankLine: "any", prev: "export", next: "export" }
]
},
languageOptions: {
ecmaVersion: 6,
sourceType: "module",
parserOptions: {
ecmaFeatures: {
jsx: true
}
},
globals: {
...globals.browser,
...globals.node,
...globals.es6,
...globals.jest
}
},
files: ["**/*.js", "**/*.ts"],
ignores: [
"dist/**",
]
}
];
29 changes: 16 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "yarn run esm nodemon",
"start:prod": "node dist/src/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"lint:fix": "yarn run esm lint --fix",
"lint": "eslint src test",
"lint:fix": "yarn run lint --fix",
"test": "yarn run esm jest",
"test:unit": " yarn run test --selectProjects \"Unit tests\"",
"test:e2e": "yarn run test --selectProjects \"End-to-end tests\"",
Expand All @@ -37,32 +37,35 @@
"rxjs": "^7.8.1"
},
"devDependencies": {
"@babel/cli": "^7.24.7",
"@babel/core": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"@babel/cli": "^7.24.8",
"@babel/core": "^7.24.8",
"@babel/preset-env": "^7.24.8",
"@nestjs/cli": "^10.1.17",
"@nestjs/schematics": "^10.0.2",
"@nestjs/testing": "^10.2.3",
"@types/eslint__js": "^8.42.3",
"@types/express": "^4.17.13",
"@types/jest": "29.5.12",
"@types/node": "20.14.9",
"@types/node": "20.14.10",
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"cross-env": "^7.0.3",
"eslint": "^8.48.0",
"eslint": "^9.6.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"glob": "^10.4.2",
"glob": "^11.0.0",
"globals": "^15.8.0",
"jest": "^29.6.4",
"nodemon": "^3.1.4",
"prettier": "^3.0.3",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "^29.1.1",
"ts-jest": "^29.2.2",
"ts-loader": "^9.4.4",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.2.2"
"typescript": "^5.2.2",
"typescript-eslint": "^7.16.0"
}
}
}
2 changes: 1 addition & 1 deletion src/accounts/accounts.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Response } from 'express';
@Controller('accounts')
export class AccountsController {
private readonly logger = new Logger(AccountsController.name);
constructor(private accountService: AccountsService) { }
constructor(private accountService: AccountsService) {}

@Post()
@ApiOperation({
Expand Down
4 changes: 2 additions & 2 deletions src/config/config.production.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
blockchainUrl: 'https://blockchain-api.pangea.web4.world',
loggerLevel: 'info',
blockchainUrl: 'https://blockchain-api.pangea.web4.world',
loggerLevel: 'info',
};
4 changes: 2 additions & 2 deletions src/config/config.staging.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
blockchainUrl: 'https://blockchain-api-staging.tonomy.foundation',
loggerLevel: 'debug',
blockchainUrl: 'https://blockchain-api-staging.tonomy.foundation',
loggerLevel: 'debug',
};
4 changes: 2 additions & 2 deletions src/config/config.testnet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
blockchainUrl: 'https://blockchain-api-testnet.pangea.web4.world',
loggerLevel: 'info',
blockchainUrl: 'https://blockchain-api-testnet.pangea.web4.world',
loggerLevel: 'info',
};
4 changes: 2 additions & 2 deletions src/config/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
blockchainUrl: 'http://localhost:8888',
loggerLevel: 'debug',
blockchainUrl: 'http://localhost:8888',
loggerLevel: 'debug',
};
32 changes: 16 additions & 16 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ if (env !== 'test') console.log(`NODE_ENV=${env}`);
type ConfigType = {
blockchainUrl: string;
loggerLevel:
| 'emergency'
| 'alert'
| 'critical'
| 'error'
| 'warning'
| 'notice'
| 'info'
| 'debug';
| 'emergency'
| 'alert'
| 'critical'
| 'error'
| 'warning'
| 'notice'
| 'info'
| 'debug';
};

type SettingsType = {
Expand All @@ -38,14 +38,14 @@ const settings: SettingsType = {

type FixLoggerLevelEnumType<T> = Omit<T, 'loggerLevel'> & {
loggerLevel:
| 'emergency'
| 'alert'
| 'critical'
| 'error'
| 'warning'
| 'notice'
| 'info'
| 'debug';
| 'emergency'
| 'alert'
| 'critical'
| 'error'
| 'warning'
| 'notice'
| 'info'
| 'debug';
};

switch (env) {
Expand Down
Loading

0 comments on commit 137b127

Please sign in to comment.