@forthtilliath/eslint-config 0.1.0 → 0.2.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/LICENSE +21 -0
- package/README.md +123 -92
- package/dist/angular.d.ts +8 -0
- package/dist/angular.d.ts.map +1 -1
- package/dist/angular.js +50 -40
- package/dist/base.d.ts +45 -1
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +149 -123
- package/dist/nextjs.d.ts +11 -1
- package/dist/nextjs.d.ts.map +1 -1
- package/dist/nextjs.js +54 -70
- package/dist/react.d.ts +8 -0
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +75 -59
- package/dist/storybook.d.ts +9 -1
- package/dist/storybook.d.ts.map +1 -1
- package/dist/storybook.js +27 -19
- package/package.json +54 -54
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Forthtilliath
|
|
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,92 +1,123 @@
|
|
|
1
|
-
# @forthtilliath/eslint-config
|
|
2
|
-
|
|
3
|
-
Shared ESLint flat configs (`eslint.config.js`/`.ts`) — for every package/app
|
|
4
|
-
in this monorepo, and for any other project that wants the same setup via a
|
|
5
|
-
single import instead of hand-assembling a dozen plugins. Built on
|
|
6
|
-
`typescript-eslint`'s `strictTypeChecked` + `stylisticTypeChecked` presets,
|
|
7
|
-
with import sorting, Turborepo's own lint plugin, and Prettier
|
|
8
|
-
conflict-resolution baked in.
|
|
9
|
-
|
|
10
|
-
## Install
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm install --save-dev @forthtilliath/eslint-config eslint typescript
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Or, from within this monorepo, as a workspace dependency:
|
|
17
|
-
|
|
18
|
-
```json
|
|
19
|
-
{
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@forthtilliath/eslint-config": "workspace:*"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
`eslint` and `typescript` are peer dependencies — install them yourself (any
|
|
27
|
-
recent flat-config-era ESLint 9+/10+, and TypeScript 5+). Every ESLint plugin
|
|
28
|
-
each variant actually uses (`typescript-eslint`, `eslint-plugin-react`,
|
|
29
|
-
`angular-eslint`, etc.) ships as a regular dependency of this package, so
|
|
30
|
-
there's nothing else to install per variant.
|
|
31
|
-
|
|
32
|
-
## Usage
|
|
33
|
-
|
|
34
|
-
Pick the variant that matches the package, in its `eslint.config.ts`:
|
|
35
|
-
|
|
36
|
-
```ts
|
|
37
|
-
// A plain TypeScript library (packages/lib, packages/types)
|
|
38
|
-
import { baseConfig } from "@forthtilliath/eslint-config";
|
|
39
|
-
export default baseConfig;
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
```ts
|
|
43
|
-
// A React library (packages/react/*)
|
|
44
|
-
import { reactConfig } from "@forthtilliath/eslint-config/react";
|
|
45
|
-
export default reactConfig;
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
// A Next.js app (apps/web)
|
|
50
|
-
import { nextJsConfig } from "@forthtilliath/eslint-config/nextjs";
|
|
51
|
-
export default nextJsConfig;
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
```ts
|
|
55
|
-
// A Storybook app (apps/react-sb)
|
|
56
|
-
import { storybookConfig } from "@forthtilliath/eslint-config/storybook";
|
|
57
|
-
export default storybookConfig;
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
```ts
|
|
61
|
-
// An Angular app/library
|
|
62
|
-
import { angularConfig } from "@forthtilliath/eslint-config/angular";
|
|
63
|
-
export default angularConfig;
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
All five are **named** exports — a default import (`import config from "..."`)
|
|
67
|
-
resolves to the whole module namespace object instead of the config array and
|
|
68
|
-
crashes ESLint's flat-config loader outright. Two of the five variants had
|
|
69
|
-
exactly this bug at one point; use the named-import form above.
|
|
70
|
-
|
|
71
|
-
Each variant is additive: `reactConfig`/`angularConfig` extend `baseConfig`,
|
|
72
|
-
`nextJsConfig`/`storybookConfig` extend `reactConfig`.
|
|
73
|
-
|
|
74
|
-
###
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
`
|
|
78
|
-
`
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
1
|
+
# @forthtilliath/eslint-config
|
|
2
|
+
|
|
3
|
+
Shared ESLint flat configs (`eslint.config.js`/`.ts`) — for every package/app
|
|
4
|
+
in this monorepo, and for any other project that wants the same setup via a
|
|
5
|
+
single import instead of hand-assembling a dozen plugins. Built on
|
|
6
|
+
`typescript-eslint`'s `strictTypeChecked` + `stylisticTypeChecked` presets,
|
|
7
|
+
with import sorting, Turborepo's own lint plugin, and Prettier
|
|
8
|
+
conflict-resolution baked in.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install --save-dev @forthtilliath/eslint-config eslint typescript
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or, from within this monorepo, as a workspace dependency:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@forthtilliath/eslint-config": "workspace:*"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`eslint` and `typescript` are peer dependencies — install them yourself (any
|
|
27
|
+
recent flat-config-era ESLint 9+/10+, and TypeScript 5+). Every ESLint plugin
|
|
28
|
+
each variant actually uses (`typescript-eslint`, `eslint-plugin-react`,
|
|
29
|
+
`angular-eslint`, etc.) ships as a regular dependency of this package, so
|
|
30
|
+
there's nothing else to install per variant.
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
Pick the variant that matches the package, in its `eslint.config.ts`:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// A plain TypeScript library (packages/lib, packages/types)
|
|
38
|
+
import { baseConfig } from "@forthtilliath/eslint-config";
|
|
39
|
+
export default baseConfig;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// A React library (packages/react/*)
|
|
44
|
+
import { reactConfig } from "@forthtilliath/eslint-config/react";
|
|
45
|
+
export default reactConfig;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
// A Next.js app (apps/web)
|
|
50
|
+
import { nextJsConfig } from "@forthtilliath/eslint-config/nextjs";
|
|
51
|
+
export default nextJsConfig;
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
// A Storybook app (apps/react-sb)
|
|
56
|
+
import { storybookConfig } from "@forthtilliath/eslint-config/storybook";
|
|
57
|
+
export default storybookConfig;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
// An Angular app/library
|
|
62
|
+
import { angularConfig } from "@forthtilliath/eslint-config/angular";
|
|
63
|
+
export default angularConfig;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
All five are **named** exports — a default import (`import config from "..."`)
|
|
67
|
+
resolves to the whole module namespace object instead of the config array and
|
|
68
|
+
crashes ESLint's flat-config loader outright. Two of the five variants had
|
|
69
|
+
exactly this bug at one point; use the named-import form above.
|
|
70
|
+
|
|
71
|
+
Each variant is additive: `reactConfig`/`angularConfig` extend `baseConfig`,
|
|
72
|
+
`nextJsConfig`/`storybookConfig` extend `reactConfig`.
|
|
73
|
+
|
|
74
|
+
### Customizing a variant
|
|
75
|
+
|
|
76
|
+
Each variant is also exported as a factory (`createBaseConfig`,
|
|
77
|
+
`createReactConfig`, `createNextJsConfig`, `createStorybookConfig`,
|
|
78
|
+
`createAngularConfig`) taking an options object — the plain `baseConfig`,
|
|
79
|
+
`reactConfig`, etc. exports above are just that factory called with no
|
|
80
|
+
arguments. Pass options to opt out of a default:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
// Turn off Prettier conflict-resolution (e.g. the project doesn't use Prettier)
|
|
84
|
+
import { createReactConfig } from "@forthtilliath/eslint-config/react";
|
|
85
|
+
export default createReactConfig({ prettier: false });
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
// Fall back to typescript-eslint's `recommended` preset instead of
|
|
90
|
+
// `strictTypeChecked`/`stylisticTypeChecked` (e.g. while migrating an
|
|
91
|
+
// existing codebase), and skip the Turborepo-only rule outside a Turborepo.
|
|
92
|
+
import { createBaseConfig } from "@forthtilliath/eslint-config";
|
|
93
|
+
export default createBaseConfig({ strict: false, turbo: false });
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
| Option | Default | Effect |
|
|
97
|
+
| ---------- | ------- | ------------------------------------------------------------------------------ |
|
|
98
|
+
| `prettier` | `true` | Append `eslint-config-prettier` at the end. |
|
|
99
|
+
| `strict` | `true` | Use `strictTypeChecked`/`stylisticTypeChecked` instead of plain `recommended`. |
|
|
100
|
+
| `turbo` | `true` | Enable `eslint-plugin-turbo`'s `no-undeclared-env-vars` rule. |
|
|
101
|
+
|
|
102
|
+
Options are forwarded down the chain, so `createNextJsConfig({ prettier: false })`
|
|
103
|
+
also disables Prettier in the `reactConfig`/`baseConfig` layers it builds on.
|
|
104
|
+
|
|
105
|
+
### Typed linting and non-project files
|
|
106
|
+
|
|
107
|
+
Rules that need type information (`consistent-type-exports`,
|
|
108
|
+
`naming-convention`, etc.) are scoped to `**/*.{ts,tsx,mts,cts}` only, and
|
|
109
|
+
`eslint.config.js`/`.ts`, `storybook-static/**` and `dist/**` are excluded
|
|
110
|
+
from linting entirely — none of them belong to a package's own `tsconfig`
|
|
111
|
+
project, so type-aware rules crash on them otherwise.
|
|
112
|
+
|
|
113
|
+
## Scripts
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
pnpm run build # tsc -> dist/ (consumers import the built output)
|
|
117
|
+
pnpm run dev # tsc --watch
|
|
118
|
+
pnpm run check-types # tsc --noEmit
|
|
119
|
+
pnpm run lint # eslint (lints its own src/)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Run `pnpm run build` after editing `src/*.js` — consuming packages resolve
|
|
123
|
+
`@forthtilliath/eslint-config/*` to `dist/*.js`, not the source.
|
package/dist/angular.d.ts
CHANGED
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
* `@angular-eslint/directive-selector` / `@angular-eslint/component-selector`
|
|
7
7
|
* locally after spreading this config.
|
|
8
8
|
*
|
|
9
|
+
* @param {import("./base.js").BaseConfigOptions} [options]
|
|
10
|
+
* @returns {import("eslint").Linter.Config[]}
|
|
11
|
+
*/
|
|
12
|
+
export function createAngularConfig(options?: import("./base.js").BaseConfigOptions): import("eslint").Linter.Config[];
|
|
13
|
+
/**
|
|
14
|
+
* A custom ESLint configuration for Angular applications/libraries, with the
|
|
15
|
+
* default options. Use `createAngularConfig(options)` instead to customize it.
|
|
16
|
+
*
|
|
9
17
|
* @type {import("eslint").Linter.Config[]} */
|
|
10
18
|
export const angularConfig: import("eslint").Linter.Config[];
|
|
11
19
|
//# sourceMappingURL=angular.d.ts.map
|
package/dist/angular.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular.d.ts","sourceRoot":"","sources":["../src/angular.js"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"angular.d.ts","sourceRoot":"","sources":["../src/angular.js"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,8CAHW,OAAO,WAAW,EAAE,iBAAiB,GACnC,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CA2C5C;AAED;;;;8CAI8C;AAC9C,4BADU,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CACS"}
|
package/dist/angular.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import angular from "angular-eslint";
|
|
2
2
|
import { defineConfig } from "eslint/config";
|
|
3
3
|
import tseslint from "typescript-eslint";
|
|
4
|
-
import {
|
|
4
|
+
import { createBaseConfig } from "./base.js";
|
|
5
5
|
/**
|
|
6
6
|
* A custom ESLint configuration for Angular applications/libraries.
|
|
7
7
|
*
|
|
@@ -10,44 +10,54 @@ import { baseConfig } from "./base.js";
|
|
|
10
10
|
* `@angular-eslint/directive-selector` / `@angular-eslint/component-selector`
|
|
11
11
|
* locally after spreading this config.
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
* @param {import("./base.js").BaseConfigOptions} [options]
|
|
14
|
+
* @returns {import("eslint").Linter.Config[]}
|
|
15
|
+
*/
|
|
16
|
+
export function createAngularConfig(options) {
|
|
17
|
+
return defineConfig([
|
|
18
|
+
...createBaseConfig(options),
|
|
19
|
+
{
|
|
20
|
+
// Build/cache artifacts specific to the Angular CLI (baseConfig only knows
|
|
21
|
+
// about generic dist/**) : without this, ESLint also lints the bundled,
|
|
22
|
+
// minified Vite dep cache and reports thousands of spurious errors on it.
|
|
23
|
+
ignores: [".angular/**", "dist/**", "coverage/**"],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
files: ["**/*.ts"],
|
|
27
|
+
extends: [angular.configs.tsRecommended],
|
|
28
|
+
processor: angular.processInlineTemplates,
|
|
29
|
+
rules: {
|
|
30
|
+
"@angular-eslint/directive-selector": [
|
|
31
|
+
"error",
|
|
32
|
+
{ type: "attribute", prefix: "app", style: "camelCase" },
|
|
33
|
+
],
|
|
34
|
+
"@angular-eslint/component-selector": [
|
|
35
|
+
"error",
|
|
36
|
+
{ type: "element", prefix: "app", style: "kebab-case" },
|
|
37
|
+
],
|
|
38
|
+
// Un composant/page Angular sans logique propre (juste un template +
|
|
39
|
+
// decorateur) est un corps de classe legitimement vide, pas du code mort.
|
|
40
|
+
"@typescript-eslint/no-extraneous-class": "off",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
// baseConfig's tseslint.configs.strictTypeChecked/stylisticTypeChecked apply
|
|
45
|
+
// with no `files` restriction, so without this they leak onto templates
|
|
46
|
+
// (parsed by angular-eslint/template-parser, which has no type information)
|
|
47
|
+
// and crash on the first type-aware rule ESLint tries to load.
|
|
48
|
+
files: ["**/*.html"],
|
|
49
|
+
extends: [
|
|
50
|
+
tseslint.configs.disableTypeChecked,
|
|
51
|
+
angular.configs.templateRecommended,
|
|
52
|
+
angular.configs.templateAccessibility,
|
|
34
53
|
],
|
|
35
|
-
|
|
36
|
-
// decorateur) est un corps de classe legitimement vide, pas du code mort.
|
|
37
|
-
"@typescript-eslint/no-extraneous-class": "off",
|
|
54
|
+
rules: {},
|
|
38
55
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
tseslint.configs.disableTypeChecked,
|
|
48
|
-
angular.configs.templateRecommended,
|
|
49
|
-
angular.configs.templateAccessibility,
|
|
50
|
-
],
|
|
51
|
-
rules: {},
|
|
52
|
-
},
|
|
53
|
-
]);
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A custom ESLint configuration for Angular applications/libraries, with the
|
|
60
|
+
* default options. Use `createAngularConfig(options)` instead to customize it.
|
|
61
|
+
*
|
|
62
|
+
* @type {import("eslint").Linter.Config[]} */
|
|
63
|
+
export const angularConfig = createAngularConfig();
|
package/dist/base.d.ts
CHANGED
|
@@ -1,7 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @typedef {object} BaseConfigOptions
|
|
3
|
+
* @property {boolean} [prettier=true] - Append eslint-config-prettier at the
|
|
4
|
+
* end, turning off stylistic rules that would fight Prettier (which runs
|
|
5
|
+
* separately, not as an ESLint rule). Set to `false` if the consuming
|
|
6
|
+
* project doesn't use Prettier.
|
|
7
|
+
* @property {boolean} [strict=true] - Use typescript-eslint's
|
|
8
|
+
* `strictTypeChecked` + `stylisticTypeChecked` presets. Set to `false` to
|
|
9
|
+
* fall back to the plain `recommended` preset instead (useful while
|
|
10
|
+
* migrating an existing codebase that isn't ready for the strict rules).
|
|
11
|
+
* @property {boolean} [turbo=true] - Enable eslint-plugin-turbo's
|
|
12
|
+
* `no-undeclared-env-vars` rule. Only relevant inside a Turborepo; set to
|
|
13
|
+
* `false` for a standalone project.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Builds a shared ESLint configuration for the repository.
|
|
17
|
+
*
|
|
18
|
+
* @param {BaseConfigOptions} [options]
|
|
19
|
+
* @returns {import("eslint").Linter.Config[]}
|
|
20
|
+
*/
|
|
21
|
+
export function createBaseConfig({ prettier, strict, turbo, }?: BaseConfigOptions): import("eslint").Linter.Config[];
|
|
22
|
+
/**
|
|
23
|
+
* A shared ESLint configuration for the repository, with the default options.
|
|
24
|
+
* Use `createBaseConfig(options)` instead to customize it.
|
|
3
25
|
*
|
|
4
26
|
* @type {import("eslint").Linter.Config[]}
|
|
5
27
|
* */
|
|
6
28
|
export const baseConfig: import("eslint").Linter.Config[];
|
|
29
|
+
export type BaseConfigOptions = {
|
|
30
|
+
/**
|
|
31
|
+
* - Append eslint-config-prettier at the
|
|
32
|
+
* end, turning off stylistic rules that would fight Prettier (which runs
|
|
33
|
+
* separately, not as an ESLint rule). Set to `false` if the consuming
|
|
34
|
+
* project doesn't use Prettier.
|
|
35
|
+
*/
|
|
36
|
+
prettier?: boolean | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* - Use typescript-eslint's
|
|
39
|
+
* `strictTypeChecked` + `stylisticTypeChecked` presets. Set to `false` to
|
|
40
|
+
* fall back to the plain `recommended` preset instead (useful while
|
|
41
|
+
* migrating an existing codebase that isn't ready for the strict rules).
|
|
42
|
+
*/
|
|
43
|
+
strict?: boolean | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* - Enable eslint-plugin-turbo's
|
|
46
|
+
* `no-undeclared-env-vars` rule. Only relevant inside a Turborepo; set to
|
|
47
|
+
* `false` for a standalone project.
|
|
48
|
+
*/
|
|
49
|
+
turbo?: boolean | undefined;
|
|
50
|
+
};
|
|
7
51
|
//# sourceMappingURL=base.d.ts.map
|
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.js"],"names":[],"mappings":"AAQA
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,gEAHW,iBAAiB,GACf,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAyI5C;AAED;;;;;KAKK;AACL,yBAFU,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAEG"}
|
package/dist/base.js
CHANGED
|
@@ -6,135 +6,161 @@ import turboPlugin from "eslint-plugin-turbo";
|
|
|
6
6
|
import globals from "globals";
|
|
7
7
|
import tseslint from "typescript-eslint";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* @typedef {object} BaseConfigOptions
|
|
10
|
+
* @property {boolean} [prettier=true] - Append eslint-config-prettier at the
|
|
11
|
+
* end, turning off stylistic rules that would fight Prettier (which runs
|
|
12
|
+
* separately, not as an ESLint rule). Set to `false` if the consuming
|
|
13
|
+
* project doesn't use Prettier.
|
|
14
|
+
* @property {boolean} [strict=true] - Use typescript-eslint's
|
|
15
|
+
* `strictTypeChecked` + `stylisticTypeChecked` presets. Set to `false` to
|
|
16
|
+
* fall back to the plain `recommended` preset instead (useful while
|
|
17
|
+
* migrating an existing codebase that isn't ready for the strict rules).
|
|
18
|
+
* @property {boolean} [turbo=true] - Enable eslint-plugin-turbo's
|
|
19
|
+
* `no-undeclared-env-vars` rule. Only relevant inside a Turborepo; set to
|
|
20
|
+
* `false` for a standalone project.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Builds a shared ESLint configuration for the repository.
|
|
10
24
|
*
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
languageOptions: {
|
|
31
|
-
// Globaux Node (process, __dirname, module, require...) : la config
|
|
32
|
-
// partagée elle-même s'exécute sous Node (ex. process.cwd() ci-dessous),
|
|
33
|
-
// et la plupart des consommateurs (scripts, configs, apps Next.js côté
|
|
34
|
-
// serveur) en ont aussi besoin. Sans risque de collision avec les
|
|
35
|
-
// globaux navigateur ajoutés par les configs plus spécifiques
|
|
36
|
-
// (react.js, nextjs.js) qui étendent celle-ci.
|
|
37
|
-
globals: {
|
|
38
|
-
...globals.node,
|
|
39
|
-
},
|
|
40
|
-
parserOptions: {
|
|
41
|
-
projectService: true,
|
|
42
|
-
tsconfigRootDir: process.cwd(),
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
files: ["**/*.js"],
|
|
48
|
-
extends: [tseslint.configs.disableTypeChecked],
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
plugins: {
|
|
52
|
-
"simple-import-sort": simpleImportSortPlugin,
|
|
25
|
+
* @param {BaseConfigOptions} [options]
|
|
26
|
+
* @returns {import("eslint").Linter.Config[]}
|
|
27
|
+
*/
|
|
28
|
+
export function createBaseConfig({ prettier = true, strict = true, turbo = true, } = {}) {
|
|
29
|
+
return defineConfig([
|
|
30
|
+
eslint.configs.recommended,
|
|
31
|
+
strict ? tseslint.configs.strictTypeChecked : tseslint.configs.recommended,
|
|
32
|
+
strict ? tseslint.configs.stylisticTypeChecked : [],
|
|
33
|
+
{
|
|
34
|
+
ignores: [
|
|
35
|
+
"dist/**",
|
|
36
|
+
"storybook-static/**",
|
|
37
|
+
"postcss.config.cjs",
|
|
38
|
+
"postcss.config.mjs",
|
|
39
|
+
"eslint.config.js",
|
|
40
|
+
"eslint.config.mjs",
|
|
41
|
+
"eslint.config.cjs",
|
|
42
|
+
"eslint.config.ts",
|
|
43
|
+
],
|
|
53
44
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)",
|
|
65
|
-
],
|
|
66
|
-
// Packages. `react` related packages come first.
|
|
67
|
-
["^react", "^@?\\w"],
|
|
68
|
-
// Internal packages.
|
|
69
|
-
["^(@forthtilliath)(/.*|$)"],
|
|
70
|
-
["^(@|@ui|components|utils|config)(/.*|$)"],
|
|
71
|
-
// Side effect imports.
|
|
72
|
-
["^\\u0000"],
|
|
73
|
-
// Parent imports. Put `..` last.
|
|
74
|
-
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
|
|
75
|
-
// Other relative imports. Put same-folder imports and `.` last.
|
|
76
|
-
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
|
|
77
|
-
// Style imports.
|
|
78
|
-
["^.+\\.s?css$"],
|
|
79
|
-
],
|
|
45
|
+
{
|
|
46
|
+
languageOptions: {
|
|
47
|
+
// Globaux Node (process, __dirname, module, require...) : la config
|
|
48
|
+
// partagée elle-même s'exécute sous Node (ex. process.cwd() ci-dessous),
|
|
49
|
+
// et la plupart des consommateurs (scripts, configs, apps Next.js côté
|
|
50
|
+
// serveur) en ont aussi besoin. Sans risque de collision avec les
|
|
51
|
+
// globaux navigateur ajoutés par les configs plus spécifiques
|
|
52
|
+
// (react.js, nextjs.js) qui étendent celle-ci.
|
|
53
|
+
globals: {
|
|
54
|
+
...globals.node,
|
|
80
55
|
},
|
|
81
|
-
|
|
82
|
-
|
|
56
|
+
parserOptions: {
|
|
57
|
+
projectService: true,
|
|
58
|
+
tsconfigRootDir: process.cwd(),
|
|
59
|
+
},
|
|
60
|
+
},
|
|
83
61
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
turbo: turboPlugin,
|
|
62
|
+
{
|
|
63
|
+
files: ["**/*.js"],
|
|
64
|
+
extends: [tseslint.configs.disableTypeChecked],
|
|
88
65
|
},
|
|
89
|
-
|
|
90
|
-
|
|
66
|
+
{
|
|
67
|
+
plugins: {
|
|
68
|
+
"simple-import-sort": simpleImportSortPlugin,
|
|
69
|
+
},
|
|
70
|
+
rules: {
|
|
71
|
+
"simple-import-sort/imports": [
|
|
72
|
+
"error",
|
|
73
|
+
{
|
|
74
|
+
groups: [
|
|
75
|
+
// Node.js builtins. You could also generate this regex if you use a `.js` config.
|
|
76
|
+
// For example: `^(${require("module").builtinModules.join("|")})(/|$)`
|
|
77
|
+
// Note that if you use the `node:` prefix for Node.js builtins,
|
|
78
|
+
// you can avoid this complexity: You can simply use "^node:".
|
|
79
|
+
[
|
|
80
|
+
"^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)",
|
|
81
|
+
],
|
|
82
|
+
// Packages. `react` related packages come first.
|
|
83
|
+
["^react", "^@?\\w"],
|
|
84
|
+
// Internal packages.
|
|
85
|
+
["^(@forthtilliath)(/.*|$)"],
|
|
86
|
+
["^(@|@ui|components|utils|config)(/.*|$)"],
|
|
87
|
+
// Side effect imports.
|
|
88
|
+
["^\\u0000"],
|
|
89
|
+
// Parent imports. Put `..` last.
|
|
90
|
+
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
|
|
91
|
+
// Other relative imports. Put same-folder imports and `.` last.
|
|
92
|
+
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
|
|
93
|
+
// Style imports.
|
|
94
|
+
["^.+\\.s?css$"],
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
"simple-import-sort/exports": "error",
|
|
99
|
+
},
|
|
91
100
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
rules: {
|
|
97
|
-
// "@typescript-eslint/no-unused-vars": "error",
|
|
98
|
-
"@typescript-eslint/ban-ts-comment": "error",
|
|
99
|
-
"@typescript-eslint/ban-tslint-comment": "error",
|
|
100
|
-
"@typescript-eslint/consistent-type-exports": "error",
|
|
101
|
-
"@typescript-eslint/consistent-type-imports": "error",
|
|
102
|
-
"@typescript-eslint/method-signature-style": "error",
|
|
103
|
-
// ignoreStatic : sans ca, une reference a une methode statique (ex.
|
|
104
|
-
// Validators.required dans un FormBuilder Angular) est a tort consideree
|
|
105
|
-
// comme "unbound" alors qu'une methode statique n'a pas de `this` a lier.
|
|
106
|
-
"@typescript-eslint/unbound-method": ["error", { ignoreStatic: true }],
|
|
107
|
-
// allowNumber : tres courant de construire une URL avec un id numerique
|
|
108
|
-
// (`${this.baseUrl}/${id}`) ; sans ca, chaque service HTTP typique
|
|
109
|
-
// declenche une erreur pour un usage parfaitement sur.
|
|
110
|
-
"@typescript-eslint/restrict-template-expressions": [
|
|
111
|
-
"error",
|
|
112
|
-
{ allowNumber: true },
|
|
113
|
-
],
|
|
114
|
-
"@typescript-eslint/naming-convention": [
|
|
115
|
-
"error",
|
|
116
|
-
// https://typescript-eslint.io/rules/naming-convention
|
|
117
|
-
{
|
|
118
|
-
selector: "variable",
|
|
119
|
-
format: ["camelCase"],
|
|
120
|
-
leadingUnderscore: "allow",
|
|
101
|
+
turbo
|
|
102
|
+
? {
|
|
103
|
+
plugins: {
|
|
104
|
+
turbo: turboPlugin,
|
|
121
105
|
},
|
|
122
|
-
{
|
|
123
|
-
|
|
124
|
-
modifiers: ["const"],
|
|
125
|
-
format: ["camelCase", "UPPER_CASE"],
|
|
126
|
-
leadingUnderscore: "allow",
|
|
106
|
+
rules: {
|
|
107
|
+
"turbo/no-undeclared-env-vars": "error",
|
|
127
108
|
},
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
109
|
+
}
|
|
110
|
+
: [],
|
|
111
|
+
{
|
|
112
|
+
files: ["**/*.{ts,tsx,mts,cts}"],
|
|
113
|
+
plugins: {},
|
|
114
|
+
rules: {
|
|
115
|
+
// "@typescript-eslint/no-unused-vars": "error",
|
|
116
|
+
"@typescript-eslint/ban-ts-comment": "error",
|
|
117
|
+
"@typescript-eslint/ban-tslint-comment": "error",
|
|
118
|
+
"@typescript-eslint/consistent-type-exports": "error",
|
|
119
|
+
"@typescript-eslint/consistent-type-imports": "error",
|
|
120
|
+
"@typescript-eslint/method-signature-style": "error",
|
|
121
|
+
// ignoreStatic : sans ca, une reference a une methode statique (ex.
|
|
122
|
+
// Validators.required dans un FormBuilder Angular) est a tort consideree
|
|
123
|
+
// comme "unbound" alors qu'une methode statique n'a pas de `this` a lier.
|
|
124
|
+
"@typescript-eslint/unbound-method": ["error", { ignoreStatic: true }],
|
|
125
|
+
// allowNumber : tres courant de construire une URL avec un id numerique
|
|
126
|
+
// (`${this.baseUrl}/${id}`) ; sans ca, chaque service HTTP typique
|
|
127
|
+
// declenche une erreur pour un usage parfaitement sur.
|
|
128
|
+
"@typescript-eslint/restrict-template-expressions": [
|
|
129
|
+
"error",
|
|
130
|
+
{ allowNumber: true },
|
|
131
|
+
],
|
|
132
|
+
"@typescript-eslint/naming-convention": [
|
|
133
|
+
"error",
|
|
134
|
+
// https://typescript-eslint.io/rules/naming-convention
|
|
135
|
+
{
|
|
136
|
+
selector: "variable",
|
|
137
|
+
format: ["camelCase"],
|
|
138
|
+
leadingUnderscore: "allow",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
selector: "variable",
|
|
142
|
+
modifiers: ["const"],
|
|
143
|
+
format: ["camelCase", "UPPER_CASE"],
|
|
144
|
+
leadingUnderscore: "allow",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
selector: "function",
|
|
148
|
+
format: ["camelCase"],
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
selector: "typeLike",
|
|
152
|
+
format: ["PascalCase"],
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
},
|
|
137
156
|
},
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
157
|
+
prettier ? eslintConfigPrettier : [],
|
|
158
|
+
]);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* A shared ESLint configuration for the repository, with the default options.
|
|
162
|
+
* Use `createBaseConfig(options)` instead to customize it.
|
|
163
|
+
*
|
|
164
|
+
* @type {import("eslint").Linter.Config[]}
|
|
165
|
+
* */
|
|
166
|
+
export const baseConfig = createBaseConfig();
|
package/dist/nextjs.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A custom ESLint configuration for
|
|
2
|
+
* A custom ESLint configuration for Next.js applications, built on top of
|
|
3
|
+
* {@link createReactConfig} (same React/naming-convention rules, plus
|
|
4
|
+
* Next.js's own plugin).
|
|
5
|
+
*
|
|
6
|
+
* @param {import("./base.js").BaseConfigOptions} [options]
|
|
7
|
+
* @returns {import("eslint").Linter.Config[]}
|
|
8
|
+
* */
|
|
9
|
+
export function createNextJsConfig(options?: import("./base.js").BaseConfigOptions): import("eslint").Linter.Config[];
|
|
10
|
+
/**
|
|
11
|
+
* A custom ESLint configuration for Next.js applications, with the default
|
|
12
|
+
* options. Use `createNextJsConfig(options)` instead to customize it.
|
|
3
13
|
*
|
|
4
14
|
* @type {import("eslint").Linter.Config[]}
|
|
5
15
|
* */
|
package/dist/nextjs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs.d.ts","sourceRoot":"","sources":["../src/nextjs.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nextjs.d.ts","sourceRoot":"","sources":["../src/nextjs.js"],"names":[],"mappings":"AAKA;;;;;;;KAOK;AACL,6CAHW,OAAO,WAAW,EAAE,iBAAiB,GACnC,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CA6C5C;AAED;;;;;KAKK;AACL,2BAFU,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAEO"}
|
package/dist/nextjs.js
CHANGED
|
@@ -1,78 +1,62 @@
|
|
|
1
|
-
import js from "@eslint/js";
|
|
2
1
|
import pluginNext from "@next/eslint-plugin-next";
|
|
3
2
|
import { defineConfig } from "eslint/config";
|
|
4
|
-
import
|
|
5
|
-
import pluginReact from "eslint-plugin-react";
|
|
6
|
-
import pluginReactHooks from "eslint-plugin-react-hooks";
|
|
7
|
-
import globals from "globals";
|
|
8
|
-
import tseslint from "typescript-eslint";
|
|
9
|
-
import { baseConfig } from "./base.js";
|
|
3
|
+
import { createReactConfig } from "./react.js";
|
|
10
4
|
/**
|
|
11
|
-
* A custom ESLint configuration for
|
|
5
|
+
* A custom ESLint configuration for Next.js applications, built on top of
|
|
6
|
+
* {@link createReactConfig} (same React/naming-convention rules, plus
|
|
7
|
+
* Next.js's own plugin).
|
|
12
8
|
*
|
|
13
|
-
* @
|
|
9
|
+
* @param {import("./base.js").BaseConfigOptions} [options]
|
|
10
|
+
* @returns {import("eslint").Linter.Config[]}
|
|
14
11
|
* */
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
...baseConfig,
|
|
20
|
-
js.configs.recommended,
|
|
21
|
-
eslintConfigPrettier,
|
|
22
|
-
...tseslint.configs.recommended,
|
|
23
|
-
{
|
|
24
|
-
...pluginReact.configs.flat.recommended,
|
|
25
|
-
languageOptions: {
|
|
26
|
-
...pluginReact.configs.flat.recommended.languageOptions,
|
|
27
|
-
globals: {
|
|
28
|
-
...globals.serviceworker,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
plugins: {
|
|
34
|
-
"@next/next": pluginNext,
|
|
12
|
+
export function createNextJsConfig(options) {
|
|
13
|
+
return defineConfig([
|
|
14
|
+
{
|
|
15
|
+
ignores: [".next/**", "next-env.d.ts"],
|
|
35
16
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
settings: { react: { version: "19" } },
|
|
46
|
-
rules: {
|
|
47
|
-
...pluginReactHooks.configs.recommended.rules,
|
|
48
|
-
// React scope no longer necessary with new JSX transform.
|
|
49
|
-
"react/react-in-jsx-scope": "off",
|
|
17
|
+
...createReactConfig(options),
|
|
18
|
+
{
|
|
19
|
+
plugins: {
|
|
20
|
+
"@next/next": pluginNext,
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
...pluginNext.configs.recommended.rules,
|
|
24
|
+
...pluginNext.configs["core-web-vitals"].rules,
|
|
25
|
+
},
|
|
50
26
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
27
|
+
{
|
|
28
|
+
rules: {
|
|
29
|
+
"react-refresh/only-export-components": [
|
|
30
|
+
"error",
|
|
31
|
+
{
|
|
32
|
+
// App Router convention: page.tsx/layout.tsx/template.tsx
|
|
33
|
+
// legitimately co-export a default component alongside these
|
|
34
|
+
// route-config bindings — not a Fast Refresh hazard, just how
|
|
35
|
+
// the framework wires routes.
|
|
36
|
+
allowExportNames: [
|
|
37
|
+
"metadata",
|
|
38
|
+
"generateMetadata",
|
|
39
|
+
"viewport",
|
|
40
|
+
"generateViewport",
|
|
41
|
+
"generateStaticParams",
|
|
42
|
+
"dynamic",
|
|
43
|
+
"dynamicParams",
|
|
44
|
+
"revalidate",
|
|
45
|
+
"fetchCache",
|
|
46
|
+
"runtime",
|
|
47
|
+
"preferredRegion",
|
|
48
|
+
"maxDuration",
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
76
53
|
},
|
|
77
|
-
|
|
78
|
-
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A custom ESLint configuration for Next.js applications, with the default
|
|
58
|
+
* options. Use `createNextJsConfig(options)` instead to customize it.
|
|
59
|
+
*
|
|
60
|
+
* @type {import("eslint").Linter.Config[]}
|
|
61
|
+
* */
|
|
62
|
+
export const nextJsConfig = createNextJsConfig();
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A custom ESLint configuration for libraries that use React.
|
|
3
3
|
*
|
|
4
|
+
* @param {import("./base.js").BaseConfigOptions} [options]
|
|
5
|
+
* @returns {import("eslint").Linter.Config[]}
|
|
6
|
+
*/
|
|
7
|
+
export function createReactConfig(options?: import("./base.js").BaseConfigOptions): import("eslint").Linter.Config[];
|
|
8
|
+
/**
|
|
9
|
+
* A custom ESLint configuration for libraries that use React, with the
|
|
10
|
+
* default options. Use `createReactConfig(options)` instead to customize it.
|
|
11
|
+
*
|
|
4
12
|
* @type {import("eslint").Linter.Config[]} */
|
|
5
13
|
export const reactConfig: import("eslint").Linter.Config[];
|
|
6
14
|
//# sourceMappingURL=react.d.ts.map
|
package/dist/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.js"],"names":[],"mappings":"AASA
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.js"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,4CAHW,OAAO,WAAW,EAAE,iBAAiB,GACnC,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAuE5C;AAED;;;;8CAI8C;AAC9C,0BADU,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CACK"}
|
package/dist/react.js
CHANGED
|
@@ -4,70 +4,86 @@ import pluginReact from "eslint-plugin-react";
|
|
|
4
4
|
import pluginReactHooks from "eslint-plugin-react-hooks";
|
|
5
5
|
import pluginReactRefresh from "eslint-plugin-react-refresh";
|
|
6
6
|
import globals from "globals";
|
|
7
|
-
import {
|
|
7
|
+
import { createBaseConfig } from "./base.js";
|
|
8
8
|
/**
|
|
9
9
|
* A custom ESLint configuration for libraries that use React.
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
...
|
|
11
|
+
* @param {import("./base.js").BaseConfigOptions} [options]
|
|
12
|
+
* @returns {import("eslint").Linter.Config[]}
|
|
13
|
+
*/
|
|
14
|
+
export function createReactConfig(options) {
|
|
15
|
+
return defineConfig([
|
|
16
|
+
...createBaseConfig(options),
|
|
17
|
+
pluginReact.configs.flat["jsx-runtime"],
|
|
18
|
+
pluginEslintReact.configs["recommended-type-checked"],
|
|
19
|
+
{
|
|
20
|
+
languageOptions: {
|
|
21
|
+
...pluginReact.configs.flat.recommended.languageOptions,
|
|
22
|
+
globals: {
|
|
23
|
+
...globals.serviceworker,
|
|
24
|
+
...globals.browser,
|
|
25
|
+
},
|
|
22
26
|
},
|
|
23
27
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
// in main config for TSX/JSX source files
|
|
38
|
-
plugins: {
|
|
39
|
-
"react-refresh": pluginReactRefresh,
|
|
28
|
+
{
|
|
29
|
+
plugins: {
|
|
30
|
+
"react-hooks": pluginReactHooks,
|
|
31
|
+
},
|
|
32
|
+
settings: { react: { version: "19" } },
|
|
33
|
+
rules: {
|
|
34
|
+
...pluginReactHooks.configs.recommended.rules,
|
|
35
|
+
// React scope no longer necessary with new JSX transform.
|
|
36
|
+
"react/react-in-jsx-scope": "off",
|
|
37
|
+
},
|
|
40
38
|
},
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
{
|
|
40
|
+
// in main config for TSX/JSX source files
|
|
41
|
+
plugins: {
|
|
42
|
+
"react-refresh": pluginReactRefresh,
|
|
43
|
+
},
|
|
44
|
+
rules: {
|
|
45
|
+
"react-refresh/only-export-components": "error",
|
|
46
|
+
},
|
|
43
47
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
48
|
+
{
|
|
49
|
+
// Scoped to TS files only (like base.js's own type-aware rules block):
|
|
50
|
+
// these need type information, which plain .js files (next.config.js,
|
|
51
|
+
// tailwind.config.js...) don't have once base's disableTypeChecked
|
|
52
|
+
// block runs — without this restriction, this block re-enables them
|
|
53
|
+
// and crashes ESLint on those files.
|
|
54
|
+
files: ["**/*.{ts,tsx,mts,cts}"],
|
|
55
|
+
rules: {
|
|
56
|
+
"@typescript-eslint/no-unsafe-call": "warn",
|
|
57
|
+
"@typescript-eslint/restrict-template-expressions": "warn",
|
|
58
|
+
"@typescript-eslint/naming-convention": [
|
|
59
|
+
"error",
|
|
60
|
+
{
|
|
61
|
+
selector: "variable",
|
|
62
|
+
format: ["camelCase"],
|
|
63
|
+
leadingUnderscore: "allow",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
selector: "variable",
|
|
67
|
+
modifiers: ["const"],
|
|
68
|
+
format: ["camelCase", "UPPER_CASE", "PascalCase"],
|
|
69
|
+
leadingUnderscore: "allow",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
selector: "function",
|
|
73
|
+
format: ["camelCase", "PascalCase"],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
selector: "typeLike",
|
|
77
|
+
format: ["PascalCase"],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
71
81
|
},
|
|
72
|
-
|
|
73
|
-
|
|
82
|
+
]);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A custom ESLint configuration for libraries that use React, with the
|
|
86
|
+
* default options. Use `createReactConfig(options)` instead to customize it.
|
|
87
|
+
*
|
|
88
|
+
* @type {import("eslint").Linter.Config[]} */
|
|
89
|
+
export const reactConfig = createReactConfig();
|
package/dist/storybook.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A custom ESLint configuration for libraries that use React.
|
|
2
|
+
* A custom ESLint configuration for libraries that use React and Storybook.
|
|
3
|
+
*
|
|
4
|
+
* @param {import("./base.js").BaseConfigOptions} [options]
|
|
5
|
+
* @returns {import("eslint").Linter.Config[]} */
|
|
6
|
+
export function createStorybookConfig(options?: import("./base.js").BaseConfigOptions): import("eslint").Linter.Config[];
|
|
7
|
+
/**
|
|
8
|
+
* A custom ESLint configuration for libraries that use React and Storybook,
|
|
9
|
+
* with the default options. Use `createStorybookConfig(options)` instead to
|
|
10
|
+
* customize it.
|
|
3
11
|
*
|
|
4
12
|
* @type {import("eslint").Linter.Config[]} */
|
|
5
13
|
export const storybookConfig: import("eslint").Linter.Config[];
|
package/dist/storybook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storybook.d.ts","sourceRoot":"","sources":["../src/storybook.js"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"storybook.d.ts","sourceRoot":"","sources":["../src/storybook.js"],"names":[],"mappings":"AAKA;;;;iDAIiD;AACjD,gDAFW,OAAO,WAAW,EAAE,iBAAiB,GACnC,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAiB5C;AAED;;;;;8CAK8C;AAC9C,8BADU,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CACa"}
|
package/dist/storybook.js
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
import { defineConfig } from "eslint/config";
|
|
2
2
|
import storybook from "eslint-plugin-storybook";
|
|
3
|
-
import {
|
|
3
|
+
import { createReactConfig } from "./react.js";
|
|
4
4
|
/**
|
|
5
|
-
* A custom ESLint configuration for libraries that use React.
|
|
5
|
+
* A custom ESLint configuration for libraries that use React and Storybook.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
* @param {import("./base.js").BaseConfigOptions} [options]
|
|
8
|
+
* @returns {import("eslint").Linter.Config[]} */
|
|
9
|
+
export function createStorybookConfig(options) {
|
|
10
|
+
return defineConfig([
|
|
11
|
+
...createReactConfig(options),
|
|
12
|
+
...storybook.configs["flat/recommended"],
|
|
13
|
+
{
|
|
14
|
+
ignores: ["!.storybook"],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
// Should match the `stories` property in .storybook/main.js|ts.
|
|
18
|
+
files: ["**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)"],
|
|
19
|
+
rules: {
|
|
20
|
+
"storybook/csf-component": "error",
|
|
21
|
+
"storybook/default-exports": "off",
|
|
22
|
+
},
|
|
22
23
|
},
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A custom ESLint configuration for libraries that use React and Storybook,
|
|
28
|
+
* with the default options. Use `createStorybookConfig(options)` instead to
|
|
29
|
+
* customize it.
|
|
30
|
+
*
|
|
31
|
+
* @type {import("eslint").Linter.Config[]} */
|
|
32
|
+
export const storybookConfig = createStorybookConfig();
|
package/package.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@forthtilliath/eslint-config",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "https://github.com/Forthtilliath/forthtilliath-packages.git",
|
|
12
|
-
"directory": "packages/eslint-config"
|
|
13
|
-
},
|
|
14
|
-
"homepage": "https://github.com/Forthtilliath/forthtilliath-packages/tree/main/packages/eslint-config#readme",
|
|
15
|
-
"bugs": "https://github.com/Forthtilliath/forthtilliath-packages/issues",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"eslint
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"eslint
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@forthtilliath/eslint-config",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/Forthtilliath/forthtilliath-packages.git",
|
|
12
|
+
"directory": "packages/eslint-config"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/Forthtilliath/forthtilliath-packages/tree/main/packages/eslint-config#readme",
|
|
15
|
+
"bugs": "https://github.com/Forthtilliath/forthtilliath-packages/issues",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"exports": {
|
|
20
|
+
".": "./dist/base.js",
|
|
21
|
+
"./*": "./dist/*.js"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@eslint-react/eslint-plugin": "^5.18.3",
|
|
25
|
+
"@eslint/js": "^10.0.1",
|
|
26
|
+
"@next/eslint-plugin-next": "^16.3.0",
|
|
27
|
+
"angular-eslint": "^21.4.0",
|
|
28
|
+
"eslint-config-prettier": "^10.1.8",
|
|
29
|
+
"eslint-plugin-react": "^7.37.5",
|
|
30
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
31
|
+
"eslint-plugin-react-refresh": "^0.5.4",
|
|
32
|
+
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
33
|
+
"eslint-plugin-storybook": "^9.1.20",
|
|
34
|
+
"eslint-plugin-turbo": "^2.10.9",
|
|
35
|
+
"globals": "^17.9.0",
|
|
36
|
+
"typescript-eslint": "^8.67.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"eslint": ">=9.0.0",
|
|
40
|
+
"typescript": ">=5.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"eslint": "10.7.0",
|
|
44
|
+
"typescript": "^5.9.3",
|
|
45
|
+
"@forthtilliath/typescript-config": "0.0.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"dev": "tsc --watch",
|
|
49
|
+
"build": "tsc",
|
|
50
|
+
"clean": "rm -rf dist",
|
|
51
|
+
"check-types": "tsc --noEmit",
|
|
52
|
+
"lint": "eslint . --max-warnings 0"
|
|
53
|
+
}
|
|
54
|
+
}
|