@simplysm/lint 14.0.50 → 14.0.52
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/package.json +1 -1
- package/README.md +0 -131
package/package.json
CHANGED
package/README.md
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
# @simplysm/lint
|
|
2
|
-
|
|
3
|
-
Simplysm 모노레포 전용 ESLint 플러그인 및 공유 Flat Config 설정. 커스텀 규칙 9개와 권장 설정을 제공한다.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @simplysm/lint
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## API Overview
|
|
12
|
-
|
|
13
|
-
### Plugin (`@simplysm/lint/eslint-plugin`)
|
|
14
|
-
|
|
15
|
-
| API | Type | Description |
|
|
16
|
-
|-----|------|-------------|
|
|
17
|
-
| `default` | object | `{ rules: {...} }` 형태의 ESLint 플러그인 객체. 9개의 커스텀 규칙을 포함한다 |
|
|
18
|
-
|
|
19
|
-
#### Rules
|
|
20
|
-
|
|
21
|
-
| Rule | Type | Fixable | Description |
|
|
22
|
-
|------|------|---------|-------------|
|
|
23
|
-
| `no-hard-private` | problem | autofix | ECMAScript `#private` 필드를 금지하고 TypeScript `private _` 스타일을 강제한다. 선언(`#field`, `#method()`, `accessor #field`)과 사용(`this.#field`) 모두 감지. 이름 충돌 시 `nameConflict` 메시지 보고 |
|
|
24
|
-
| `no-subpath-imports-from-simplysm` | problem | autofix | `@simplysm/*` 패키지에서 `src` 하위 경로 import를 금지한다. 정적 import, 동적 import, re-export 모두 감지. `@simplysm/pkg/src/...` -> `@simplysm/pkg`로 자동 수정 |
|
|
25
|
-
| `ts-no-throw-not-implemented-error` | suggestion | - | `@simplysm/core-common`의 `NotImplementedError` 사용을 경고한다. named import, aliased import, namespace import 모두 감지. 동적 import는 미감지 |
|
|
26
|
-
| `ts-no-unused-injects` | problem | autofix | 미사용 Angular `inject()` 필드를 감지하여 제거한다. 클래스 내 `inject()` 호출로 초기화된 프로퍼티 중 다른 곳에서 참조되지 않는 필드를 보고 |
|
|
27
|
-
| `ts-no-unused-protected-readonly` | problem | autofix | Angular `@Component` 클래스의 미사용 `protected readonly` 필드를 감지하여 제거한다. 인라인 템플릿과 클래스 본문 모두에서 참조 여부를 확인 |
|
|
28
|
-
| `ng-no-async-effect` | problem | - | `@angular/core`의 `effect()`에 async 함수를 직접 전달하는 것을 금지한다. `await` 이후의 signal read가 의존성으로 추적되지 않는 함정을 방지. named/aliased/namespace import 모두 감지. 비동기 작업은 `void untracked(async () => { ... })` 내부에서 수행하도록 유도 |
|
|
29
|
-
| `ng-template-no-todo-comments` | problem | - | HTML 템플릿 내 `<!-- TODO: ... -->` 주석을 경고한다. raw text regex 방식으로 동작 |
|
|
30
|
-
| `ng-template-no-strict-null-check` | problem | - | Angular 템플릿에서 `=== null`, `!== null`, `=== undefined`, `!== undefined` 사용을 금지한다. `== null` / `!= null`로 통일하도록 강제. autofix 미제공(인라인 템플릿 offset 매핑 문제) |
|
|
31
|
-
| `ng-template-sd-require-binding-attrs` | problem | autofix | `sd-*` 컴포넌트에서 허용 목록 외 plain attribute 사용을 금지하고 Angular property binding(`[attr]="..."`)을 강제한다 |
|
|
32
|
-
|
|
33
|
-
#### `ng-template-sd-require-binding-attrs` Options
|
|
34
|
-
|
|
35
|
-
유일하게 사용자 옵션을 받는 규칙이다.
|
|
36
|
-
|
|
37
|
-
| Field | Type | Default | Description |
|
|
38
|
-
|-------|------|---------|-------------|
|
|
39
|
-
| `selectorPrefixes` | `string[]` | `["sd-"]` | 검사 대상 엘리먼트의 태그명 접두사 목록 |
|
|
40
|
-
| `allowAttributes` | `string[]` | `["id", "class", "style", "title", "tabindex", "role"]` | plain attribute로 허용할 속성명 목록 |
|
|
41
|
-
| `allowAttributePrefixes` | `string[]` | `["aria-", "data-", "sd-"]` | plain attribute로 허용할 속성명 접두사 목록 |
|
|
42
|
-
|
|
43
|
-
### Recommended Config (`@simplysm/lint/eslint-recommended`)
|
|
44
|
-
|
|
45
|
-
| API | Type | Description |
|
|
46
|
-
|-----|------|-------------|
|
|
47
|
-
| `default` | `FlatConfig.Config[]` | `tseslint.config()`으로 생성된 Flat Config 배열. 커스텀 플러그인과 외부 플러그인을 조합한 권장 설정 |
|
|
48
|
-
|
|
49
|
-
#### Config 블록 구성
|
|
50
|
-
|
|
51
|
-
| 파일 패턴 | 적용 플러그인 | 주요 규칙 |
|
|
52
|
-
|-----------|-------------|-----------|
|
|
53
|
-
| `**/*.js`, `**/*.mjs`, `**/*.cjs` | `@simplysm`, `import`, `unused-imports` | `no-hard-private`, `no-subpath-imports-from-simplysm`, `require-await`, `no-shadow` |
|
|
54
|
-
| `**/*.ts` | `@typescript-eslint`, `@simplysm`, `import`, `unused-imports`, `angular-eslint` | 전체 커스텀 규칙 + `require-await`, `strict-boolean-expressions`, `prefer-readonly`, `only-throw-error`, `no-array-delete` 등 |
|
|
55
|
-
| `**/*.html` | `@simplysm`, `@angular-eslint/template` (recommended + accessibility) | `ng-template-no-strict-null-check`, `ng-template-no-todo-comments`, `ng-template-sd-require-binding-attrs` |
|
|
56
|
-
| `**/tests/**/*.ts` | - | `no-console`, `import/no-extraneous-dependencies`, `ts-no-throw-not-implemented-error` 비활성화 |
|
|
57
|
-
| `**/vitest.config.ts` | - | `no-restricted-properties` 비활성화 (`process.env` 접근 허용) |
|
|
58
|
-
|
|
59
|
-
#### 공유 규칙 변수
|
|
60
|
-
|
|
61
|
-
| Variable | Description |
|
|
62
|
-
|----------|-------------|
|
|
63
|
-
| `commonRules` | `eqeqeq` (`null` 비교만 `==` 허용), `no-warning-comments`, `no-self-compare`, `array-callback-return` |
|
|
64
|
-
| `noNodeBuiltinsRules` | `Buffer` 전역 사용 금지, `buffer`/`events`/`eventemitter3` import 금지 |
|
|
65
|
-
| `noDirectEnvAccessRules` | `process.env` 및 `import.meta.env` 직접 접근 금지 (`env("...")` 사용 강제), `NODE_ENV` 환경변수 사용 금지, `=== undefined` / `!== undefined` 비교 금지 (`== null` / `!= null` 사용 강제) |
|
|
66
|
-
| `unusedImportsRules` | 미사용 import 자동 제거 (`_` 접두사 변수 무시) |
|
|
67
|
-
|
|
68
|
-
#### Ignores
|
|
69
|
-
|
|
70
|
-
`node_modules/`, `dist/`, `.*` (dotfiles), `_*` (underscore-prefixed) 디렉토리를 무시한다.
|
|
71
|
-
|
|
72
|
-
### Utility (internal)
|
|
73
|
-
|
|
74
|
-
| API | Type | Description |
|
|
75
|
-
|-----|------|-------------|
|
|
76
|
-
| `createRule` | const | `ESLintUtils.RuleCreator` 래퍼. 규칙 문서 URL을 자동 생성한다. 패키지 내부에서만 사용되며 entrypoint에서 export되지 않는다 |
|
|
77
|
-
|
|
78
|
-
## Usage Examples
|
|
79
|
-
|
|
80
|
-
### Flat Config에서 권장 설정 사용
|
|
81
|
-
|
|
82
|
-
```typescript
|
|
83
|
-
// eslint.config.js
|
|
84
|
-
import recommended from "@simplysm/lint/eslint-recommended";
|
|
85
|
-
|
|
86
|
-
export default [
|
|
87
|
-
...recommended,
|
|
88
|
-
// 프로젝트별 추가 설정
|
|
89
|
-
];
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### 플러그인만 사용하여 개별 규칙 활성화
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
// eslint.config.js
|
|
96
|
-
import plugin from "@simplysm/lint/eslint-plugin";
|
|
97
|
-
|
|
98
|
-
export default [
|
|
99
|
-
{
|
|
100
|
-
plugins: {
|
|
101
|
-
"@simplysm": plugin,
|
|
102
|
-
},
|
|
103
|
-
rules: {
|
|
104
|
-
"@simplysm/no-hard-private": "error",
|
|
105
|
-
"@simplysm/no-subpath-imports-from-simplysm": "error",
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
];
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### `ng-template-sd-require-binding-attrs` 옵션 커스터마이징
|
|
112
|
-
|
|
113
|
-
```typescript
|
|
114
|
-
// eslint.config.js
|
|
115
|
-
export default [
|
|
116
|
-
...recommended,
|
|
117
|
-
{
|
|
118
|
-
files: ["**/*.html"],
|
|
119
|
-
rules: {
|
|
120
|
-
"@simplysm/ng-template-sd-require-binding-attrs": [
|
|
121
|
-
"error",
|
|
122
|
-
{
|
|
123
|
-
selectorPrefixes: ["sd-", "app-"],
|
|
124
|
-
allowAttributes: ["id", "class", "style", "title", "tabindex", "role", "name"],
|
|
125
|
-
allowAttributePrefixes: ["aria-", "data-", "sd-", "app-"],
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
];
|
|
131
|
-
```
|