@simplysm/lint 14.0.23 → 14.0.24

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/package.json +1 -1
  2. package/README.md +0 -157
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/lint",
3
- "version": "14.0.23",
3
+ "version": "14.0.24",
4
4
  "description": "심플리즘 패키지 - ESLint plugin",
5
5
  "author": "심플리즘",
6
6
  "license": "Apache-2.0",
package/README.md DELETED
@@ -1,157 +0,0 @@
1
- # @simplysm/lint
2
-
3
- Shared ESLint plugin and recommended configuration for Simplysm projects.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @simplysm/lint
9
- ```
10
-
11
- ## API Overview
12
-
13
- ### `@simplysm/lint/eslint-plugin`
14
-
15
- | API | Type | Description |
16
- |-----|------|-------------|
17
- | `default` | object | ESLint plugin object (`{ rules: { ... } }`) containing 7 custom rules for Angular/TypeScript projects |
18
-
19
- ```typescript
20
- import plugin from "@simplysm/lint/eslint-plugin";
21
- ```
22
-
23
- #### Rules
24
-
25
- | Rule | Type | Fixable | Description |
26
- |---|---|---|---|
27
- | `ng-template-no-todo-comments` | problem | no | Warn on `<!-- TODO: ... -->` comments inside Angular HTML templates |
28
- | `ng-template-sd-require-binding-attrs` | problem | yes | Disallow non-whitelisted plain attributes on `sd-*` prefixed components; require Angular property bindings (`[attr]="..."`) instead |
29
- | `no-hard-private` | problem | yes | Disallow ES hard private fields (`#field`); autofix to TypeScript `private _field` style. Reports name conflicts when `_field` already exists |
30
- | `no-subpath-imports-from-simplysm` | problem | yes | Disallow importing from `@simplysm/*/src/*` subpaths; autofix to package entrypoint (`@simplysm/pkg`). Covers static imports, dynamic imports, and re-exports |
31
- | `ts-no-throw-not-implemented-error` | suggestion | no | Warn on `new NotImplementedError()` from `@simplysm/core-common` (named, aliased, and namespace imports). Displays the error message argument or "unimplemented" |
32
- | `ts-no-unused-injects` | problem | yes | Disallow unused Angular `inject()` fields; autofix removes the entire field declaration |
33
- | `ts-no-unused-protected-readonly` | problem | yes | Disallow unused `protected readonly` fields in `@Component` classes; checks both class body and inline template references |
34
-
35
- #### `ng-template-sd-require-binding-attrs` Options
36
-
37
- ```typescript
38
- interface RuleOptions {
39
- selectorPrefixes?: string[]; // default: ["sd-"]
40
- allowAttributes?: string[]; // default: ["id", "class", "style", "title", "tabindex", "role"]
41
- allowAttributePrefixes?: string[]; // default: ["aria-", "data-", "sd-"]
42
- }
43
- ```
44
-
45
- | Field | Type | Description |
46
- |-------|------|-------------|
47
- | `selectorPrefixes` | `string[]` | Tag name prefixes that trigger the rule (case-insensitive matching) |
48
- | `allowAttributes` | `string[]` | Exact attribute names allowed as plain attributes (case-insensitive) |
49
- | `allowAttributePrefixes` | `string[]` | Attribute name prefixes allowed as plain attributes (case-insensitive) |
50
-
51
- ### `@simplysm/lint/eslint-recommended`
52
-
53
- | API | Type | Description |
54
- |-----|------|-------------|
55
- | `default` | `FlatConfig.ConfigArray` | Complete ESLint flat config array from `tseslint.config()` |
56
-
57
- ```typescript
58
- import recommended from "@simplysm/lint/eslint-recommended";
59
- ```
60
-
61
- #### Included Configurations
62
-
63
- - `angular-eslint` template recommended + accessibility
64
- - `typescript-eslint` parser and recommended rules
65
- - `eslint-plugin-import` (extraneous dependency checking with `eslint-import-resolver-typescript`)
66
- - `eslint-plugin-unused-imports` (auto-remove unused imports, unused vars with `_` prefix ignored)
67
- - All 7 `@simplysm/lint/eslint-plugin` rules
68
-
69
- #### Key Rules Enabled
70
-
71
- - `eqeqeq` (always, null-ignore)
72
- - `no-console` (error in `.ts` files)
73
- - `no-warning-comments` (warn)
74
- - `@typescript-eslint/require-await`, `await-thenable`, `no-floating-promises`
75
- - `@typescript-eslint/strict-boolean-expressions` (nullable boolean/object allowed)
76
- - `@typescript-eslint/prefer-readonly`
77
- - `@typescript-eslint/no-unnecessary-condition` (constant loop conditions allowed)
78
- - `@typescript-eslint/no-unnecessary-type-assertion`
79
- - `@typescript-eslint/only-throw-error`
80
- - `@typescript-eslint/no-array-delete`
81
- - `@typescript-eslint/no-misused-promises` (void return arguments allowed)
82
- - `@typescript-eslint/ban-ts-comment` (ts-expect-error with description >= 3 chars)
83
- - `@typescript-eslint/return-await` (in-try-catch)
84
- - Bans `Buffer`, `events`, `eventemitter3` imports
85
- - Test files (`**/tests/**/*.ts`): relaxes `no-console`, `import/no-extraneous-dependencies`, `ts-no-throw-not-implemented-error`
86
-
87
- #### File Patterns
88
-
89
- | Pattern | Applied Rules |
90
- |---|---|
91
- | `**/*.js`, `**/*.mjs`, `**/*.cjs` | Common rules + `require-await` + import checks + unused imports + `no-hard-private` + `no-subpath-imports` + Node builtins ban |
92
- | `**/*.ts` | Full TypeScript rules + Angular inline template processing + all custom rules |
93
- | `**/*.html` | Angular template recommended + accessibility + `ng-template-no-todo-comments` + `ng-template-sd-require-binding-attrs` |
94
- | `**/tests/**/*.ts` | Relaxed rules (`no-console` off, extraneous deps off, `ts-no-throw-not-implemented-error` off) |
95
-
96
- #### Ignored Patterns
97
-
98
- - `**/node_modules/**`
99
- - `**/dist/**`
100
- - `**/.*/**`
101
- - `**/_*/**`
102
-
103
- ### Internal Utility: `createRule`
104
-
105
- Factory function wrapping `@typescript-eslint/utils` `RuleCreator` with auto-generated documentation URLs. Used internally by all rule implementations; **not publicly exported** via package entrypoints.
106
-
107
- ```typescript
108
- export const createRule = ESLintUtils.RuleCreator(
109
- (name) =>
110
- `https://github.com/kslhunter/simplysm/blob/master/packages/eslint-plugin/README.md#${name}`,
111
- );
112
- ```
113
-
114
- ## Usage Examples
115
-
116
- ### Use the recommended config
117
-
118
- ```javascript
119
- // eslint.config.js
120
- import recommended from "@simplysm/lint/eslint-recommended";
121
-
122
- export default [
123
- ...recommended,
124
- // add project-specific overrides here
125
- ];
126
- ```
127
-
128
- ### Use plugin rules individually
129
-
130
- ```javascript
131
- // eslint.config.js
132
- import plugin from "@simplysm/lint/eslint-plugin";
133
-
134
- export default [
135
- {
136
- plugins: { "@simplysm": plugin },
137
- rules: {
138
- "@simplysm/no-hard-private": "error",
139
- "@simplysm/ts-no-unused-injects": "error",
140
- },
141
- },
142
- ];
143
- ```
144
-
145
- ### Customize `ng-template-sd-require-binding-attrs` options
146
-
147
- ```javascript
148
- {
149
- rules: {
150
- "@simplysm/ng-template-sd-require-binding-attrs": ["error", {
151
- selectorPrefixes: ["sd-", "app-"], // default: ["sd-"]
152
- allowAttributes: ["id", "class", "style"], // default: ["id", "class", "style", "title", "tabindex", "role"]
153
- allowAttributePrefixes: ["aria-", "data-"], // default: ["aria-", "data-", "sd-"]
154
- }],
155
- },
156
- }
157
- ```