@hyeon/linter 10.0.1-dev.1.29 → 11.0.1-dev.3.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,25 +1,116 @@
1
- ## Installation
1
+ # @hyeon/linter
2
2
 
3
3
  ```bash
4
- npm install --save-dev @hyeon/linter
4
+ npm install --save-dev @hyeon/linter @biomejs/biome
5
5
  ```
6
6
 
7
- ## Usage
7
+ > AI 사용자용: 설치/셋업 가이드는 [`install.md`](./install.md), 사용 예시는 [`USAGE_EXAMPLES.md`](./USAGE_EXAMPLES.md)를 먼저 확인하세요.
8
8
 
9
- ```js
10
- import hyeonLinter from '@hyeon/linter'
9
+ ## 지원 정책
11
10
 
12
- export default [
13
- ...hyeonLinter.react,
14
- ...hyeonLinter.prettier,
15
- ...hyeonLinter.typescript,
16
- ]
17
- ```
11
+ - TypeScript 5.9+ 전용
12
+ - Biome 기반 (lint + format + import organize 단일 도구)
13
+ - ESLint/Prettier 레거시 경로는 v11에서 완전 제거됨
14
+
15
+ ## 왜 Biome인가
16
+
17
+ ### 도구별 속도 벤치마크
18
+
19
+ > 출처: [oxc-project/bench-linter](https://github.com/oxc-project/bench-linter) (VS Code 코드베이스, M2 Max 12코어)
20
+
21
+ | 도구 | Lint 시간 | vs ESLint | Format 시간 | vs Prettier |
22
+ |---|---|---|---|---|
23
+ | **ESLint + Prettier** | 31s | 1x | 1x | 1x |
24
+ | **oxlint + oxfmt** | 139ms | **62x** 빠름 | **30x** 빠름 |
25
+ | **Biome** | 377ms | **~20x** 빠름 | **10x** 빠름 |
26
+
27
+ - oxlint이 Biome보다 ~2.5x 빠르지만, **둘 다 1초 미만**이라 개발자 피드백 루프에 체감 차이 없음
28
+ - 셋 다 **Rust 기반 멀티스레드(rayon)** — 파일 수 증가 시 코어 수에 비례해 스케일
29
+ - ESLint만 **싱글스레드(Node.js)** — 파일 수에 선형 비례해 느려짐
30
+
31
+ ### 룰 커버리지
32
+
33
+ | 도구 | 총 룰 수 | type-aware | auto-fix | 플러그인 생태계 |
34
+ |---|---|---|---|---|
35
+ | **ESLint** | 700+ (+4000 플러그인) | ✅ 완전 | ✅ 우수 | 4000+ |
36
+ | **Biome v2** | 423+ | ✅ v2 추가 | ✅ 양호 | 성장 중 |
37
+ | **oxlint** | ~300 | ✅ tsgolint 43룰 | ⚠️ 제한적 | 최소 |
38
+
39
+ ### import DX 커버리지 — Biome 선택 이유
40
+
41
+ | 기능 | ESLint 레거시 | oxlint+oxfmt | Biome |
42
+ |---|:---:|:---:|:---:|
43
+ | import 그룹 정렬 | ✅ | ✅ | ✅ |
44
+ | specifier 정렬 `{ a, B, c }` | ✅ | ❌ | ✅ |
45
+ | 중복 import 병합 | ✅ | ❌ | ✅ 자동 merge |
46
+ | import 최상단 강제 | ✅ | ❌ | ✅ chunk 기반 |
47
+ | import 뒤 빈 줄 | ✅ | ❌ | ✅ `:BLANK_LINE:` |
48
+ | consistent-type-imports | ✅ | ❌ | ✅ `useImportType` |
49
+ | 그룹 간 빈 줄 | ✅ | ⚠️ bool만 | ✅ `:BLANK_LINE:` |
50
+ | side-effect import 처리 | 수동 | 무시 | ✅ auto chunk |
51
+ | custom group (glob) | ❌ | 일부 | ✅ glob + `!` 예외 |
52
+
53
+ **oxlint+oxfmt은 속도 최강이지만 import DX 격차가 일상 코딩에 매번 영향을 줌. Biome은 기존 ESLint 경험의 대부분을 보존하면서 충분히 빠름.**
54
+
55
+ ### 요약 매트릭스
18
56
 
19
- ## vite
57
+ | | 속도 | 룰 커버리지 | import DX | 단일 도구 | auto-fix |
58
+ |---|:---:|:---:|:---:|:---:|:---:|
59
+ | **oxlint+oxfmt** | ⭐⭐⭐ | ⭐⭐ | ⭐ | ❌ 2개 | ⚠️ |
60
+ | **Biome** | ⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ | ✅ 1개 | ✅ |
61
+ | **ESLint+Prettier** | ⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ❌ 2개+ | ✅ |
20
62
 
21
- uninstall
63
+ ## 사용 가이드
64
+
65
+ ### 린트 + 포맷 (`biome.json`)
66
+
67
+ ```jsonc
68
+ {
69
+ "$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
70
+ "linter": {
71
+ "enabled": true,
72
+ "rules": { "recommended": true }
73
+ },
74
+ "formatter": {
75
+ "enabled": true,
76
+ "indentStyle": "space",
77
+ "indentWidth": 2,
78
+ "lineWidth": 120
79
+ },
80
+ "assist": {
81
+ "actions": {
82
+ "source": {
83
+ "organizeImports": "on"
84
+ }
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ ### 실행
22
91
 
23
92
  ```bash
24
- eslint-plugin-react-hooks eslint-plugin-react-refresh typescript-eslint globals @eslint/js
93
+ # 린트 + 포맷 + import 정리 한 번에
94
+ npx @biomejs/biome check --write .
95
+
96
+ # CI (검사만, 수정 없음)
97
+ npx @biomejs/biome ci .
25
98
  ```
99
+
100
+ ## v10 → v11 마이그레이션
101
+
102
+ v11은 **Breaking Change**입니다. ESLint/Prettier를 Biome으로 완전 교체합니다.
103
+
104
+ ### 제거된 항목
105
+
106
+ - ESLint 설정 export (`./recommended`, `./typescript`, `./react`, `./prettier`, `./hansanghyeon`)
107
+ - `eslint`, `prettier` peerDependencies
108
+ - 모든 ESLint/Prettier 플러그인 의존성
109
+
110
+ ### 마이그레이션 방법
111
+
112
+ 1. `eslint.config.mjs` 삭제
113
+ 2. `biome.json` 생성 (위 예시 참고)
114
+ 3. `eslint`, `prettier` 및 관련 플러그인 devDependencies 제거
115
+ 4. `@biomejs/biome` 설치
116
+ 5. lint 스크립트를 `biome check` 또는 `biome ci` 로 변경
package/biome.jsonc ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.4.11/schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true
7
+ },
8
+ "linter": {
9
+ "enabled": true,
10
+ "rules": {
11
+ "recommended": true,
12
+ "suspicious": {
13
+ "noExplicitAny": "off"
14
+ },
15
+ "style": {
16
+ "useImportType": {
17
+ "level": "error",
18
+ "options": { "style": "inlineType" }
19
+ },
20
+ "noUnusedTemplateLiteral": "off"
21
+ },
22
+ "correctness": {
23
+ "noUnusedVariables": "error",
24
+ "noUnusedImports": "error"
25
+ },
26
+ "nursery": {}
27
+ }
28
+ },
29
+ "formatter": {
30
+ "enabled": true,
31
+ "indentStyle": "space",
32
+ "indentWidth": 2,
33
+ "lineWidth": 120,
34
+ "lineEnding": "lf"
35
+ },
36
+ "javascript": {
37
+ "formatter": {
38
+ "quoteStyle": "single",
39
+ "jsxQuoteStyle": "double",
40
+ "trailingCommas": "all",
41
+ "semicolons": "asNeeded",
42
+ "arrowParentheses": "always"
43
+ }
44
+ },
45
+ "assist": {
46
+ "actions": {
47
+ "source": {
48
+ "organizeImports": {
49
+ "level": "on",
50
+ "options": {
51
+ "groups": [
52
+ ":URL:",
53
+ [":BUN:", ":NODE:"],
54
+ ":BLANK_LINE:",
55
+ ":PACKAGE:",
56
+ ":BLANK_LINE:",
57
+ ":ALIAS:",
58
+ ":BLANK_LINE:",
59
+ ":PATH:"
60
+ ]
61
+ }
62
+ }
63
+ }
64
+ }
65
+ },
66
+ "overrides": [
67
+ {
68
+ "includes": ["*.json", "*.jsonc"],
69
+ "formatter": {
70
+ "indentWidth": 2
71
+ }
72
+ },
73
+ {
74
+ "includes": ["test/src/fixtures/**", "test/src/examples/**"],
75
+ "linter": { "enabled": false },
76
+ "assist": { "enabled": false }
77
+ }
78
+ ]
79
+ }
package/package.json CHANGED
@@ -1,70 +1,54 @@
1
1
  {
2
2
  "name": "@hyeon/linter",
3
- "version": "10.0.1-dev.1.29",
4
- "description": "Hansanghyun custom eslint settings",
3
+ "version": "11.0.1-dev.3.43",
4
+ "description": "Biome-based lint, format, and import organize configuration",
5
5
  "main": "./src/index.mjs",
6
+ "type": "module",
6
7
  "scripts": {
7
- "lint": "eslint src/",
8
- "test": "npm run lint"
8
+ "lint": "biome ci .",
9
+ "lint:fix": "biome check --write .",
10
+ "test": "npm run lint && npm --prefix test run test:all"
9
11
  },
10
12
  "repository": {
11
13
  "type": "git",
12
- "url": "git+https://git.hyeon.pro/hansanghyeon/linter.git"
14
+ "url": "git+https://git.hyeon.pro/space/tools/linter.git"
13
15
  },
14
16
  "keywords": [
15
- "eslint",
16
- "eslintconfig",
17
+ "biome",
18
+ "linter",
19
+ "formatter",
17
20
  "hyeon",
18
21
  "javascript",
19
22
  "react",
20
23
  "nextjs",
21
24
  "nestjs",
22
- "typescript",
23
- "prettier"
25
+ "typescript"
24
26
  ],
25
27
  "author": "hyeon",
26
28
  "license": "MIT",
27
29
  "bugs": {
28
- "url": "https://git.hyeon.pro/hansanghyeon/linter/issues"
30
+ "url": "https://git.hyeon.pro/space/tools/linter/issues"
29
31
  },
30
- "homepage": "https://git.hyeon.pro/hansanghyeon/linter#readme",
32
+ "homepage": "https://git.hyeon.pro/space/tools/linter#readme",
31
33
  "dependencies": {
32
- "@eslint/js": "^10.0.1",
33
- "@trivago/prettier-plugin-sort-imports": "^6.0.2",
34
- "eslint-config-prettier": "^10.1.8",
35
- "eslint-plugin-import-x": "^4.16.1",
36
- "eslint-plugin-prettier": "^5.5.5",
37
- "eslint-plugin-react": "^7.37.5",
38
- "eslint-plugin-react-refresh": "^0.5.0",
39
- "prettier": "^3.5.3",
40
- "prettier-plugin-tailwindcss": "^0.7.2",
41
- "typescript": "^5.9.3",
42
- "typescript-eslint": "^8.55.0"
34
+ "typescript": "^5.9.3"
43
35
  },
44
36
  "peerDependencies": {
45
- "eslint": "^10.0.0",
46
- "prettier": "^3.5.3"
37
+ "@biomejs/biome": ">=2.0.0"
47
38
  },
48
39
  "devDependencies": {
49
- "eslint": "^10.0.0"
40
+ "@biomejs/biome": "^2.4.11"
50
41
  },
51
42
  "exports": {
52
43
  ".": {
53
44
  "import": "./src/index.mjs",
54
- "require": "./src/index.mjs",
55
45
  "default": "./src/index.mjs"
56
46
  },
57
- "./recommended": "./src/base.mjs",
58
- "./typescript": "./src/typescript.mjs",
59
- "./react": "./src/react.mjs",
60
- "./prettier": "./src/prettier.mjs",
61
- "./hansanghyeon": "./src/hansanghyeon.mjs",
47
+ "./biome-config": "./biome.jsonc",
62
48
  "./package.json": "./package.json"
63
49
  },
64
50
  "files": [
65
- "typescript",
66
- "react",
67
- "prettier",
68
- "src"
51
+ "src",
52
+ "biome.jsonc"
69
53
  ]
70
54
  }
package/src/index.mjs CHANGED
@@ -1,29 +1,23 @@
1
- import hyeonEslintConfigBase from './base.mjs'
2
- import hyeonEslintConfigHansanghyeon from './hansanghyeon.mjs'
3
- import hyeonEslintConfigPrettier from './prettier.mjs'
4
- import hyeonEslintConfigReact from './react.mjs'
5
- import hyeonEslintConfigTypescript from './typescript.mjs'
1
+ import { readFileSync } from 'node:fs'
2
+ import { dirname, join } from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
6
4
 
7
- // 기존 사용자를 위한 객체 형태 유지 (각 속성이 flat config 배열)
5
+ const __dirname = dirname(fileURLToPath(import.meta.url))
8
6
 
9
- const configs = {
10
- recommended: hyeonEslintConfigBase,
11
- prettier: hyeonEslintConfigPrettier,
12
- react: hyeonEslintConfigReact,
13
- typescript: hyeonEslintConfigTypescript,
14
- hansanghyeon: hyeonEslintConfigHansanghyeon,
15
- }
16
-
17
- // Default export는 설정 객체
18
-
19
- export default configs
7
+ /**
8
+ * @hyeon/linter Biome 설정을 반환합니다.
9
+ * biome.jsonc를 파싱하여 JSON 객체로 제공합니다.
10
+ */
11
+ export function getConfig() {
12
+ const configPath = join(__dirname, '..', 'biome.jsonc')
13
+ const raw = readFileSync(configPath, 'utf8')
20
14
 
21
- // Named exports로도 개별 설정 제공
22
-
23
- export {
24
- hyeonEslintConfigBase as recommended,
25
- hyeonEslintConfigPrettier as prettier,
26
- hyeonEslintConfigReact as react,
27
- hyeonEslintConfigTypescript as typescript,
28
- hyeonEslintConfigHansanghyeon as hansanghyeon,
15
+ // JSONC 파싱 (주석/trailing comma 제거)
16
+ const stripped = raw
17
+ .replace(/\/\*[\s\S]*?\*\//g, '')
18
+ .replace(/(^|[^:])\/\/.*$/gm, '$1')
19
+ .replace(/,\s*([\]}])/g, '$1')
20
+ return JSON.parse(stripped)
29
21
  }
22
+
23
+ export default getConfig
package/src/base.mjs DELETED
@@ -1,3 +0,0 @@
1
- import js from '@eslint/js'
2
-
3
- export default [js.configs.recommended]
@@ -1,50 +0,0 @@
1
- import importX from 'eslint-plugin-import-x'
2
-
3
- const _import = [
4
- importX.flatConfigs.recommended,
5
- {
6
- rules: {
7
- 'import-x/first': 'error',
8
- 'import-x/newline-after-import': 'error',
9
- 'import-x/no-duplicates': 'error',
10
- 'import-x/no-unresolved': 'off',
11
- },
12
- },
13
- ]
14
-
15
- const custom = {
16
- rules: {
17
- 'no-empty-pattern': 'off',
18
- 'lines-around-comment': 'off',
19
- camelcase: 'off',
20
- 'class-methods-use-this': 'off',
21
- 'no-multi-spaces': [
22
- 'error',
23
- {
24
- ignoreEOLComments: true,
25
- },
26
- ],
27
-
28
- // 보일러플레이트 코드를 생성할때 {} 를 사용하는 경우가 많아서 off
29
-
30
- '@typescript-eslint/no-empty-object-type': 'off',
31
- '@typescript-eslint/no-explicit-any': 'off',
32
- '@typescript-eslint/no-unused-vars': [
33
- 'error',
34
- {
35
- vars: 'all',
36
- varsIgnorePattern: '^_.*$|^_$|^P$|^flow$|^pipe$',
37
- args: 'all',
38
- argsIgnorePattern: '^_.*$|^_$|^P$|^flow$|^pipe$',
39
- caughtErrors: 'all',
40
- caughtErrorsIgnorePattern: '^_.*$|^_$|^P$|^flow$|^pipe$',
41
- destructuredArrayIgnorePattern: '^_.*$|^_$|^P$|^flow$|^pipe$',
42
- ignoreRestSiblings: true,
43
- },
44
- ],
45
- 'no-confusing-arrow': 'off',
46
- },
47
- ignores: ['.config/*', 'eslint.config.mjs', 'eslint.config.js'],
48
- }
49
-
50
- export default [custom, ..._import]
package/src/prettier.mjs DELETED
@@ -1,68 +0,0 @@
1
- import eslintConfigPrettier from 'eslint-config-prettier'
2
- import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
3
-
4
- export default [
5
- eslintConfigPrettier,
6
- {
7
- ...eslintPluginPrettierRecommended,
8
- rules: {
9
- 'prettier/prettier': [
10
- 'error',
11
- {
12
- trailingComma: 'all',
13
- singleQuote: true,
14
- semi: false,
15
- tabWidth: 2,
16
- printWidth: 120,
17
- arrowParens: 'always',
18
- jsxSingleQuote: false,
19
- plugins: ['@trivago/prettier-plugin-sort-imports', 'prettier-plugin-tailwindcss'],
20
- importOrder: ['^[^.](.*)$', '^[.]{1,2}/.*$'],
21
- importOrderSeparation: false,
22
- importOrderSortSpecifiers: true,
23
-
24
- /**
25
- * @see https://github.com/trivago/prettier-plugin-sort-imports/issues/120
26
- */
27
-
28
- importOrderParserPlugins: ['typescript', 'decorators-legacy', 'jsx', 'classProperties'],
29
- },
30
- ],
31
- 'arrow-body-style': ['error', 'as-needed'],
32
- 'prefer-arrow-callback': 'error',
33
- curly: ['error', 'all'],
34
- 'lines-around-comment': [
35
- 'error',
36
- {
37
- beforeBlockComment: true,
38
- afterBlockComment: true,
39
- beforeLineComment: true,
40
- afterLineComment: true,
41
- allowBlockStart: true,
42
- allowBlockEnd: true,
43
- allowObjectStart: true,
44
- allowObjectEnd: true,
45
- allowArrayStart: true,
46
- allowArrayEnd: true,
47
- },
48
- ],
49
- 'max-len': 'off',
50
- 'no-confusing-arrow': [
51
- 'error',
52
- {
53
- allowParens: false,
54
- },
55
- ],
56
- 'no-mixed-operators': 'error',
57
- 'no-tabs': 'error',
58
- quotes: [
59
- 'error',
60
- 'single',
61
- {
62
- avoidEscape: true,
63
- allowTemplateLiterals: false,
64
- },
65
- ],
66
- },
67
- },
68
- ]
package/src/react.mjs DELETED
@@ -1,17 +0,0 @@
1
- import react from 'eslint-plugin-react'
2
- import { reactRefresh } from 'eslint-plugin-react-refresh'
3
-
4
- export default [
5
- {
6
- settings: { react: { version: '19.0' } },
7
- plugins: {
8
- react,
9
- 'react-refresh': reactRefresh.plugin,
10
- },
11
- rules: {
12
- ...react.configs.recommended.rules,
13
- ...react.configs['jsx-runtime'].rules,
14
- ...reactRefresh.configs.recommended().rules,
15
- },
16
- },
17
- ]
@@ -1,50 +0,0 @@
1
- import js from '@eslint/js'
2
- import eslintConfigPrettier from 'eslint-config-prettier'
3
- import tseslint from 'typescript-eslint'
4
-
5
- // tseslint.config()는 이미 flat config 배열을 반환
6
-
7
- const config = [
8
- {
9
- ignores: ['**/node_modules/**', '**/dist/**', '**/.turbo/**', '**/coverage/**'],
10
- },
11
- js.configs.recommended,
12
- ...tseslint.configs.recommended,
13
- eslintConfigPrettier,
14
- {
15
- files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
16
- languageOptions: {
17
- parser: tseslint.parser,
18
- parserOptions: {
19
- ecmaVersion: 'latest',
20
- sourceType: 'module',
21
- ecmaFeatures: {
22
- decorators: true,
23
- },
24
- },
25
- },
26
- rules: {
27
- '@typescript-eslint/no-explicit-any': 'off',
28
- '@typescript-eslint/no-unused-vars': [
29
- 'error',
30
- {
31
- argsIgnorePattern: '^_',
32
- varsIgnorePattern: '^_',
33
- },
34
- ],
35
- '@typescript-eslint/consistent-type-imports': [
36
- 'error',
37
- {
38
- prefer: 'type-imports',
39
- fixStyle: 'inline-type-imports',
40
- disallowTypeAnnotations: false,
41
- },
42
- ],
43
- '@typescript-eslint/explicit-function-return-type': 'off',
44
- '@typescript-eslint/explicit-module-boundary-types': 'off',
45
- '@typescript-eslint/no-non-null-assertion': 'off',
46
- },
47
- },
48
- ]
49
-
50
- export default config