Skip to content

Commit 3e08513

Browse files
committed
feat: 완성도 높은 테스트 및 린트 설정 추가
- 체계적인 테스트 구조 구축 (32개 테스트 케이스) - config.test.js: 설정 관리 테스트 - url-handler.test.js: URL 파싱 및 보안 검증 테스트 - cli-commands.test.js: CLI 명령어 테스트 - ESLint 9.x 최신 설정 및 보안 규칙 추가 - CI에서 타입 체크 제거로 빌드 시간 단축 - 테스트 커버리지 및 린트 스크립트 추가 - 코드 품질 향상 및 보안 취약점 방지
1 parent 71d1952 commit 3e08513

File tree

11 files changed

+4718
-1082
lines changed

11 files changed

+4718
-1082
lines changed

.github/workflows/check.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@ jobs:
2323
- name: Install dependencies
2424
uses: ./.github/actions/setup
2525

26-
types:
27-
name: Types
28-
runs-on: ubuntu-latest
29-
timeout-minutes: 10
30-
steps:
31-
- uses: actions/checkout@v4
32-
- name: Install dependencies
33-
uses: ./.github/actions/setup
34-
- run: pnpm check
35-
3626
lint:
3727
name: Lint
3828
runs-on: ubuntu-latest

eslint.config.mjs

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as effectEslint from "@effect/eslint-plugin"
21
import { fixupPluginRules } from "@eslint/compat"
32
import { FlatCompat } from "@eslint/eslintrc"
43
import js from "@eslint/js"
@@ -19,13 +18,13 @@ const compat = new FlatCompat({
1918

2019
export default [
2120
{
22-
ignores: ["**/dist", "**/build", "**/docs", "**/*.md"]
21+
ignores: ["**/dist", "**/build", "**/docs", "**/*.md", "**/node_modules", "**/test-cli.cjs", "eslint.config.mjs", "scripts/**"]
2322
},
2423
...compat.extends(
2524
"eslint:recommended"
2625
),
27-
...effectEslint.configs.dprint,
2826
{
27+
files: ["**/*.js", "**/*.mjs", "**/*.cjs"],
2928
plugins: {
3029
import: fixupPluginRules(_import),
3130
"sort-destructure-keys": sortDestructureKeys,
@@ -35,7 +34,24 @@ export default [
3534

3635
languageOptions: {
3736
ecmaVersion: 2018,
38-
sourceType: "module"
37+
sourceType: "module",
38+
globals: {
39+
// Node.js globals
40+
console: "readonly",
41+
process: "readonly",
42+
Buffer: "readonly",
43+
__dirname: "readonly",
44+
__filename: "readonly",
45+
global: "readonly",
46+
module: "readonly",
47+
require: "readonly",
48+
exports: "readonly",
49+
setTimeout: "readonly",
50+
clearTimeout: "readonly",
51+
setInterval: "readonly",
52+
clearInterval: "readonly",
53+
URL: "readonly"
54+
}
3955
},
4056

4157
rules: {
@@ -54,7 +70,8 @@ export default [
5470
}
5571
],
5672

57-
"no-unused-vars": "off",
73+
"no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "caughtErrorsIgnorePattern": "^_" }],
74+
"no-console": "off",
5875
"prefer-rest-params": "off",
5976
"prefer-spread": "off",
6077
"import/first": "error",
@@ -66,20 +83,37 @@ export default [
6683
"sort-destructure-keys/sort-destructure-keys": "error",
6784
"deprecation/deprecation": "off",
6885

69-
"@effect/dprint": [
70-
"error",
71-
{
72-
config: {
73-
indentWidth: 2,
74-
lineWidth: 120,
75-
semiColons: "asi",
76-
quoteStyle: "alwaysDouble",
77-
trailingCommas: "never",
78-
operatorPosition: "maintain",
79-
"arrowFunction.useParentheses": "force"
80-
}
81-
}
82-
]
86+
// Security-related rules
87+
"no-eval": "error",
88+
"no-implied-eval": "error",
89+
"no-new-func": "error",
90+
"no-script-url": "error",
91+
92+
// Code quality rules
93+
"eqeqeq": ["error", "always"],
94+
"no-var": "error",
95+
"prefer-const": "error",
96+
"no-duplicate-imports": "error"
97+
}
98+
},
99+
{
100+
files: ["test/**/*.js", "**/*.test.js"],
101+
languageOptions: {
102+
globals: {
103+
// Vitest globals
104+
describe: "readonly",
105+
it: "readonly",
106+
test: "readonly",
107+
expect: "readonly",
108+
beforeEach: "readonly",
109+
afterEach: "readonly",
110+
beforeAll: "readonly",
111+
afterAll: "readonly",
112+
vi: "readonly"
113+
}
114+
},
115+
rules: {
116+
"no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "caughtErrorsIgnorePattern": "^_" }]
83117
}
84118
}
85119
]

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,22 @@
2020
"build": "mkdir -p dist/bin && cp src/bin-simple.js dist/bin-simple.cjs && cp src/bin/fopen-handler-simple.js dist/bin/fopen-handler-simple.cjs && node scripts/copy-package-json.js",
2121
"clean": "rimraf dist/*",
2222
"test": "vitest run",
23+
"test:watch": "vitest",
24+
"test:coverage": "vitest run --coverage",
25+
"lint": "eslint . --ext .js,.mjs,.cjs",
26+
"lint:fix": "eslint . --ext .js,.mjs,.cjs --fix",
2327
"copy-package-json": "node scripts/copy-package-json.js"
2428
},
2529
"devDependencies": {
30+
"@eslint/compat": "^1.2.0",
31+
"@eslint/eslintrc": "^3.0.0",
32+
"@eslint/js": "^9.0.0",
33+
"@vitest/coverage-v8": "3.2.4",
34+
"eslint": "^9.0.0",
35+
"eslint-plugin-codegen": "^0.33.0",
36+
"eslint-plugin-import": "^2.29.0",
37+
"eslint-plugin-simple-import-sort": "^12.0.0",
38+
"eslint-plugin-sort-destructure-keys": "^1.5.0",
2639
"vitest": "^3.2.0"
2740
},
2841
"dependencies": {

0 commit comments

Comments
 (0)