Skip to content

Commit 8f69b56

Browse files
committed
feat: support esm moduel for eslint
1 parent 774a224 commit 8f69b56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1039
-576
lines changed

apps/book-server/books/base/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"react-dom": "18"
1919
},
2020
"devDependencies": {
21-
"@types/node": "20.12.5",
2221
"@types/react": "18",
2322
"@types/react-dom": "18",
2423
"typescript": "5"

apps/book-server/package.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,12 @@
7676
"@types/fs-extra": "^11.0.4",
7777
"@types/inquirer": "^9.0.7",
7878
"@types/jest": "^29.5.12",
79-
"@types/node": "^20.12.5",
80-
"@typescript-eslint/eslint-plugin": "^7.13.1",
81-
"@typescript-eslint/parser": "^7.16.0",
8279
"dotenv-cli": "^7.2.1",
83-
"eslint": "^9.5.0",
8480
"inquirer": "^9.2.23",
8581
"jest": "^29.6.4",
8682
"nodemon": "^2.0.22",
8783
"pino-pretty": "^10.0.0",
8884
"prettier": "^3.2.5",
89-
"tsx": "^4.6.2",
90-
"typescript": "^5.4.5"
85+
"tsx": "^4.6.2"
9186
}
9287
}

apps/book-web/package.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,12 @@
5353
"@packages/tsconfig": "workspace:*",
5454
"@testing-library/react": "^14.0.0",
5555
"@types/inquirer": "^9.0.7",
56-
"@types/node": "^20",
5756
"@types/react": "^18",
5857
"@types/react-dom": "^18",
59-
"@typescript-eslint/eslint-plugin": "^7.13.1",
60-
"@typescript-eslint/parser": "^7.16.0",
61-
"eslint": "^9.5.0",
6258
"inquirer": "^9.2.23",
6359
"postcss": "^8",
6460
"prettier": "^3.2.5",
6561
"tailwindcss": "^3.4.1",
66-
"tsx": "^4.7.3",
67-
"typescript": "^5"
62+
"tsx": "^4.7.3"
6863
}
6964
}

apps/cron/package.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,9 @@
5252
"@types/geoip-country": "^4.0.2",
5353
"@types/inquirer": "^9.0.7",
5454
"@types/jest": "^29.5.2",
55-
"@types/node": "^20.12.5",
56-
"@typescript-eslint/eslint-plugin": "^7.13.1",
57-
"@typescript-eslint/parser": "^7.16.0",
58-
"eslint": "^9.5.0",
5955
"nodemon": "^2.0.22",
6056
"ts-paths-esm-loader": "^1.4.3",
6157
"tsc-alias": "^1.8.7",
62-
"tsx": "^4.7.2",
63-
"typescript": "^5.4.5"
58+
"tsx": "^4.7.2"
6459
}
6560
}

apps/server/package.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,11 @@
9393
"@types/jsonwebtoken": "^9.0.2",
9494
"@types/mime-types": "^2.1.1",
9595
"@types/nanoid-dictionary": "^4.2.3",
96-
"@types/node": "^20.12.5",
9796
"@types/qs": "^6.9.7",
9897
"@types/remove-markdown": "^0.3.1",
9998
"@types/sanitize-html": "^2.9.0",
10099
"@types/tmp": "^0.2.3",
101100
"@types/uuid": "^9.0.7",
102-
"eslint": "^9.5.0",
103101
"jest": "^29.6.4",
104102
"jest-mock-axios": "^4.7.3",
105103
"jest-mock-extended": "^3.0.5",
@@ -108,7 +106,6 @@
108106
"ts-jest-mock-import-meta": "^1.0.0",
109107
"ts-paths-esm-loader": "^1.4.3",
110108
"tsc-alias": "^1.8.7",
111-
"tsx": "^4.7.2",
112-
"typescript": "^5.4.5"
109+
"tsx": "^4.7.2"
113110
}
114111
}

apps/web/package.json

