Skip to content

Commit ab26917

Browse files
authored
Merge pull request #6 from junekimdev/rc-250204
Rc 250204
2 parents aa699f9 + df9f2bb commit ab26917

File tree

8 files changed

+484
-403
lines changed

8 files changed

+484
-403
lines changed

codegen-util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/********************
22
* User Input Inquirer
33
********************/
4-
const readline = require('readline');
4+
const readline = require('node:readline');
55
/**
66
* @param {string} query
77
* @returns {Promise<string>}

codegen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const fs = require('fs');
2-
const path = require('path');
1+
const fs = require('node:fs');
2+
const path = require('node:path');
33
const { getArgs, askQuestion } = require('./codegen-util');
44

55
const INDEX_TXT = `export { default } from './apiHandler';

eslint.config.mjs

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,57 @@
1-
import eslint from '@eslint/js';
2-
import globals from 'globals';
3-
import tseslint from 'typescript-eslint';
1+
import js from '@eslint/js';
2+
import stylisticPlugin from '@stylistic/eslint-plugin';
3+
import ts from '@typescript-eslint/eslint-plugin';
4+
import tsParser from '@typescript-eslint/parser';
45

56
export default [
6-
eslint.configs.recommended,
7-
...tseslint.configs.recommended,
7+
{
8+
name: 'formatLint',
9+
plugins: {
10+
'@stylistic': stylisticPlugin,
11+
},
12+
rules: {
13+
'@stylistic/semi': 'warn',
14+
'@stylistic/no-extra-semi': 'error',
15+
'@stylistic/no-mixed-spaces-and-tabs': 'warn',
16+
},
17+
},
18+
{
19+
name: 'jsLint',
20+
files: ['**/*.js', '**/*.mjs'],
21+
rules: {
22+
...js.configs.recommended.rules,
23+
eqeqeq: 'warn',
24+
},
25+
},
26+
{
27+
name: 'tsLint',
28+
files: ['**/*.ts'],
29+
languageOptions: {
30+
parser: tsParser,
31+
parserOptions: {
32+
ecmaFeatures: { modules: true },
33+
ecmaVersion: 'latest',
34+
project: './tsconfig.json',
35+
},
36+
},
37+
plugins: {
38+
'@typescript-eslint': ts,
39+
},
40+
rules: {
41+
...ts.configs['eslint-recommended'].rules,
42+
...ts.configs.recommended.rules,
43+
'@typescript-eslint/no-require-imports': 'off',
44+
'@typescript-eslint/no-explicit-any': 'off',
45+
'@typescript-eslint/no-unused-vars': [
46+
'error',
47+
{
48+
argsIgnorePattern: '^_',
49+
varsIgnorePattern: '^_',
50+
caughtErrorsIgnorePattern: '^_',
51+
},
52+
],
53+
},
54+
},
855
{
956
files: [
1057
'src/**/*.js',
@@ -15,11 +62,6 @@ export default [
1562
'test/**/*.ts',
1663
],
1764
},
18-
{
19-
languageOptions: {
20-
globals: { ...globals.node },
21-
},
22-
},
2365
{
2466
ignores: [
2567
// dependencies
@@ -32,6 +74,8 @@ export default [
3274

3375
// dev-tools
3476
'*.js',
77+
'*.mjs',
78+
'*.ts',
3579

3680
// testing
3781
'coverage/',
@@ -64,24 +108,4 @@ export default [
64108
'placeholder_*',
65109
],
66110
},
67-
{
68-
rules: {
69-
eqeqeq: 'warn',
70-
semi: 'warn',
71-
'no-mixed-spaces-and-tabs': 'warn',
72-
'no-extra-semi': 'error',
73-
'no-unreachable': 'warn',
74-
'no-unused-vars': 'off',
75-
'@typescript-eslint/no-require-imports': 'off',
76-
'@typescript-eslint/no-explicit-any': 'off',
77-
'@typescript-eslint/no-unused-vars': [
78-
'error',
79-
{
80-
argsIgnorePattern: '^_',
81-
varsIgnorePattern: '^_',
82-
caughtErrorsIgnorePattern: '^_',
83-
},
84-
],
85-
},
86-
},
87111
];

package.json

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"start": "node dist/server.js",
1111
"dev": "nodemon src/server.ts",
1212
"lint": "eslint",
13+
"lint-inspect": "eslint --inspect-config",
1314
"test": "jest",
1415
"test-cover": "jest --coverage",
1516
"test-watch": "jest --verbose --coverage --watch",
@@ -20,38 +21,39 @@
2021
"dependencies": {
2122
"busboy": "^1.6.0",
2223
"cors": "^2.8.5",
23-
"dotenv": "^16.3.1",
24-
"express": "^4.21.1",
24+
"dotenv": "^16.4.7",
25+
"express": "^4.21.2",
2526
"express-promise-router": "^4.1.1",
2627
"helmet": "^8.0.0",
2728
"jsonwebtoken": "^9.0.0",
2829
"pg": "^8.13.1",
29-
"pino": "^9.5.0",
30-
"pino-http": "^10.1.0",
30+
"pino": "^9.6.0",
31+
"pino-http": "^10.4.0",
3132
"pino-pretty": "^13.0.0",
3233
"web-push": "^3.6.3"
3334
},
3435
"devDependencies": {
35-
"@eslint/js": "^9.15.0",
36+
"@eslint/js": "^9.19.0",
37+
"@stylistic/eslint-plugin": "^3.0.1",
3638
"@types/busboy": "^1.5.0",
3739
"@types/cors": "^2.8.13",
3840
"@types/express": "^5.0.0",
3941
"@types/express-pino-logger": "^4.0.3",
4042
"@types/jest": "^29.5.14",
41-
"@types/jsonwebtoken": "^9.0.7",
42-
"@types/node": "^22.9.1",
43-
"@types/pg": "^8.11.10",
43+
"@types/jsonwebtoken": "^9.0.8",
44+
"@types/node": "^22.13.1",
45+
"@types/pg": "^8.11.11",
4446
"@types/supertest": "^6.0.2",
4547
"@types/web-push": "^3.6.4",
46-
"eslint": "^9.15.0",
48+
"eslint": "^9.19.0",
4749
"jest": "^29.5.0",
48-
"nodemon": "^3.1.7",
49-
"prettier": "^3.3.2",
50+
"nodemon": "^3.1.9",
51+
"prettier": "^3.4.2",
5052
"rimraf": "^6.0.1",
5153
"supertest": "^7.0.0",
5254
"ts-jest": "^29.1.0",
5355
"ts-node": "^10.9.1",
54-
"typescript": "^5.6.3",
55-
"typescript-eslint": "^8.15.0"
56+
"typescript": "^5.7.3",
57+
"typescript-eslint": "^8.23.0"
5658
}
5759
}

src/utils/email.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const emailRegExp =
2-
// eslint-disable-next-line no-control-regex
32
/(?!.*\.{2})^([a-z\d!#$%&'*+\-/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])$/i;
43

54
export const isEmailValid = (email: string | undefined) => {

src/utils/jwt.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from 'fs';
22
import jsonwebtoken, { SignOptions, VerifyOptions } from 'jsonwebtoken';
3+
import { StringValue } from 'ms';
34
import path from 'path';
45

56
const { JWT_PRI_FILENAME = '', JWT_PUB_FILENAME = '', JWT_ISS = '' } = process.env;
@@ -14,7 +15,7 @@ const tolerance = 10; // 10s tolerance for difference between servers
1415
export type JwtPayload = jsonwebtoken.JwtPayload;
1516
export type VerifyErrors = jsonwebtoken.VerifyErrors;
1617

17-
export const createSignOpt = (sub: string, aud: string, exp: string = '1d'): SignOptions => {
18+
export const createSignOpt = (sub: string, aud: string, exp: StringValue = '1d'): SignOptions => {
1819
return {
1920
algorithm: alg,
2021
expiresIn: exp,
@@ -34,7 +35,7 @@ export const createVerifyOpt = (aud: string | RegExp): VerifyOptions => {
3435
};
3536
};
3637

37-
export const sign = (payload: object, sub: string, aud: string, exp: string = '1d') =>
38+
export const sign = (payload: object, sub: string, aud: string, exp: StringValue = '1d') =>
3839
jsonwebtoken.sign(payload, priFile, createSignOpt(sub, aud, exp));
3940

4041
export const verify = (token: string, aud: string | RegExp) =>

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
"skipLibCheck": true
1313
},
1414
"exclude": ["node_modules", "/src/types/*"],
15-
"include": ["src/**/*.ts"]
15+
"include": ["src/**/*.ts", "test/**/*.ts"]
1616
}

0 commit comments

Comments
 (0)