@simplysm/lint 13.0.69 → 13.0.71
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 +12 -490
- package/dist/eslint-recommended.js +41 -41
- package/dist/rules/no-hard-private.d.ts +6 -6
- package/dist/rules/no-hard-private.js +6 -6
- package/dist/rules/no-subpath-imports-from-simplysm.d.ts +5 -5
- package/dist/rules/no-subpath-imports-from-simplysm.js +6 -6
- package/dist/rules/ts-no-throw-not-implemented-error.d.ts +5 -5
- package/dist/rules/ts-no-throw-not-implemented-error.js +2 -2
- package/dist/stylelint-recommended.js +3 -3
- package/dist/utils/create-rule.d.ts +3 -3
- package/package.json +5 -4
- package/src/eslint-recommended.ts +54 -54
- package/src/rules/no-hard-private.ts +23 -23
- package/src/rules/no-subpath-imports-from-simplysm.ts +13 -13
- package/src/rules/ts-no-throw-not-implemented-error.ts +13 -13
- package/src/stylelint-recommended.ts +3 -3
- package/src/utils/create-rule.ts +3 -3
- package/tests/no-hard-private.spec.ts +961 -0
- package/tests/no-subpath-imports-from-simplysm.spec.ts +352 -0
- package/tests/recommended.spec.ts +155 -0
- package/tests/ts-no-throw-not-implemented-error.spec.ts +386 -0
- package/tests/vitest.setup.ts +10 -0
package/README.md
CHANGED
|
@@ -1,502 +1,24 @@
|
|
|
1
1
|
# @simplysm/lint
|
|
2
2
|
|
|
3
|
-
Lint
|
|
4
|
-
|
|
5
|
-
- **ESLint**: Custom rules, TypeScript, SolidJS, and Tailwind CSS support (Flat Config format)
|
|
6
|
-
- **Stylelint**: CSS linting with Chrome 84+ compatibility checks, Tailwind CSS support, and file resolution validation
|
|
3
|
+
Lint configuration for the Simplysm framework. Provides an ESLint plugin with custom rules and recommended flat configs for ESLint and Stylelint.
|
|
7
4
|
|
|
8
5
|
## Installation
|
|
9
6
|
|
|
10
|
-
```bash
|
|
11
|
-
npm install @simplysm/lint
|
|
12
|
-
# or
|
|
13
|
-
pnpm add @simplysm/lint
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
All required linting libraries (eslint, typescript-eslint, stylelint, etc.) are included as dependencies and do not need to be installed separately.
|
|
17
|
-
|
|
18
|
-
## Configuration
|
|
19
|
-
|
|
20
|
-
### ESLint Flat Config (eslint.config.js or eslint.config.ts)
|
|
21
|
-
|
|
22
|
-
#### Using recommended config (recommended)
|
|
23
|
-
|
|
24
|
-
The `eslint-recommended` entry point exports a comprehensive flat config array that includes custom rules, TypeScript rules, SolidJS rules, and Tailwind CSS rules. This is sufficient for most cases.
|
|
25
|
-
|
|
26
|
-
```javascript
|
|
27
|
-
import simplysmConfigs from "@simplysm/lint/eslint-recommended";
|
|
28
|
-
|
|
29
|
-
export default [
|
|
30
|
-
...simplysmConfigs,
|
|
31
|
-
];
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
To extend with additional settings (e.g., specifying a Tailwind config path):
|
|
35
|
-
|
|
36
|
-
```javascript
|
|
37
|
-
import simplysmConfigs from "@simplysm/lint/eslint-recommended";
|
|
38
|
-
|
|
39
|
-
export default [
|
|
40
|
-
...simplysmConfigs,
|
|
41
|
-
{
|
|
42
|
-
files: ["**/*.{ts,tsx}"],
|
|
43
|
-
settings: {
|
|
44
|
-
tailwindcss: {
|
|
45
|
-
config: "tailwind.config.ts",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
#### Using only the ESLint plugin with specific rules
|
|
53
|
-
|
|
54
|
-
To selectively apply only certain custom rules, import the plugin from `eslint-plugin`:
|
|
55
|
-
|
|
56
|
-
```javascript
|
|
57
|
-
import simplysm from "@simplysm/lint/eslint-plugin";
|
|
58
|
-
|
|
59
|
-
export default [
|
|
60
|
-
{
|
|
61
|
-
plugins: {
|
|
62
|
-
"@simplysm": simplysm,
|
|
63
|
-
},
|
|
64
|
-
rules: {
|
|
65
|
-
"@simplysm/no-hard-private": "error",
|
|
66
|
-
"@simplysm/no-subpath-imports-from-simplysm": "error",
|
|
67
|
-
"@simplysm/ts-no-throw-not-implemented-error": "warn",
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
];
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Stylelint Config (.stylelintrc.json)
|
|
74
|
-
|
|
75
|
-
#### Using recommended config (recommended)
|
|
76
|
-
|
|
77
|
-
Create a `.stylelintrc.json` file at the project root:
|
|
78
|
-
|
|
79
|
-
```json
|
|
80
|
-
{
|
|
81
|
-
"extends": ["@simplysm/lint/stylelint-recommended"]
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Or use the full configuration directly:
|
|
86
|
-
|
|
87
|
-
```json
|
|
88
|
-
{
|
|
89
|
-
"extends": ["stylelint-config-standard", "stylelint-config-tailwindcss"],
|
|
90
|
-
"plugins": ["stylelint-no-unsupported-browser-features", "stylelint-no-unresolved-module"],
|
|
91
|
-
"rules": {
|
|
92
|
-
"plugin/no-unsupported-browser-features": [
|
|
93
|
-
true,
|
|
94
|
-
{
|
|
95
|
-
"severity": "error",
|
|
96
|
-
"browsers": ["chrome >= 84"],
|
|
97
|
-
"ignore": ["css-cascade-layers", "css-nesting", "css-overflow"]
|
|
98
|
-
}
|
|
99
|
-
],
|
|
100
|
-
"plugin/no-unresolved-module": true,
|
|
101
|
-
"declaration-block-no-redundant-longhand-properties": [true, { "ignoreShorthands": ["inset"] }]
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
#### Overrides for specific files
|
|
107
|
-
|
|
108
|
-
Add overrides to disable rules for specific files:
|
|
109
|
-
|
|
110
|
-
```json
|
|
111
|
-
{
|
|
112
|
-
"extends": ["@simplysm/lint/stylelint-recommended"],
|
|
113
|
-
"overrides": [
|
|
114
|
-
{
|
|
115
|
-
"files": ["**/tailwind.css"],
|
|
116
|
-
"rules": {
|
|
117
|
-
"plugin/no-unsupported-browser-features": null
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
]
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## Stylelint Rules
|
|
125
|
-
|
|
126
|
-
The `stylelint-recommended` config includes:
|
|
127
|
-
|
|
128
|
-
| Rule | Severity | Description |
|
|
129
|
-
|------|----------|-------------|
|
|
130
|
-
| `plugin/no-unsupported-browser-features` | error | Checks CSS features compatibility with Chrome 84+ |
|
|
131
|
-
| `plugin/no-unresolved-module` | error | Validates that `@import` and `url()` references exist |
|
|
132
|
-
| `declaration-block-no-redundant-longhand-properties` | error | Enforces shorthand properties, except `inset` (Chrome 87+ only) |
|
|
133
|
-
| All rules from `stylelint-config-standard` | varies | Standard CSS linting rules |
|
|
134
|
-
| All rules from `stylelint-config-tailwindcss` | varies | Tailwind CSS-specific rules (`@apply`, `@layer`, etc.) |
|
|
135
|
-
|
|
136
|
-
### Browser Compatibility
|
|
137
|
-
|
|
138
|
-
The config enforces Chrome 84+ compatibility by default. This aligns with Simplysm's target browser support.
|
|
139
|
-
|
|
140
|
-
The following features are intentionally ignored (allowed despite Chrome 84 not supporting them, because they are used by Tailwind CSS internals):
|
|
141
|
-
|
|
142
|
-
- `css-cascade-layers` (`@layer` directive)
|
|
143
|
-
- `css-nesting` (CSS nesting syntax)
|
|
144
|
-
- `css-overflow` (overflow shorthand)
|
|
145
|
-
|
|
146
|
-
Features not in the ignore list will trigger errors if they are unsupported in Chrome 84. Examples:
|
|
147
|
-
|
|
148
|
-
- `aspect-ratio` property (Chrome 88+)
|
|
149
|
-
- `:is()`, `:where()` selectors (Chrome 88+)
|
|
150
|
-
|
|
151
|
-
Use overrides to disable checks for additional files that intentionally use unsupported features.
|
|
152
|
-
|
|
153
|
-
## Custom Rules
|
|
154
|
-
|
|
155
|
-
This plugin provides 3 custom rules.
|
|
156
|
-
|
|
157
|
-
| Rule | Type | Auto-fix | Default Severity | Description |
|
|
158
|
-
|------|------|----------|------------------|-------------|
|
|
159
|
-
| [`no-hard-private`](#no-hard-private) | problem | Supported | error | Enforces TypeScript `private` instead of ECMAScript `#field` |
|
|
160
|
-
| [`no-subpath-imports-from-simplysm`](#no-subpath-imports-from-simplysm) | problem | Supported | error | Prohibits importing from `@simplysm/*/src/` paths |
|
|
161
|
-
| [`ts-no-throw-not-implemented-error`](#ts-no-throw-not-implemented-error) | suggestion | Not supported | warn | Warns about usage of `NotImplementedError` |
|
|
162
|
-
|
|
163
|
-
### no-hard-private
|
|
164
|
-
|
|
165
|
-
Restricts the use of ECMAScript private fields (`#field`). Use TypeScript's `private` keyword and `_` prefix naming instead.
|
|
166
|
-
|
|
167
|
-
Supports auto-fix with the `--fix` option.
|
|
168
|
-
|
|
169
|
-
**Detection targets:**
|
|
170
|
-
|
|
171
|
-
- Class field declarations: `#field`
|
|
172
|
-
- Class method declarations: `#method()`
|
|
173
|
-
- Class accessor declarations: `accessor #field`
|
|
174
|
-
- Member access expressions: `this.#field`
|
|
175
|
-
|
|
176
|
-
**Valid code:**
|
|
177
|
-
|
|
178
|
-
```typescript
|
|
179
|
-
class Foo {
|
|
180
|
-
private _value = 1;
|
|
181
|
-
private _count: number;
|
|
182
|
-
|
|
183
|
-
private _doSomething() {
|
|
184
|
-
return this._value;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
**Invalid code:**
|
|
190
|
-
|
|
191
|
-
```typescript
|
|
192
|
-
class Foo {
|
|
193
|
-
#value = 1;
|
|
194
|
-
#count: number;
|
|
195
|
-
|
|
196
|
-
#doSomething() {
|
|
197
|
-
return this.#value;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
**Auto-fix with decorators:**
|
|
203
|
-
|
|
204
|
-
Members with decorators are also correctly converted. The `private` keyword is inserted after decorators and before other keywords like `static`.
|
|
205
|
-
|
|
206
|
-
```typescript
|
|
207
|
-
// Before fix
|
|
208
|
-
class Foo {
|
|
209
|
-
@Deco
|
|
210
|
-
static #value = 1;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// After fix
|
|
214
|
-
class Foo {
|
|
215
|
-
@Deco
|
|
216
|
-
private static _value = 1;
|
|
217
|
-
}
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
**Limitations:**
|
|
221
|
-
|
|
222
|
-
- If a member with the same name prefixed with `_` already exists, a name conflict occurs. In this case, auto-fix is not applied, and a `nameConflict` message requests manual adjustment.
|
|
223
|
-
|
|
224
|
-
```typescript
|
|
225
|
-
class Foo {
|
|
226
|
-
private _value = 1;
|
|
227
|
-
#value = 2; // Error: Cannot convert "#value" to "_value" (name conflict)
|
|
228
|
-
}
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### no-subpath-imports-from-simplysm
|
|
232
|
-
|
|
233
|
-
Prohibits importing from `@simplysm/*` packages through `/src/` paths. Only import through the official entry point (package root).
|
|
234
|
-
|
|
235
|
-
Supports auto-fix with the `--fix` option to convert to package root paths.
|
|
236
|
-
|
|
237
|
-
**Detection targets:**
|
|
238
|
-
|
|
239
|
-
- Static import statements: `import ... from '...'`
|
|
240
|
-
- Dynamic imports: `import('...')`
|
|
241
|
-
- Re-export statements: `export { ... } from '...'`
|
|
242
|
-
- Re-export all statements: `export * from '...'`
|
|
243
|
-
|
|
244
|
-
**Valid code:**
|
|
245
|
-
|
|
246
|
-
```typescript
|
|
247
|
-
import { Foo } from "@simplysm/core-common";
|
|
248
|
-
import { Bar } from "@simplysm/core-node";
|
|
249
|
-
|
|
250
|
-
const mod = await import("@simplysm/core-common");
|
|
251
|
-
|
|
252
|
-
export { Baz } from "@simplysm/orm-common";
|
|
253
|
-
export * from "@simplysm/service-common";
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
**Invalid code:**
|
|
257
|
-
|
|
258
|
-
```typescript
|
|
259
|
-
import { Foo } from "@simplysm/core-common/src/types/DateOnly";
|
|
260
|
-
import { Bar } from "@simplysm/core-node/src/utils";
|
|
261
|
-
|
|
262
|
-
const mod = await import("@simplysm/core-common/src/index");
|
|
263
|
-
|
|
264
|
-
export { Baz } from "@simplysm/orm-common/src/query-builder";
|
|
265
|
-
export * from "@simplysm/service-common/src/protocols";
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
**Allowed subpaths:**
|
|
269
|
-
|
|
270
|
-
Subpaths other than `/src/` are allowed.
|
|
271
|
-
|
|
272
|
-
```typescript
|
|
273
|
-
// Allowed: not a /src/ path
|
|
274
|
-
import { Foo } from "@simplysm/core-common/utils";
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
### ts-no-throw-not-implemented-error
|
|
278
|
-
|
|
279
|
-
Warns about code that creates `NotImplementedError` from `@simplysm/core-common` with the `new` keyword. This rule prevents unimplemented code from being included in production.
|
|
280
|
-
|
|
281
|
-
It warns even if only creating without throwing. Auto-fix is not supported.
|
|
282
|
-
|
|
283
|
-
**Supported import forms:**
|
|
284
|
-
|
|
285
|
-
| Import Form | Detected |
|
|
286
|
-
|-------------|----------|
|
|
287
|
-
| named import: `import { NotImplementedError } from "@simplysm/core-common"` | Yes |
|
|
288
|
-
| aliased import: `import { NotImplementedError as NIE } from "@simplysm/core-common"` | Yes |
|
|
289
|
-
| namespace import: `import * as CC from "@simplysm/core-common"` | Yes |
|
|
290
|
-
| dynamic import: `await import("@simplysm/core-common")` | No |
|
|
291
|
-
| Re-exported from another module | No |
|
|
292
|
-
|
|
293
|
-
**Invalid code (warnings):**
|
|
294
|
-
|
|
295
|
-
```typescript
|
|
296
|
-
import { NotImplementedError } from "@simplysm/core-common";
|
|
297
|
-
|
|
298
|
-
throw new NotImplementedError(); // Warning: "미구현" (default message)
|
|
299
|
-
throw new NotImplementedError("Feature X"); // Warning: "Feature X"
|
|
300
|
-
const err = new NotImplementedError(); // Warning: "미구현" (default message)
|
|
301
7
|
```
|
|
302
|
-
|
|
303
|
-
**Aliased imports are also detected:**
|
|
304
|
-
|
|
305
|
-
```typescript
|
|
306
|
-
import { NotImplementedError as NIE } from "@simplysm/core-common";
|
|
307
|
-
|
|
308
|
-
throw new NIE(); // Warning
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
**Namespace imports are also detected:**
|
|
312
|
-
|
|
313
|
-
```typescript
|
|
314
|
-
import * as CC from "@simplysm/core-common";
|
|
315
|
-
|
|
316
|
-
throw new CC.NotImplementedError(); // Warning
|
|
8
|
+
pnpm add @simplysm/lint
|
|
317
9
|
```
|
|
318
10
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
- Calling `new NotImplementedError()` without arguments outputs a warning with the Korean default message "미구현".
|
|
322
|
-
- If a string argument is passed, that string is used as the warning message.
|
|
323
|
-
|
|
324
|
-
## recommended Config Details
|
|
325
|
-
|
|
326
|
-
Full list of rules included in the `eslint-recommended` config.
|
|
327
|
-
|
|
328
|
-
### Global Ignore Patterns
|
|
329
|
-
|
|
330
|
-
The following directories are excluded from linting:
|
|
331
|
-
|
|
332
|
-
- `**/node_modules/**`
|
|
333
|
-
- `**/dist/**`
|
|
334
|
-
- `**/.*/**`
|
|
335
|
-
- `**/_*/**`
|
|
336
|
-
|
|
337
|
-
### Common Rules (JS/TS)
|
|
338
|
-
|
|
339
|
-
Rules applied to all JS and TS files.
|
|
340
|
-
|
|
341
|
-
| Rule | Severity | Description |
|
|
342
|
-
|------|----------|-------------|
|
|
343
|
-
| `no-console` | error | Prohibit console usage (prevent production performance degradation) |
|
|
344
|
-
| `no-warning-comments` | warn | Warn about TODO/FIXME comments (to identify incomplete code) |
|
|
345
|
-
| `eqeqeq` | error | Enforce `===`, allow `== null` check |
|
|
346
|
-
| `no-self-compare` | error | Prohibit self-comparison like `x === x` (prevent typos) |
|
|
347
|
-
| `array-callback-return` | error | Prevent missing `return` in array callbacks like `map`/`filter` |
|
|
348
|
-
|
|
349
|
-
### Node.js Built-in Module Restrictions
|
|
350
|
-
|
|
351
|
-
Restrict Node.js-specific API usage for code consistency across all packages.
|
|
352
|
-
|
|
353
|
-
| Restricted Target | Rule | Alternative |
|
|
354
|
-
|-------------------|------|-------------|
|
|
355
|
-
| `Buffer` (global) | `no-restricted-globals` | `Uint8Array`, `BytesUtils` from `@simplysm/core-common` |
|
|
356
|
-
| `buffer` (import) | `no-restricted-imports` | `Uint8Array`, `BytesUtils` from `@simplysm/core-common` |
|
|
357
|
-
| `events` (import) | `no-restricted-imports` | `SdEventEmitter` from `@simplysm/core-common` |
|
|
358
|
-
| `eventemitter3` (import) | `no-restricted-imports` | `SdEventEmitter` from `@simplysm/core-common` |
|
|
359
|
-
|
|
360
|
-
### Unused Imports Rules
|
|
361
|
-
|
|
362
|
-
| Rule | Severity | Description |
|
|
363
|
-
|------|----------|-------------|
|
|
364
|
-
| `unused-imports/no-unused-imports` | error | Auto-remove unused imports |
|
|
365
|
-
| `unused-imports/no-unused-vars` | error | Detect unused variables (allow `_` prefix variables/arguments) |
|
|
366
|
-
|
|
367
|
-
### Import Dependency Check
|
|
368
|
-
|
|
369
|
-
| Rule | Severity | Description |
|
|
370
|
-
|------|----------|-------------|
|
|
371
|
-
| `import/no-extraneous-dependencies` | error | Prohibit importing external dependencies not declared in `package.json` |
|
|
372
|
-
|
|
373
|
-
`devDependencies` are only allowed in the following paths:
|
|
374
|
-
|
|
375
|
-
- JS files: `**/lib/**`, `**/eslint.config.js`, `**/simplysm.js`, `**/vitest.config.js`
|
|
376
|
-
- TS files: `**/lib/**`, `**/eslint.config.ts`, `**/simplysm.ts`, `**/vitest.config.ts`, `**/vitest.setup.ts`
|
|
377
|
-
|
|
378
|
-
### JS-only Rules (.js, .jsx)
|
|
379
|
-
|
|
380
|
-
Rules applied only to JS files. Not applied to TS files as the TypeScript compiler performs the same checks.
|
|
381
|
-
|
|
382
|
-
| Rule | Severity | Description |
|
|
383
|
-
|------|----------|-------------|
|
|
384
|
-
| `require-await` | error | Require `await` in `async` functions |
|
|
385
|
-
| `no-shadow` | error | Prohibit variable shadowing |
|
|
386
|
-
| `no-duplicate-imports` | error | Prohibit duplicate imports |
|
|
387
|
-
| `no-unused-expressions` | error | Prohibit unused expressions |
|
|
388
|
-
| `no-undef` | error | Prohibit using undefined variables |
|
|
389
|
-
|
|
390
|
-
### TypeScript Rules (.ts, .tsx)
|
|
391
|
-
|
|
392
|
-
Rules applied based on `@typescript-eslint`. Performs precise checks using type information.
|
|
393
|
-
|
|
394
|
-
#### Async-related
|
|
395
|
-
|
|
396
|
-
| Rule | Severity | Description |
|
|
397
|
-
|------|----------|-------------|
|
|
398
|
-
| `@typescript-eslint/require-await` | error | Require `await` in `async` functions |
|
|
399
|
-
| `@typescript-eslint/await-thenable` | error | Only allow `await` on thenable objects |
|
|
400
|
-
| `@typescript-eslint/return-await` | error | Allow `return await` only inside `try-catch` |
|
|
401
|
-
| `@typescript-eslint/no-floating-promises` | error | Prohibit unhandled Promises |
|
|
402
|
-
| `@typescript-eslint/no-misused-promises` | error | Prevent error loss when passing async functions to void callbacks (excludes `arguments`, `attributes`) |
|
|
403
|
-
|
|
404
|
-
#### Type Safety
|
|
405
|
-
|
|
406
|
-
| Rule | Severity | Description |
|
|
407
|
-
|------|----------|-------------|
|
|
408
|
-
| `@typescript-eslint/strict-boolean-expressions` | error | Enforce strict boolean expressions (allow nullable boolean/object) |
|
|
409
|
-
| `@typescript-eslint/no-unnecessary-condition` | error | Prohibit unnecessary condition checks (allow constant loop conditions) |
|
|
410
|
-
| `@typescript-eslint/no-unnecessary-type-assertion` | error | Prohibit unnecessary type assertions |
|
|
411
|
-
| `@typescript-eslint/only-throw-error` | error | Prohibit throwing non-Error objects (preserve stack trace) |
|
|
412
|
-
|
|
413
|
-
#### Code Style
|
|
414
|
-
|
|
415
|
-
| Rule | Severity | Description |
|
|
416
|
-
|------|----------|-------------|
|
|
417
|
-
| `@typescript-eslint/no-shadow` | error | Prohibit variable shadowing |
|
|
418
|
-
| `@typescript-eslint/prefer-reduce-type-parameter` | error | Recommend using `reduce` type parameter |
|
|
419
|
-
| `@typescript-eslint/prefer-return-this-type` | error | Recommend using `this` return type |
|
|
420
|
-
| `@typescript-eslint/no-unused-expressions` | error | Prohibit unused expressions |
|
|
421
|
-
| `@typescript-eslint/prefer-readonly` | error | Recommend `readonly` for members that don't change |
|
|
422
|
-
| `@typescript-eslint/no-array-delete` | error | Prohibit using `delete` on arrays (prevent sparse array bugs) |
|
|
423
|
-
|
|
424
|
-
#### ts-comment Rules
|
|
425
|
-
|
|
426
|
-
| Rule | Severity | Description |
|
|
427
|
-
|------|----------|-------------|
|
|
428
|
-
| `@typescript-eslint/ban-ts-comment` | error | Require 3+ character description for `@ts-expect-error` |
|
|
429
|
-
|
|
430
|
-
### SolidJS Rules (.ts, .tsx)
|
|
431
|
-
|
|
432
|
-
Rules applied based on `eslint-plugin-solid`. Applied to both `.ts` and `.tsx` files.
|
|
433
|
-
|
|
434
|
-
#### Mistake Prevention
|
|
435
|
-
|
|
436
|
-
| Rule | Severity | Description |
|
|
437
|
-
|------|----------|-------------|
|
|
438
|
-
| `solid/reactivity` | error | Detect reactivity loss (registers custom reactive functions like `makePersisted`) |
|
|
439
|
-
| `solid/no-destructure` | error | Prohibit destructuring props (prevent reactivity loss) |
|
|
440
|
-
| `solid/components-return-once` | error | Prohibit early returns in components |
|
|
441
|
-
| `solid/jsx-no-duplicate-props` | error | Prohibit duplicate props |
|
|
442
|
-
| `solid/jsx-no-undef` | error | Prohibit using undefined JSX variables (TypeScript support enabled) |
|
|
443
|
-
| `solid/no-react-deps` | error | Prohibit React-style dependency arrays |
|
|
444
|
-
| `solid/no-react-specific-props` | error | Prohibit React-specific props (`className`, etc.) |
|
|
445
|
-
|
|
446
|
-
#### Security
|
|
447
|
-
|
|
448
|
-
| Rule | Severity | Description |
|
|
449
|
-
|------|----------|-------------|
|
|
450
|
-
| `solid/no-innerhtml` | error | Prohibit `innerHTML` usage (prevent XSS) |
|
|
451
|
-
| `solid/jsx-no-script-url` | error | Prohibit `javascript:` URLs |
|
|
452
|
-
|
|
453
|
-
#### Tooling Support
|
|
454
|
-
|
|
455
|
-
| Rule | Severity | Description |
|
|
456
|
-
|------|----------|-------------|
|
|
457
|
-
| `solid/jsx-uses-vars` | error | Prevent variables used in JSX from being flagged as unused imports |
|
|
458
|
-
|
|
459
|
-
#### Conventions
|
|
460
|
-
|
|
461
|
-
| Rule | Severity | Description |
|
|
462
|
-
|------|----------|-------------|
|
|
463
|
-
| `solid/prefer-for` | error | Recommend using `For` component |
|
|
464
|
-
| `solid/event-handlers` | error | Enforce event handler naming rules |
|
|
465
|
-
| `solid/imports` | error | Enforce import consistency |
|
|
466
|
-
| `solid/style-prop` | error | Enforce `style` prop format |
|
|
467
|
-
| `solid/self-closing-comp` | error | Enforce self-closing tags |
|
|
468
|
-
|
|
469
|
-
### Tailwind CSS Rules (.ts, .tsx)
|
|
470
|
-
|
|
471
|
-
Rules applied based on `eslint-plugin-tailwindcss`. Recognizes `clsx` template literal tags.
|
|
472
|
-
|
|
473
|
-
| Rule | Severity | Description |
|
|
474
|
-
|------|----------|-------------|
|
|
475
|
-
| `tailwindcss/classnames-order` | warn | Auto-sort class order |
|
|
476
|
-
| `tailwindcss/enforces-negative-arbitrary-values` | error | Unify negative arbitrary value format |
|
|
477
|
-
| `tailwindcss/enforces-shorthand` | error | Recommend using shorthand |
|
|
478
|
-
| `tailwindcss/no-contradicting-classname` | error | Prohibit conflicting classes (`p-2 p-4`, etc.) |
|
|
479
|
-
| `tailwindcss/no-custom-classname` | error | Prohibit custom classes not defined in Tailwind |
|
|
480
|
-
| `tailwindcss/no-unnecessary-arbitrary-value` | error | Prohibit unnecessary arbitrary values |
|
|
481
|
-
|
|
482
|
-
### Test File Exception Rules
|
|
483
|
-
|
|
484
|
-
The following rules are relaxed for test files in `**/tests/**/*.ts`, `**/tests/**/*.tsx` paths:
|
|
485
|
-
|
|
486
|
-
| Rule | Change | Reason |
|
|
487
|
-
|------|--------|--------|
|
|
488
|
-
| `no-console` | off | Allow debug output in tests |
|
|
489
|
-
| `import/no-extraneous-dependencies` | off | Allow using root `devDependencies` (vitest, etc.) |
|
|
490
|
-
| `@simplysm/ts-no-throw-not-implemented-error` | off | Allow using not-implemented errors in test code |
|
|
491
|
-
| `solid/reactivity` | off | Accessing signals inside async callbacks like `waitFor` in tests is intentional |
|
|
492
|
-
|
|
493
|
-
## Configuration Summary by File Type
|
|
11
|
+
## Source Index
|
|
494
12
|
|
|
495
|
-
|
|
|
496
|
-
|
|
497
|
-
|
|
|
498
|
-
|
|
|
499
|
-
|
|
|
13
|
+
| Source | Exports | Description | Test |
|
|
14
|
+
|--------|---------|-------------|------|
|
|
15
|
+
| `src/eslint-plugin.ts` | default: `{ rules: { "no-hard-private", "no-subpath-imports-from-simplysm", "ts-no-throw-not-implemented-error" } }` | ESLint plugin that bundles all custom Simplysm rules under `@simplysm/*` | `tests/no-hard-private.spec.ts`, `tests/no-subpath-imports-from-simplysm.spec.ts`, `tests/ts-no-throw-not-implemented-error.spec.ts` |
|
|
16
|
+
| `src/eslint-recommended.ts` | default: ESLint flat config array (TS, SolidJS, Tailwind CSS rules) | Recommended ESLint flat config for TS, SolidJS, and Tailwind CSS projects | `tests/recommended.spec.ts` |
|
|
17
|
+
| `src/stylelint-recommended.ts` | default: Stylelint config (Chrome 84+, Tailwind CSS, file resolution) | Recommended Stylelint config targeting Chrome 84+ with Tailwind CSS support | - |
|
|
18
|
+
| `src/rules/no-hard-private.ts` | ESLint rule: prohibit ECMAScript `#field` private syntax | Enforces TypeScript `private _` style instead of hard private `#field` syntax | - |
|
|
19
|
+
| `src/rules/no-subpath-imports-from-simplysm.ts` | ESLint rule: prohibit `@simplysm/*/src/` import paths | Prevents direct `src/` subpath imports from `@simplysm/*` packages | - |
|
|
20
|
+
| `src/rules/ts-no-throw-not-implemented-error.ts` | ESLint rule: warn on `new NotImplementedError()` usage | Warns when `NotImplementedError` from `@simplysm/core-common` is instantiated | - |
|
|
21
|
+
| `src/utils/create-rule.ts` | `createRule` utility for defining typed ESLint rules | Factory wrapper around `RuleCreator` for authoring typed ESLint rules | - |
|
|
500
22
|
|
|
501
23
|
## License
|
|
502
24
|
|