-5
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,12 @@
8484
"@types/gtag.js": "^0.0.12",
8585
"@types/inquirer": "^9.0.7",
8686
"@types/jest": "^29.5.2",
87-
"@types/node": "^20.12.5",
8887
"@types/prismjs": "^1.26.2",
8988
"@types/react": "^18.2.48",
9089
"@types/react-dom": "18.2.6",
9190
"@types/sanitize-html": "^2.9.0",
9291
"@types/throttle-debounce": "^5.0.1",
93-
"@typescript-eslint/eslint-plugin": "^7.13.1",
94-
"@typescript-eslint/parser": "^7.16.0",
9592
"encoding": "^0.1.13",
96-
"eslint": "^9.5.0",
97-
"typescript": "^5.4.5",
9893
"typescript-plugin-css-modules": "^5.0.1"
9994
}
10095
}

infrastructure/Pulumi.production.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
config:
22
aws:region: ap-northeast-2
33
velog:DOCKER_ENV: production
4-
velog:target: cron
4+
velog:target: web

infrastructure/Pulumi.stage.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
config:
22
aws:region: ap-northeast-2
33
velog:DOCKER_ENV: stage
4-
velog:target: web
4+
velog:target: web,server,cron

infrastructure/Pulumi.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
name: velog
2-
runtime: nodejs
2+
runtime:
3+
name: nodejs
4+
options:
5+
typescript: true
36
description: velog infrastructure

infrastructure/eslint.config.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import baseConfig from '@packages/eslint-config/base.mjs'
2+
import { resolve } from 'node:path'
3+
4+
const projectPath = resolve(process.cwd())
25

36
/** @type {Linter.Config} */
47
export default [
5-
...baseConfig,
8+
...baseConfig(projectPath),
69
{
710
ignores: ['node_modules', 'dist'],
811
},

infrastructure/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
"@aws-sdk/client-ecr": "^3.413.0",
99
"@aws-sdk/client-ecs": "^3.418.0",
1010
"@aws-sdk/client-ssm": "^3.379.1",
11-
"@pulumi/aws": "^6.27.0",
12-
"@pulumi/awsx": "^2.6.0",
13-
"@pulumi/docker": "^4.5.2",
14-
"@pulumi/pulumi": "^3.111.1",
11+
"@pulumi/aws": "^6.48.0",
12+
"@pulumi/awsx": "^2.14.0",
13+
"@pulumi/docker": "^4.5.5",
14+
"@pulumi/pulumi": "^3.128.0",
1515
"dotenv": "^16.4.5",
1616
"tsx": "^4.7.1",
1717
"zod": "^3.21.4"
1818
},
1919
"devDependencies": {
20-
"@types/node": "^20.12.5",
21-
"eslint": "^9.5.0",
22-
"typescript": "^5.3.3"
20+
"@packages/eslint-config": "workspace:*",
21+
"@packages/tsconfig": "workspace:*",
22+
"ts-node": "^10.9.2"
2323
}
2424
}

infrastructure/src/packages/cron/index.ts renamed to infrastructure/src/apps/cron/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { ENV } from '../../env'
2-
import { CreateInfraParameter } from '../../type'
32
import { createECSfargateService } from '../../common/ecs'
4-
import { createLoadBalancer } from '../../common/loadBalancer'
53
import { createSecurityGroup } from '../../common/securityGroup'
4+
import { CreateInfraParameter } from '../../type'
5+
import { createLoadBalancer } from '../../common/loadBalancer'
66

