@simplysm/eslint-plugin 12.16.30 → 12.16.35

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.
Files changed (2) hide show
  1. package/README.md +166 -0
  2. package/package.json +4 -4
package/README.md ADDED
@@ -0,0 +1,166 @@
1
+ # @simplysm/eslint-plugin
2
+
3
+ ESLint plugin with custom rules and a shared flat config for Simplysm monorepo projects. Provides a ready-to-use `root` config and 9 custom rules covering TypeScript best practices, Angular template conventions, and Simplysm-specific import restrictions.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @simplysm/eslint-plugin
9
+ ```
10
+
11
+ ## API Overview
12
+
13
+ ### Plugin Export
14
+
15
+ | API | Type | Description |
16
+ |-----|------|-------------|
17
+ | `default` | Plugin object | Default export with `configs.root` and 9 custom rules |
18
+
19
+ ### Custom Rules
20
+
21
+ | Rule | Type | Description |
22
+ |------|------|-------------|
23
+ | `ts-no-throw-not-implement-error` | suggestion | Warns on `NotImplementError` usage |
24
+ | `ts-no-exported-types` | problem | Forbids specified types from being exposed in export APIs or public class members |
25
+ | `ts-no-buffer-in-typedarray-context` | problem | Forbids using `Buffer` where a TypedArray is expected |
26
+ | `ng-template-no-todo-comments` | problem | Warns on TODO comments in Angular HTML templates |
27
+ | `no-subpath-imports-from-simplysm` | problem | Forbids subpath imports from `@simplysm` packages (e.g., `@simplysm/pkg/src/x`) |
28
+ | `ng-template-sd-require-binding-attrs` | problem | Requires binding syntax for attributes on `sd-` prefixed components |
29
+ | `no-hard-private` | problem | Enforces TypeScript `private _` style over ECMAScript `#` private fields (auto-fixable) |
30
+ | `ts-no-unused-injects` | problem | Disallows unused Angular `inject()` fields (auto-fixable) |
31
+ | `ts-no-unused-protected-readonly` | problem | Disallows unused `protected readonly` fields in Angular components (auto-fixable) |
32
+
33
+ ## API Reference
34
+
35
+ ### Default Export
36
+
37
+ ```typescript
38
+ export default {
39
+ configs: {
40
+ root: FlatConfig[]
41
+ }
42
+ }
43
+ ```
44
+
45
+ The plugin object contains:
46
+ - `configs.root` -- A flat ESLint config array that sets up all recommended rules for Simplysm projects
47
+
48
+ ### `configs.root`
49
+
50
+ A complete flat ESLint configuration array that includes:
51
+
52
+ - **Global ignores**: `node_modules/`, `dist/`, `tests/`, `.*`, `_*`
53
+ - **Language globals**: Node.js, ES2021, and browser globals
54
+ - **JS/JSX rules**: `eqeqeq`, `no-console` (warn), `no-shadow`, `require-await`, unused imports enforcement, import dependency checks, and Simplysm rules (`no-subpath-imports-from-simplysm`, `no-hard-private`)
55
+ - **TS/TSX rules**: All JS rules plus TypeScript-specific rules (`strict-boolean-expressions`, `no-floating-promises`, `return-await`, `prefer-readonly`, `typedef`, `no-unnecessary-condition`, etc.), Angular ESLint inline template processing, and additional Simplysm rules (`ts-no-throw-not-implement-error`, `ts-no-unused-injects`, `ts-no-unused-protected-readonly`)
56
+ - **HTML rules**: Angular template parser with `ng-template-no-todo-comments` and `ng-template-sd-require-binding-attrs`
57
+
58
+ ### `ts-no-throw-not-implement-error`
59
+
60
+ Warns when `NotImplementError` is thrown, flagging unfinished implementations.
61
+
62
+ ```javascript
63
+ "@simplysm/ts-no-throw-not-implement-error": ["warn"]
64
+ ```
65
+
66
+ ### `ts-no-exported-types`
67
+
68
+ Forbids specified types from appearing in exported APIs or public class members, suggesting safer alternatives.
69
+
70
+ ```javascript
71
+ "@simplysm/ts-no-exported-types": ["error", {
72
+ types: [
73
+ { ban: "ArrayBuffer", safe: "Buffer", ignoreInGeneric: true },
74
+ { ban: "Uint8Array", safe: "Buffer" },
75
+ ]
76
+ }]
77
+ ```
78
+
79
+ ### `ts-no-buffer-in-typedarray-context`
80
+
81
+ Prevents using `Buffer` in contexts where a standard TypedArray (e.g., `Uint8Array`) is expected.
82
+
83
+ ```javascript
84
+ "@simplysm/ts-no-buffer-in-typedarray-context": ["error"]
85
+ ```
86
+
87
+ ### `ng-template-no-todo-comments`
88
+
89
+ Warns on TODO/FIXME comments found in Angular HTML templates.
90
+
91
+ ```javascript
92
+ "@simplysm/ng-template-no-todo-comments": ["warn"]
93
+ ```
94
+
95
+ ### `no-subpath-imports-from-simplysm`
96
+
97
+ Forbids deep subpath imports from `@simplysm` packages. Only the package entry point is allowed.
98
+
99
+ ```javascript
100
+ "@simplysm/no-subpath-imports-from-simplysm": ["error"]
101
+ ```
102
+
103
+ ### `ng-template-sd-require-binding-attrs`
104
+
105
+ Requires binding syntax (`[attr]`, `(event)`, etc.) for attributes on components with `sd-` prefix selectors. Plain HTML attributes like `id`, `class`, `style`, `title`, `tabindex`, `role`, and attributes with `aria-`, `data-`, `sd-` prefixes are allowed.
106
+
107
+ ```javascript
108
+ "@simplysm/ng-template-sd-require-binding-attrs": ["error"]
109
+ ```
110
+
111
+ ### `no-hard-private`
112
+
113
+ Enforces TypeScript `private _` convention over ECMAScript `#` private fields. Auto-fixable.
114
+
115
+ ```javascript
116
+ "@simplysm/no-hard-private": ["error"]
117
+ ```
118
+
119
+ ### `ts-no-unused-injects`
120
+
121
+ Disallows unused Angular `inject()` fields. Auto-fixable -- removes the unused field.
122
+
123
+ ```javascript
124
+ "@simplysm/ts-no-unused-injects": ["error"]
125
+ ```
126
+
127
+ ### `ts-no-unused-protected-readonly`
128
+
129
+ Disallows unused `protected readonly` fields in Angular components. A field is considered "used" if it appears in the class body or the component's template. Auto-fixable.
130
+
131
+ ```javascript
132
+ "@simplysm/ts-no-unused-protected-readonly": ["error"]
133
+ ```
134
+
135
+ ## Usage Examples
136
+
137
+ ### Using the root config (recommended)
138
+
139
+ ```javascript
140
+ // eslint.config.js
141
+ import simplysm from "@simplysm/eslint-plugin";
142
+
143
+ export default [
144
+ ...simplysm.configs.root,
145
+ ];
146
+ ```
147
+
148
+ ### Using individual rules
149
+
150
+ ```javascript
151
+ // eslint.config.js
152
+ import simplysm from "@simplysm/eslint-plugin";
153
+
154
+ export default [
155
+ {
156
+ plugins: {
157
+ "@simplysm": simplysm,
158
+ },
159
+ rules: {
160
+ "@simplysm/no-hard-private": ["error"],
161
+ "@simplysm/no-subpath-imports-from-simplysm": ["error"],
162
+ "@simplysm/ts-no-unused-injects": ["error"],
163
+ },
164
+ },
165
+ ];
166
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/eslint-plugin",
3
- "version": "12.16.30",
3
+ "version": "12.16.35",
4
4
  "description": "심플리즘 패키지 - ESLINT 플러그인",
5
5
  "author": "김석래",
6
6
  "repository": {
@@ -14,7 +14,7 @@
14
14
  "dependencies": {
15
15
  "@angular-eslint/utils": "^20.7.0",
16
16
  "@eslint/compat": "^2.0.3",
17
- "@typescript-eslint/utils": "^8.57.0",
17
+ "@typescript-eslint/utils": "^8.57.1",
18
18
  "angular-eslint": "^20.7.0",
19
19
  "eslint": "^9.39.4",
20
20
  "eslint-import-resolver-typescript": "^4.4.4",
@@ -22,9 +22,9 @@
22
22
  "eslint-plugin-unused-imports": "^4.4.1",
23
23
  "globals": "^16.5.0",
24
24
  "typescript": "~5.8.3",
25
- "typescript-eslint": "^8.57.0"
25
+ "typescript-eslint": "^8.57.1"
26
26
  },
27
27
  "devDependencies": {
28
- "@typescript-eslint/rule-tester": "^8.57.0"
28
+ "@typescript-eslint/rule-tester": "^8.57.1"
29
29
  }
30
30
  }