@simplysm/lint 13.0.97 → 13.0.99
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 +81 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @simplysm/lint
|
|
2
|
+
|
|
3
|
+
Simplysm package - Lint configuration (ESLint). Provides an ESLint plugin with custom rules and a recommended flat config for TypeScript, SolidJS, and Tailwind CSS projects.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @simplysm/lint
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Entrypoints
|
|
12
|
+
|
|
13
|
+
This package has two entrypoints:
|
|
14
|
+
|
|
15
|
+
| Entrypoint | Import Path | Description |
|
|
16
|
+
|------------|-------------|-------------|
|
|
17
|
+
| ESLint Plugin | `@simplysm/lint/eslint-plugin` | Custom ESLint rules |
|
|
18
|
+
| Recommended Config | `@simplysm/lint/eslint-recommended` | Full recommended flat config |
|
|
19
|
+
|
|
20
|
+
## API Overview
|
|
21
|
+
|
|
22
|
+
### ESLint Plugin (`@simplysm/lint/eslint-plugin`)
|
|
23
|
+
|
|
24
|
+
Default export is an ESLint plugin object with `rules`:
|
|
25
|
+
|
|
26
|
+
| Rule | Type | Fixable | Description |
|
|
27
|
+
|------|------|---------|-------------|
|
|
28
|
+
| `no-hard-private` | problem | Yes | Enforces TypeScript `private _` style instead of hard private fields (`#`). Auto-fixes `#field` to `private _field` and `this.#field` to `this._field`. |
|
|
29
|
+
| `no-subpath-imports-from-simplysm` | problem | Yes | Prohibits `src` subpath imports from `@simplysm/*` packages (e.g., `@simplysm/pkg/src/x` is prohibited). Auto-fixes to package root import. |
|
|
30
|
+
| `ts-no-throw-not-implemented-error` | suggestion | No | Warns about `NotImplementedError` usage from `@simplysm/core-common`. Detects named, aliased, and namespace imports. |
|
|
31
|
+
|
|
32
|
+
### Recommended Config (`@simplysm/lint/eslint-recommended`)
|
|
33
|
+
|
|
34
|
+
Default export is a full ESLint flat config array that includes:
|
|
35
|
+
|
|
36
|
+
- **Global ignores**: `node_modules`, `dist`, dotfiles, underscore-prefixed directories
|
|
37
|
+
- **JS/JSX rules**: Common rules + unused imports + import dependency checks + custom `@simplysm` rules
|
|
38
|
+
- **TS/TSX rules**: TypeScript-specific rules (strict boolean expressions, no floating promises, prefer readonly, etc.) + all JS rules
|
|
39
|
+
- **Test overrides**: Relaxed rules for `tests/` and `tests-e2e/` directories (allows console, no extraneous deps check)
|
|
40
|
+
- **SolidJS rules**: No destructure, components-return-once, no-innerhtml, prefer-for, etc.
|
|
41
|
+
- **Tailwind CSS rules**: Classnames order, enforces shorthand, no contradicting classname, no custom classname
|
|
42
|
+
|
|
43
|
+
#### Included Plugins
|
|
44
|
+
|
|
45
|
+
| Plugin | Prefix | Purpose |
|
|
46
|
+
|--------|--------|---------|
|
|
47
|
+
| `@typescript-eslint` | `@typescript-eslint/` | TypeScript type-aware linting |
|
|
48
|
+
| `@simplysm` (this package) | `@simplysm/` | Custom Simplysm rules |
|
|
49
|
+
| `eslint-plugin-import` | `import/` | Import/export validation |
|
|
50
|
+
| `eslint-plugin-unused-imports` | `unused-imports/` | Auto-remove unused imports |
|
|
51
|
+
| `eslint-plugin-solid` | `solid/` | SolidJS best practices |
|
|
52
|
+
| `eslint-plugin-tailwindcss` | `tailwindcss/` | Tailwind CSS class validation |
|
|
53
|
+
|
|
54
|
+
## Usage Examples
|
|
55
|
+
|
|
56
|
+
### Use the recommended config
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
// eslint.config.ts
|
|
60
|
+
import recommended from "@simplysm/lint/eslint-recommended";
|
|
61
|
+
|
|
62
|
+
export default recommended;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Use the plugin with custom rules
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
// eslint.config.ts
|
|
69
|
+
import plugin from "@simplysm/lint/eslint-plugin";
|
|
70
|
+
|
|
71
|
+
export default [
|
|
72
|
+
{
|
|
73
|
+
plugins: { "@simplysm": plugin },
|
|
74
|
+
rules: {
|
|
75
|
+
"@simplysm/no-hard-private": "error",
|
|
76
|
+
"@simplysm/no-subpath-imports-from-simplysm": "error",
|
|
77
|
+
"@simplysm/ts-no-throw-not-implemented-error": "warn",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
```
|