77
export const createCronInfra = ({
88
vpcId,

infrastructure/src/packages/server/index.ts renamed to infrastructure/src/apps/server/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ENV } from '../../env'
2-
import { CreateInfraParameter } from '../../type'
2+
import type { CreateInfraParameter } from '../../type'
33
import { createECSfargateService } from '../../common/ecs'
44
import { createLoadBalancer } from '../../common/loadBalancer'
55
import { createSecurityGroup } from '../../common/securityGroup'

infrastructure/src/packages/server/subnet.ts renamed to infrastructure/src/apps/server/subnet.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import * as aws from '@pulumi/aws'
2-
import { withPrefix } from '../../lib/prefix'
3-
import { Input } from '@pulumi/pulumi'
1+
import aws from '@pulumi/aws'
2+
3+
import type { Input } from '@pulumi/pulumi'
4+
import { withPrefix } from '../../lib/prefix.js'
45

56
export const createServerSubnet = (vpcId: Input<string>) => {
67
const publicServerSubnet1Name = withPrefix('server-public-subnet-1')

infrastructure/src/common/ecr.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { PackageType } from './../type.d'
21
import * as clientEcr from '@aws-sdk/client-ecr'
32
import * as aws from '@pulumi/aws'
4-
import { withPrefix } from '../lib/prefix'
5-
import { ENV } from '../env'
63
import { Repository } from '@pulumi/aws/ecr'
74
import * as pulumi from '@pulumi/pulumi'
85
import * as docker from '@pulumi/docker'
6+
import { ENV } from '../env'
97
import { getRandomSHA256Hash } from '../lib/hash'
8+
import { withPrefix } from '../lib/prefix'
9+
import type { PackageType } from '../type'
1010

1111
const ecrClient = new clientEcr.ECR({ region: 'ap-northeast-2' })
1212

infrastructure/src/common/ecs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as clientEcs from '@aws-sdk/client-ecs'
55
import { withPrefix } from '../lib/prefix'
66
import { ecsTaskExecutionRole } from './iam'
77
import { ENV } from '../env'
8-
import { CreateECSFargateParams } from '../type'
8+
import type { CreateECSFargateParams } from '../type'
99
import { portMapper } from '../lib/portMapper'
1010
import { ecsOption } from '../lib/ecsOptions'
1111

infrastructure/src/common/loadBalancer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { PackageType } from './../type.d'
21
import * as aws from '@pulumi/aws'
2+
import type { SecurityGroup } from '@pulumi/aws/ec2'
33
import { withPrefix } from '../lib/prefix'
4-
import { SecurityGroup } from '@pulumi/aws/ec2'
54
import { portMapper } from '../lib/portMapper'
5+
import type { PackageType } from '../type'
66

77
type CreateLoadBalancerParameter = {
88
vpcId: Promise<string>

infrastructure/src/common/securityGroup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as aws from '@pulumi/aws'
22
import { withPrefix } from '../lib/prefix'
3-
import { PackageType } from '../type.d'
3+
import { PackageType } from '../type'
44
import { portMapper } from '../lib/portMapper'
55

66
type CreateSecurityGroupParameter = {

infrastructure/src/common/vpc.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-unused-vars */
2-
import { createServerSubnet } from '../packages/server/subnet'
2+
import { createServerSubnet } from '../apps/server/subnet.js'
33
import * as aws from '@pulumi/aws'
44
import { withPrefix } from '../lib/prefix'
55

infrastructure/src/env.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { resolve } from 'node:path'
2+
import { existsSync } from 'node:fs'
13
import * as dotenv from 'dotenv'
24
import * as pulumi from '@pulumi/pulumi'
3-
import { resolve } from 'path'
4-
import { existsSync } from 'fs'
55
import { z } from 'zod'
66

77
const config = new pulumi.Config()

infrastructure/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { CreateInfraParameter, PackageType } from './type.d'
2-
import { createWebInfra } from './packages/web'
3-
import { createServerInfra } from './packages/server'
1+
import { CreateInfraParameter, PackageType } from './type'
2+
import { createWebInfra } from './apps/web'
3+
import { createServerInfra } from './apps/server'
4+
import { createCronInfra } from './apps/cron'
45
import { ENV } from './env'
56
import * as aws from '@pulumi/aws'
67
import * as pulumi from '@pulumi/pulumi'
78

89
import { createVPC } from './common/vpc'
910
import { getCertificate } from './common/certificate'
10-
import { createCronInfra } from './packages/cron'
1111
import { createECRImage, createECRRepository, getECRImage, getECRRepository } from './common/ecr'
1212
import { getCluster } from './common/ecs'
1313

infrastructure/src/lib/execCommand.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { exec } from 'child_process'
1+
import { exec } from 'node:child_process'
22

33
export const execCommand = (command: string) => {
44
exec(command, (error, stdout, _stderr) => {

infrastructure/src/lib/hash.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import crypto from 'crypto'
1+
import crypto from 'node:crypto'
22

33
export const getRandomSHA256Hash = () => {
44
const randomString = crypto.randomBytes(16).toString('hex')

infrastructure/tsconfig.json

+23-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"compilerOptions": {
33
"strict": true,
4-
"outDir": "dist",
54
"target": "es2022",
65
"module": "commonjs",
76
"moduleResolution": "node",
@@ -10,7 +9,28 @@
109
"noFallthroughCasesInSwitch": true,
1110
"noImplicitReturns": true,
1211
"forceConsistentCasingInFileNames": true,
13-
"esModuleInterop": true
12+
"esModuleInterop": true,
13+
"rootDir": "./",
14+
"baseUrl": "./",
15+
"outDir": "./dist",
16+
"paths": {
17+
"@src/*": ["src/*"],
18+
"@common/*": ["src/common/*"],
19+
"@lib/*": ["src/lib/*"],
20+
"@apps/*": ["src/apps/*"]
21+
}
1422
},
15-
"include": ["scripts/**.ts", "src/**/*.ts", "eslint.config.js"]
23+
"include": [
24+
"scripts/**.ts",
25+
"src/*",
26+
"src/**/*.ts",
27+
"src/**/*.mts",
28+
"eslint.config.js",
29+
"src/env.ts",
30+
"src/index.ts"
31+
],
32+
"exclude": ["node_modules", "dist"],
33+
"ts-node": {
34+
"esm": true
35+
}
1636
}

package.json

+10-2
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,19 @@
3333
"blog"
3434
],
3535
"devDependencies": {
36-
"@eslint/eslintrc": "^3.0.2",
36+
"@eslint/eslintrc": "^3.1.0",
3737
"@packages/eslint-config": "workspace:*",
3838
"@packages/tsconfig": "workspace:*",
39+
"@types/eslint": "^9.6.0",
40+
"@types/eslint__js": "^8.42.3",
41+
"@types/node": "^20.14.0",
42+
"@typescript-eslint/eslint-plugin": "^7.13.1",
43+
"@typescript-eslint/parser": "^7.16.0",
44+
"eslint": "^9.9.0",
3945
"husky": "^9.1.4",
40-
"lint-staged": "^15.2.8"
46+
"jiti": "^1.21.6",
47+
"lint-staged": "^15.2.8",
48+
"typescript": "^5.5.4"
4149
},
4250
"resolutions": {
4351
"graphql": "16.8.1",

packages/commonjs/eslint.config.js renamed to packages/commonjs/eslint.config.mts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const projectPath = resolve(process.cwd())
66
/** @type {Linter.Config} */
77
export default [
88
...baseConfig(projectPath),
9+
{},
910
{
1011
ignores: ['node_modules', 'dist'],
1112
},

packages/commonjs/package.json

-7
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,5 @@
2222
"@graphql-tools/load": "^8.0.2",
2323
"@graphql-tools/merge": "^9.0.4",
2424
"axios": "^1.4.0"
25-
},
26-
"devDependencies": {
27-
"@types/node": "^20.14.0",
28-
"@typescript-eslint/eslint-plugin": "^7.13.1",
29-
"@typescript-eslint/parser": "^7.16.0",
30-
"eslint": "^9.5.0",
31-
"typescript": "^5.4.5"
3225
}
3326
}

packages/commonjs/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"typeRoots": ["./node_modules/@types"],
77
"outDir": "./dist"
88
},
9-
"include": ["./src/*", "./scripts/**.mts", "eslint.config.js", "./dist"],
9+
"include": ["./src/*", "./src/*.mts", "./screslint.config.mtsslint.config.js", "./dist"],
1010
"exclude": ["node_modules"]
1111
}

packages/database/package.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@
5252
"@packages/eslint-config": "workspace:*",
5353
"@packages/tsconfig": "workspace:*",
5454
"@types/inquirer": "^9.0.7",
55-
"@types/jest": "^29.5.3",
56-
"@types/node": "^20.12.5",
57-
"@typescript-eslint/eslint-plugin": "^7.13.1",
58-
"@typescript-eslint/parser": "^7.16.0",
59-
"eslint": "^9.5.0",
60-
"typescript": "^5.4.5"
55+
"@types/jest": "^29.5.3"
6156
}
6257
}

0 commit comments

Comments
 (0)