@tsfpp/eslint-config 1.0.0 → 1.0.1

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 +120 -20
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @tsfpp/eslint-config
2
2
 
3
- Shared ESLint flat configuration for [TSF++](../../spec/standards/TSFPP_CODING_STANDARD.md) projects.
3
+ Shared ESLint flat configuration for [TSF++](./spec/CODING_STANDARD.md) projects.
4
4
 
5
- Enforces the machine-checkable subset of TSF++ rules via `@typescript-eslint` and `eslint-plugin-functional`. Every active rule references the spec rule it enforces.
5
+ Enforces the machine-checkable subset of TSF++ rules via `@typescript-eslint` and `eslint-plugin-functional`. Every active rule references the spec rule it enforces. Three profiles are available — pick the one that matches your target.
6
6
 
7
7
  ## Requirements
8
8
 
@@ -10,8 +10,20 @@ Enforces the machine-checkable subset of TSF++ rules via `@typescript-eslint` an
10
10
  - TypeScript ≥ 5.3
11
11
  - A `tsconfig.json` reachable from each linted file
12
12
 
13
+ ## Profiles
14
+
15
+ | Import | Target | Extra peer deps required |
16
+ |--------|--------|--------------------------|
17
+ | `@tsfpp/eslint-config` | Pure TypeScript (Node.js, libraries) | — |
18
+ | `@tsfpp/eslint-config/react` | React / TSX projects | See [React installation](#react) |
19
+ | `@tsfpp/eslint-config/api` | HTTP API / Node.js servers | — |
20
+
21
+ The `react` and `api` profiles extend the base — you do not need to compose them manually.
22
+
13
23
  ## Installation
14
24
 
25
+ ### Base
26
+
15
27
  ```sh
16
28
  pnpm add -D @tsfpp/eslint-config \
17
29
  eslint \
@@ -21,9 +33,28 @@ pnpm add -D @tsfpp/eslint-config \
21
33
  eslint-plugin-functional
22
34
  ```
23
35
 
36
+ ### React
37
+
38
+ ```sh
39
+ pnpm add -D @tsfpp/eslint-config \
40
+ eslint \
41
+ typescript \
42
+ @typescript-eslint/parser \
43
+ @typescript-eslint/eslint-plugin \
44
+ eslint-plugin-functional \
45
+ eslint-plugin-react \
46
+ eslint-plugin-react-hooks \
47
+ eslint-plugin-jsx-a11y \
48
+ @tanstack/eslint-plugin-query
49
+ ```
50
+
51
+ ### API
52
+
53
+ Same as base — no additional peer dependencies.
54
+
24
55
  ## Usage
25
56
 
26
- ### Standalone
57
+ ### Standalone (base)
27
58
 
28
59
  ```js
29
60
  // eslint.config.js
@@ -32,22 +63,41 @@ import tsfpp from '@tsfpp/eslint-config'
32
63
  export default tsfpp
33
64
  ```
34
65
 
66
+ ### React profile
67
+
68
+ ```js
69
+ // eslint.config.js
70
+ import tsfppReact from '@tsfpp/eslint-config/react'
71
+
72
+ export default tsfppReact
73
+ ```
74
+
75
+ ### API profile
76
+
77
+ ```js
78
+ // eslint.config.js
79
+ import tsfppApi from '@tsfpp/eslint-config/api'
80
+
81
+ export default tsfppApi
82
+ ```
83
+
35
84
  ### With project-specific overrides
36
85
 
86
+ Spread the profile array and append your overrides:
87
+
37
88
  ```js
38
89
  // eslint.config.js
39
- import tsfpp from '@tsfpp/eslint-config'
90
+ import tsfppReact from '@tsfpp/eslint-config/react'
40
91
 
41
92
  export default [
42
- ...tsfpp,
93
+ ...tsfppReact,
43
94
  {
44
- // Relax console warnings in scripts
45
95
  rules: { 'no-console': 'off' },
46
96
  },
47
97
  ]
48
98
  ```
49
99
 
50
- ### With `@tsfpp/tsconfig`
100
+ ### Pointing to a specific tsconfig
51
101
 
52
102
  ```js
53
103
  // eslint.config.js
@@ -58,7 +108,6 @@ export default [
58
108
  {
59
109
  languageOptions: {
60
110
  parserOptions: {
61
- // Point to your project tsconfig explicitly if needed
62
111
  project: './tsconfig.json',
63
112
  },
64
113
  },
@@ -68,32 +117,75 @@ export default [
68
117
 
69
118
  ## Enforced rules
70
119
 
120
+ ### Base (all profiles)
121
+
71
122
  | ESLint rule | TSF++ rule | Level |
72
123
  |-------------|------------|-------|
124
+ | `@typescript-eslint/consistent-type-definitions: type` | 1.4 | MUST |
73
125
  | `@typescript-eslint/no-explicit-any` | 1.5 | MUST |
74
126
  | `@typescript-eslint/no-non-null-assertion` | 1.6 | MUST |
75
127
  | `@typescript-eslint/consistent-type-assertions: never` | 1.6 | MUST |
76
128
  | `@typescript-eslint/switch-exhaustiveness-check` | 1.2 / 4.1 | MUST |
77
- | `@typescript-eslint/explicit-function-return-type` | 3.1 | MUST |
78
- | `@typescript-eslint/strict-boolean-expressions` | 4.5 | MUST |
79
- | `@typescript-eslint/no-floating-promises` | 6.4 | SHOULD |
80
- | `@typescript-eslint/prefer-readonly` | 2.2 | MUST |
129
+ | `no-restricted-syntax` → `TSEnumDeclaration` | 1.8 | MUST |
130
+ | `no-restricted-syntax` → `TSModuleDeclaration[kind='namespace']` | 1.9 | MUST |
131
+ | `no-restricted-syntax` → `BinaryExpression[operator="instanceof"]` | 1.9 | MUST |
132
+ | `no-restricted-syntax` → `NewExpression` | 1.9 | MUST |
133
+ | `functional/no-classes` | 1.9 | MUST |
134
+ | `functional/no-this-expressions` | 1.9 | MUST |
81
135
  | `functional/no-let` | 2.1 | MUST |
82
- | `functional/no-loop-statements` | 4.2 | MUST |
83
- | `functional/no-throw-statements` | 6.2 | MUST |
84
136
  | `functional/prefer-readonly-type` | 2.2 | MUST |
137
+ | `@typescript-eslint/prefer-readonly` | 2.2 | MUST |
85
138
  | `functional/immutable-data` | 2.3 | MUST |
86
- | `functional/no-classes` | 1.9 | MUST |
87
- | `functional/no-this-expressions` | 1.9 | MUST |
139
+ | `no-param-reassign` | 2.3 | MUST |
140
+ | `@typescript-eslint/explicit-function-return-type` | 3.1 | MUST |
141
+ | `max-params: 3` | 3.2 | MUST |
88
142
  | `complexity: 10` | 3.4 | MUST |
89
143
  | `max-depth: 4` | 3.4 | MUST |
90
144
  | `max-lines-per-function: 40` | 3.4 | MUST |
145
+ | `functional/no-loop-statements` | 4.2 | MUST |
146
+ | `@typescript-eslint/strict-boolean-expressions` | 4.5 | MUST |
91
147
  | `eqeqeq: always` | 4.5 | MUST |
92
- | `no-param-reassign` | 2.3 | MUST |
148
+ | `functional/no-throw-statements` | 6.2 | MUST |
149
+ | `@typescript-eslint/no-floating-promises` | 6.4 | MUST |
150
+ | `@typescript-eslint/no-misused-promises` | 6.4 | MUST |
151
+ | `max-lines: 400` | 11.2 | MUST |
152
+
153
+ ### React profile additions
154
+
155
+ | ESLint rule | TSF++ React rule | Level |
156
+ |-------------|-----------------|-------|
157
+ | `react/function-component-definition: arrow-function` | R-1.1 | MUST |
158
+ | `react/jsx-no-leaked-render` | R-1.x | MUST |
159
+ | `react/no-array-index-key` | R-1.x | MUST |
160
+ | `react/no-unstable-nested-components` | R-1.x | MUST |
161
+ | `react-hooks/rules-of-hooks` | R-14.1 | MUST |
162
+ | `react-hooks/exhaustive-deps` | R-4.6 | MUST |
163
+ | `@tanstack/query/exhaustive-deps` | R-7.2 | MUST |
164
+ | `@tanstack/query/stable-query-client` | R-7.x | MUST |
165
+ | `jsx-a11y/click-events-have-key-events` | R-16.1 | MUST |
166
+ | `jsx-a11y/no-static-element-interactions` | R-16.1 | MUST |
167
+ | `jsx-a11y/alt-text` | R-16.2 | MUST |
168
+ | `jsx-a11y/label-has-associated-control` | R-16.2 | MUST |
169
+
170
+ ### API profile additions
171
+
172
+ | ESLint rule | TSF++ API rule | Level |
173
+ |-------------|---------------|-------|
174
+ | `no-console: error` | A-logging | MUST |
175
+ | `@typescript-eslint/require-await` | A-6.x | MUST |
176
+ | `@typescript-eslint/return-await: always` | A-6.x | MUST |
177
+ | `@typescript-eslint/no-unsafe-*` (all five) | A-1.x / A-5.1 | MUST |
178
+ | `prefer-promise-reject-errors` | A-4.x | MUST |
93
179
 
94
180
  ## Handling permitted deviations
95
181
 
96
- Some TSF++ rules permit deviations at specific boundaries. Use `eslint-disable-next-line` with a paired `DEVIATION` comment so deviations are explicit and auditable:
182
+ Some TSF++ rules permit deviations at specific boundaries. Use `eslint-disable-next-line` paired with a `DEVIATION` comment so deviations are explicit and auditable by the TSF++ Audit agent and during code review.
183
+
184
+ ```typescript
185
+ // DEVIATION(1.4): structural extension contract requires interface
186
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
187
+ interface Serializable { serialize(): string }
188
+ ```
97
189
 
98
190
  ```typescript
99
191
  // DEVIATION(1.6): `as` permitted inside smart constructor boundary
@@ -101,16 +193,24 @@ Some TSF++ rules permit deviations at specific boundaries. Use `eslint-disable-n
101
193
  return raw as NodeId
102
194
  ```
103
195
 
196
+ ```typescript
197
+ // DEVIATION(1.9): adapter boundary — third-party SDK requires `new`
198
+ // eslint-disable-next-line no-restricted-syntax
199
+ const client = new ThirdPartySdkClient(config)
200
+ ```
201
+
104
202
  ```typescript
105
203
  // DEVIATION(6.2): adapter boundary — wraps third-party throw in Result
106
204
  // eslint-disable-next-line functional/no-throw-statements
107
205
  throw new Error('unreachable')
108
206
  ```
109
207
 
110
- This makes every deviation visible to the TSF++ Audit agent and during code review.
208
+ ## Internal adapter: plugin-compat
209
+
210
+ Several ESLint plugin packages ship types that lag behind the current `@eslint/core` `Plugin` interface. This package contains a single `coercePlugin` adapter (`plugin-compat.ts`) that isolates the necessary type cast at one auditable boundary per TSF++ DEVIATION(1.6). Consumers are unaffected — this is an internal concern of the config package itself.
111
211
 
112
212
  ## See also
113
213
 
114
214
  - [spec/standards/TSFPP_CODING_STANDARD.md §9](../../spec/standards/TSFPP_CODING_STANDARD.md#9--compiler-and-tooling-configuration) — normative rule reference
115
215
  - [spec/rationale/09-tooling.md](../../spec/rationale/09-tooling.md) — extended justification
116
- - [@tsfpp/tsconfig](../tsconfig/README.md) — companion TypeScript config presets
216
+ - [@tsfpp/tsconfig](../tsconfig/README.md) — companion TypeScript config presets
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsfpp/eslint-config",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Shared ESLint flat configuration for TSF++ projects",
5
5
  "keywords": [
6
6
  "eslint",
@@ -10,10 +10,10 @@
10
10
  "functional",
11
11
  "immutability"
12
12
  ],
13
- "homepage": "https://github.com/tsfpp/tsfpp#readme",
13
+ "homepage": "https://github.com/tsfpp/eslint-config#readme",
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "https://github.com/tsfpp/tsfpp.git",
16
+ "url": "https://github.com/tsfpp/eslint-config.git",
17
17
  "directory": "packages/eslint-config"
18
18
  },
19
19
  "license": "MIT",