@numbado/eslint-config 0.0.0-stage → 1.0.0
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/.dist/index.cjs +861 -0
- package/.dist/index.d.cts +9 -0
- package/.dist/index.d.ts +9 -0
- package/.dist/index.js +826 -0
- package/LICENSE +21 -0
- package/README.md +385 -2
- package/README.ru.md +386 -0
- package/package.json +58 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NumBado
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,386 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @numbado/eslint-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](README.md) | [Русский](README.ru.md)
|
|
4
|
+
|
|
5
|
+
Shared ESLint flat configuration for Numbado JavaScript and TypeScript projects, with optional rules for React component folders and file contents. The package exports a `createConfig` factory and ships ESM, CommonJS, and TypeScript declarations.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [Quick start](#quick-start)
|
|
11
|
+
- [Configuration API](#configuration-api)
|
|
12
|
+
- [Included checks](#included-checks)
|
|
13
|
+
- [React component conventions](#react-component-conventions)
|
|
14
|
+
- [Overrides](#overrides)
|
|
15
|
+
- [Troubleshooting and limitations](#troubleshooting-and-limitations)
|
|
16
|
+
- [Development](#development)
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
Requirements:
|
|
21
|
+
|
|
22
|
+
- ESLint `^10`, declared as a peer dependency.
|
|
23
|
+
- Node.js `^20.19.0`, `^22.13.0`, or `>=24`, as required by [ESLint 10](https://eslint.org/docs/latest/use/migrate-to-10.0.0).
|
|
24
|
+
- TypeScript and a `tsconfig.json` for linting TypeScript files. This repository uses TypeScript 5.9.
|
|
25
|
+
|
|
26
|
+
With pnpm:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
pnpm add -D @numbado/eslint-config eslint@10 typescript@5.9
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
With npm:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npm install --save-dev @numbado/eslint-config eslint@10 typescript@5.9
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The TypeScript parser, TypeScript ESLint plugin, import sorting plugin, unused imports plugin, and `eslint-config-prettier` are dependencies of this package. Prettier itself is optional and must be installed separately if you want to format code with it.
|
|
39
|
+
|
|
40
|
+
## Quick start
|
|
41
|
+
|
|
42
|
+
Create `eslint.config.mjs` in your project root:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
import { createConfig } from '@numbado/eslint-config';
|
|
46
|
+
|
|
47
|
+
export default createConfig({
|
|
48
|
+
tsconfigRootDir: import.meta.dirname,
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Run ESLint from that root:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
pnpm exec eslint .
|
|
56
|
+
pnpm exec eslint . --fix
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
With npm, use `npx eslint .` and `npx eslint . --fix`. Built-in and third-party rules may provide fixes; the custom React rules only report problems.
|
|
60
|
+
|
|
61
|
+
You can add scripts to your application's `package.json`:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"scripts": {
|
|
66
|
+
"lint": "eslint .",
|
|
67
|
+
"lint:fix": "eslint . --fix"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
TypeScript linting always uses `parserOptions.projectService: true`. Keep linted `.ts` and `.tsx` files in a TypeScript project that the parser can discover through `tsconfig.json`.
|
|
73
|
+
|
|
74
|
+
For an `eslint.config.ts` instead, install `jiti` version 2.2.0 or newer in your application and use the same configuration code. The repository itself uses a TypeScript ESLint configuration. See [ESLint's TypeScript configuration requirements](https://eslint.org/docs/latest/use/migrate-to-10.0.0).
|
|
75
|
+
|
|
76
|
+
CommonJS consumers can use `eslint.config.cjs`:
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
const { createConfig } = require('@numbado/eslint-config');
|
|
80
|
+
|
|
81
|
+
module.exports = createConfig({ tsconfigRootDir: __dirname });
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Configuration API
|
|
85
|
+
|
|
86
|
+
`createConfig` is a named export returning an array of ESLint flat configuration objects. Pass an options object, even when using defaults:
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
createConfig({});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
| Option | Type | Default | Behavior |
|
|
93
|
+
| --- | --- | --- | --- |
|
|
94
|
+
| `tsconfigRootDir` | `string` | `process.cwd()` | Root directory supplied to the TypeScript parser. |
|
|
95
|
+
| `reactComponentsPathes` | `string[]` | Not set | Enables both custom React rules for component roots when at least one nonblank string is supplied. |
|
|
96
|
+
| `projects` | `string[]` | `[]` | Forwarded as `parserOptions.projects`. This is not the parser's `project` option and currently does not select TypeScript projects; project discovery uses `projectService`. |
|
|
97
|
+
|
|
98
|
+
The spelling `reactComponentsPathes` is part of the current API. The factory filters out empty or whitespace-only strings but does not trim accepted paths. Calling `createConfig()` without an object is unsupported.
|
|
99
|
+
|
|
100
|
+
The package entry point exports only the factory; the internal plugin and options interface are not separate public exports.
|
|
101
|
+
|
|
102
|
+
## Included checks
|
|
103
|
+
|
|
104
|
+
### File coverage
|
|
105
|
+
|
|
106
|
+
| Files | Configuration |
|
|
107
|
+
| --- | --- |
|
|
108
|
+
| `**/*.{ts,tsx}` | TypeScript parser, type-aware rules, shared rules, and optional React component rules. |
|
|
109
|
+
| `**/*.{js,jsx}` | Shared rules with the default JavaScript parser. JSX syntax requires an additional parser option; see [Overrides](#overrides). |
|
|
110
|
+
|
|
111
|
+
Both blocks use the latest ECMAScript syntax and module source type. The shared rule blocks do not target `.mjs`, `.cjs`, `.mts`, or `.cts`; ESLint may still discover some of those files itself. Environment globals and recommended ESLint/TypeScript presets are not added.
|
|
112
|
+
|
|
113
|
+
### Shared rules
|
|
114
|
+
|
|
115
|
+
These checks apply to JavaScript and TypeScript after all returned configurations are merged:
|
|
116
|
+
|
|
117
|
+
| Area | Rules or behavior |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| Equality and declarations | `eqeqeq`, `prefer-const`, `object-shorthand`, `arrow-body-style`. |
|
|
120
|
+
| Expressions and control flow | `no-constant-binary-expression`, `no-unsafe-optional-chaining`, `no-useless-return`. |
|
|
121
|
+
| Duplicate imports | `no-duplicate-imports`; TypeScript allows separate value and type imports. |
|
|
122
|
+
| Import/export ordering | `eslint-plugin-simple-import-sort/imports` and `eslint-plugin-simple-import-sort/exports`. |
|
|
123
|
+
| Unused code | `eslint-plugin-unused-imports/no-unused-imports` and `eslint-plugin-unused-imports/no-unused-vars`. |
|
|
124
|
+
| Blank lines | A blank line after the import block and between a variable declaration and a following `return`. |
|
|
125
|
+
| Magic numbers | Ignore `0`, `1`, array indexes, and default values; require constants for other checked numbers. TypeScript also exempts enums, numeric literal types, and readonly class properties. |
|
|
126
|
+
|
|
127
|
+
### Additional TypeScript rules
|
|
128
|
+
|
|
129
|
+
- `@typescript-eslint/strict-boolean-expressions`: **warning**.
|
|
130
|
+
- `@typescript-eslint/no-explicit-any`: **error**.
|
|
131
|
+
- `@typescript-eslint/consistent-type-imports`: **error**, preferring separate `import type` statements.
|
|
132
|
+
- `@typescript-eslint/no-floating-promises` and `@typescript-eslint/no-misused-promises`: **error**.
|
|
133
|
+
- `@typescript-eslint/explicit-function-return-type`: **error**, with exceptions for typed function expressions, higher-order functions, and direct const assertions in arrow functions.
|
|
134
|
+
- `@typescript-eslint/typedef`: **error** for parameter types and property declarations; variable annotations are not required by this rule.
|
|
135
|
+
|
|
136
|
+
Unused variable checks use the unused imports plugin; `@typescript-eslint/no-unused-vars` is disabled. All enabled shared checks use error severity.
|
|
137
|
+
|
|
138
|
+
### Prettier and ignored paths
|
|
139
|
+
|
|
140
|
+
`eslint-config-prettier` is the last item returned by the factory. It disables conflicting formatting rules, including the earlier quote, semicolon, brace, and spacing settings. The resulting configuration does not enforce those settings or run Prettier.
|
|
141
|
+
|
|
142
|
+
The factory adds these global ignore patterns:
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
node_modules/**
|
|
146
|
+
.vscode/**
|
|
147
|
+
build/**
|
|
148
|
+
.build/**
|
|
149
|
+
dist/**
|
|
150
|
+
.dist/**
|
|
151
|
+
generated/**
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Add project-specific ignores in another flat configuration object. Use patterns such as `**/dist/**` yourself if you also need to ignore nested output directories.
|
|
155
|
+
|
|
156
|
+
## React component conventions
|
|
157
|
+
|
|
158
|
+
React checks are opt-in and apply only to the TypeScript block:
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
import { createConfig } from '@numbado/eslint-config';
|
|
162
|
+
|
|
163
|
+
export default createConfig({
|
|
164
|
+
tsconfigRootDir: import.meta.dirname,
|
|
165
|
+
reactComponentsPathes: [
|
|
166
|
+
'src/components',
|
|
167
|
+
'src/features/*/components',
|
|
168
|
+
],
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
This enables `@numbado/react-components-structure` and `@numbado/react-components-content`, both at error severity. Omit `reactComponentsPathes` or pass `[]` to leave them disabled. These rules do not add React Hooks correctness or accessibility checks.
|
|
173
|
+
|
|
174
|
+
### Component root paths
|
|
175
|
+
|
|
176
|
+
Paths are relative to ESLint's working directory, independently of `tsconfigRootDir`. Run ESLint from the project root when using the examples above.
|
|
177
|
+
|
|
178
|
+
- `src/components` treats `src/components/Button/` as one component folder.
|
|
179
|
+
- `src/features/*/components` also matches `src/features/account/components/Button/`.
|
|
180
|
+
- Only a complete `*` path segment is a wildcard, matching one directory level. General glob syntax, `**`, and partial wildcards are unsupported.
|
|
181
|
+
- Use paths without a `./` prefix or surrounding whitespace. Forward and backward slashes are normalized.
|
|
182
|
+
- The first matching root wins. The immediate child directory is the component boundary, including for files deeper inside that directory.
|
|
183
|
+
- A file directly under a configured root is not treated as a component.
|
|
184
|
+
|
|
185
|
+
### Required folder structure
|
|
186
|
+
|
|
187
|
+
For a component named `Button`:
|
|
188
|
+
|
|
189
|
+
```text
|
|
190
|
+
src/components/Button/
|
|
191
|
+
├── index.ts required
|
|
192
|
+
├── Button.tsx required
|
|
193
|
+
├── Button.data.ts optional
|
|
194
|
+
├── Button.types.ts optional
|
|
195
|
+
├── Button.translates.ts optional
|
|
196
|
+
├── Button.hooks.ts optional
|
|
197
|
+
├── Button.utils.ts optional
|
|
198
|
+
└── Button.module.scss optional
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Every other entry is reported as extra, including tests, images, nested directories, and alternative stylesheet names. Optional files are not required to exist.
|
|
202
|
+
|
|
203
|
+
Folder names follow the exact pattern `^[A-Z][a-z]+(?:[A-Z][a-z]+)*$`. `Button`, `UserCard`, and `ApiClient` pass. `A`, `UI`, `APIClient`, `Button2`, and `userCard` fail.
|
|
204
|
+
|
|
205
|
+
### File content rules
|
|
206
|
+
|
|
207
|
+
Imports are allowed in every validated file. The following table describes top-level declarations:
|
|
208
|
+
|
|
209
|
+
| File | Required content |
|
|
210
|
+
| --- | --- |
|
|
211
|
+
| `Button.tsx` | Exactly one named `Button` function declaration or one `const Button` initialized directly with an arrow/function expression. Other top-level declarations are forbidden. |
|
|
212
|
+
| `Button.data.ts` | Only `const` data declarations with SCREAMING_SNAKE_CASE identifier names. Direct arrow/function initializers are forbidden. |
|
|
213
|
+
| `Button.translates.ts` | Exactly one `const translates`, typed with `: TranslateMap` or `satisfies TranslateMap`, plus a named import locally called `TranslateMap` from a module path containing `core`. |
|
|
214
|
+
| `Button.hooks.ts` | Only hook functions or directly function-valued constants. Names must be camelCase and start with `use` followed by an uppercase letter or digit. Each implementation must call a hook. |
|
|
215
|
+
| `Button.utils.ts` | Only camelCase functions or directly function-valued constants. Hook names and hook calls are forbidden. |
|
|
216
|
+
| `Button.types.ts`, `index.ts` | No extra content checks from the custom rule; normal TypeScript rules still apply. |
|
|
217
|
+
|
|
218
|
+
Inline exports such as `export const Button = ...` and `export function Button() ...` are supported. Separate export statements in validated content files, such as `export { Button }` or `export default Button`, are rejected. Re-export the component from `index.ts` instead.
|
|
219
|
+
|
|
220
|
+
In `Button.tsx`, literal `className` values and template literals are forbidden. For example, `className="button"`, `className={'button'}`, and template strings fail. Use an expression such as `className={styles.root}`. The rule checks expression syntax, not whether the value actually comes from a CSS module.
|
|
221
|
+
|
|
222
|
+
### Example component
|
|
223
|
+
|
|
224
|
+
`Button.tsx` (the consuming React application supplies React types and SCSS module support):
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
import type { JSX } from 'react';
|
|
228
|
+
|
|
229
|
+
import styles from './Button.module.scss';
|
|
230
|
+
|
|
231
|
+
export const Button = (): JSX.Element => (
|
|
232
|
+
<button className={styles.root}>Save</button>
|
|
233
|
+
);
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
`index.ts`:
|
|
237
|
+
|
|
238
|
+
```ts
|
|
239
|
+
export { Button } from './Button';
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
`Button.module.scss`:
|
|
243
|
+
|
|
244
|
+
```scss
|
|
245
|
+
.root {
|
|
246
|
+
display: inline-flex;
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Examples for optional supporting files:
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
// Button.data.ts
|
|
254
|
+
export const BUTTON_LABEL = 'Save';
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
// Button.utils.ts
|
|
259
|
+
export const formatLabel = (value: string): string => value.trim();
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
```ts
|
|
263
|
+
// Button.hooks.ts
|
|
264
|
+
import { useState } from 'react';
|
|
265
|
+
|
|
266
|
+
export const useButtonState = (): boolean => {
|
|
267
|
+
const [enabled] = useState(false);
|
|
268
|
+
|
|
269
|
+
return enabled;
|
|
270
|
+
};
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Translation types belong to the consuming application. The package does not provide `TranslateMap` or a core library. For example, if your application's `@app/core` exports that type and an empty map is valid for it:
|
|
274
|
+
|
|
275
|
+
```ts
|
|
276
|
+
// Button.translates.ts
|
|
277
|
+
import type { TranslateMap } from '@app/core';
|
|
278
|
+
|
|
279
|
+
export const translates = {} satisfies TranslateMap;
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
The equivalent annotation `export const translates: TranslateMap = ...` is supported. An `as TranslateMap` assertion alone does not satisfy the rule.
|
|
283
|
+
|
|
284
|
+
## Overrides
|
|
285
|
+
|
|
286
|
+
Append configuration objects after the factory output to change the final behavior:
|
|
287
|
+
|
|
288
|
+
```js
|
|
289
|
+
import { createConfig } from '@numbado/eslint-config';
|
|
290
|
+
|
|
291
|
+
export default [
|
|
292
|
+
...createConfig({
|
|
293
|
+
tsconfigRootDir: import.meta.dirname,
|
|
294
|
+
reactComponentsPathes: ['src/components'],
|
|
295
|
+
}),
|
|
296
|
+
{
|
|
297
|
+
files: ['**/*.{ts,tsx}'],
|
|
298
|
+
rules: {
|
|
299
|
+
'@typescript-eslint/strict-boolean-expressions': 'error',
|
|
300
|
+
'@numbado/react-components-content': 'warn',
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
files: ['**/*.jsx'],
|
|
305
|
+
languageOptions: {
|
|
306
|
+
parserOptions: {
|
|
307
|
+
ecmaFeatures: { jsx: true },
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
ignores: ['coverage/**'],
|
|
313
|
+
},
|
|
314
|
+
];
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
To customize sorting, use the registered names `eslint-plugin-simple-import-sort/imports` and `eslint-plugin-simple-import-sort/exports`. To disable a custom rule, set its full `@numbado/...` name to `'off'`.
|
|
318
|
+
|
|
319
|
+
If configuring custom rule options directly in an override, the option object is `{ pathes: ['src/components'] }`, not `{ paths: ... }`, and requires a nonempty array. The factory normally supplies it for both rules.
|
|
320
|
+
|
|
321
|
+
## Troubleshooting and limitations
|
|
322
|
+
|
|
323
|
+
| Symptom | Check or action |
|
|
324
|
+
| --- | --- |
|
|
325
|
+
| A TypeScript file is outside the project service's project | Check the nearest `tsconfig.json` and its file coverage. The factory's `projects` option does not select a project; append supported parser options if your setup requires them. |
|
|
326
|
+
| JSX causes a parsing error in a `.jsx` file | Enable `parserOptions.ecmaFeatures.jsx` as shown above. `.tsx` already uses the TypeScript parser. |
|
|
327
|
+
| Component rules do not run | Check `reactComponentsPathes`, the working directory, the file extension, and whether ESLint processes a file inside the component folder. |
|
|
328
|
+
| An ignored test or image is reported as an extra component file | The structure rule reads the real directory, including entries ESLint ignores. Move the entry outside the component folder or override the structure rule. |
|
|
329
|
+
| `memo(...)` or `forwardRef(...)` is rejected in the main file | The content rule accepts direct function declarations/expressions, not wrapper calls. Override the rule if your component convention needs wrappers. |
|
|
330
|
+
| Structure changes are missed by an editor | Component directories are cached once per loaded module/process. Restart the ESLint process to rescan them. |
|
|
331
|
+
|
|
332
|
+
Other implementation limits:
|
|
333
|
+
|
|
334
|
+
- Structure validation is triggered by linted files. It does not discover empty folders or folders with no processed files.
|
|
335
|
+
- Structure errors appear on line 1 of the file that triggers the directory check.
|
|
336
|
+
- Hook detection is based on call names, including member calls such as `React.useState()`. It does not resolve imports or enforce React's Rules of Hooks. Calls only inside nested functions do not satisfy the hook implementation check.
|
|
337
|
+
- Data validation does not require exports despite the diagnostic wording, and it does not inspect functions nested inside objects or arrays. Exports are also optional for the other validated declarations.
|
|
338
|
+
- Translation import validation checks whether the source string contains `core`; it does not resolve a particular core package.
|
|
339
|
+
- `index.ts` re-export contents, `.types.ts` declarations, and SCSS contents are not validated by the custom content rule.
|
|
340
|
+
|
|
341
|
+
## Development
|
|
342
|
+
|
|
343
|
+
Install dependencies and build from the repository root:
|
|
344
|
+
|
|
345
|
+
```sh
|
|
346
|
+
pnpm install --frozen-lockfile
|
|
347
|
+
pnpm build
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
On Windows, if PowerShell blocks the pnpm script, use `pnpm.cmd` for the same commands.
|
|
351
|
+
|
|
352
|
+
### Commands and build output
|
|
353
|
+
|
|
354
|
+
| Command | Action |
|
|
355
|
+
| --- | --- |
|
|
356
|
+
| `pnpm build` | Run tsup, clean `.dist`, and generate ESM, CommonJS, and declaration files. |
|
|
357
|
+
| `pnpm release:local` | Build and create a package tarball with `pnpm pack`. |
|
|
358
|
+
| `pnpm exec eslint .` | Run the repository's ESLint configuration directly. There is no `lint` script. |
|
|
359
|
+
| `pnpm release` | Build and publish to npm with `--access public`. This performs a real publication. |
|
|
360
|
+
|
|
361
|
+
The build entry is `src/index.ts`. Outputs include `.dist/index.js`, `.dist/index.cjs`, `.dist/index.d.ts`, and `.dist/index.d.cts`. Runtime dependencies remain external. The package's `files` allowlist contains `.dist`.
|
|
362
|
+
|
|
363
|
+
There is no test script or automated test suite in this repository. A successful build verifies bundling and declaration generation, not every lint rule scenario.
|
|
364
|
+
|
|
365
|
+
### Source layout
|
|
366
|
+
|
|
367
|
+
| Path | Purpose |
|
|
368
|
+
| --- | --- |
|
|
369
|
+
| `src/index.ts` | Public factory, shared rules, parser settings, ignores, and configuration order. |
|
|
370
|
+
| `src/tools/plugins.ts` | Registration of the two internal React rules. |
|
|
371
|
+
| `src/tools/react-components-structure.ts` | Filesystem-based component structure validation. |
|
|
372
|
+
| `src/tools/react-components-content.ts` | AST listeners for component content validation. |
|
|
373
|
+
| `src/utils/` | Path matching, AST helpers, naming checks, and file-specific validators. |
|
|
374
|
+
| `src/data/` | Rule names, diagnostics, filename conventions, and naming patterns. |
|
|
375
|
+
| `src/models/` | TypeScript option types and diagnostic identifiers. |
|
|
376
|
+
| `eslint.config.ts` | This repository's own use of the factory. |
|
|
377
|
+
| `tsup.config.ts`, `tsconfig.json` | Build and TypeScript configuration. |
|
|
378
|
+
|
|
379
|
+
### Package metadata
|
|
380
|
+
|
|
381
|
+
Two existing metadata inconsistencies should be resolved before a release:
|
|
382
|
+
|
|
383
|
+
- [LICENSE](LICENSE) contains the MIT license, while `package.json` declares `ISC`.
|
|
384
|
+
- `publishConfig.access` is `restricted`, while the `release` script explicitly publishes with public access.
|
|
385
|
+
|
|
386
|
+
These values are documented as they currently exist; the documentation does not change package metadata.
|