@cratis/eslint-config 7.18.2 → 7.18.4
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 +29 -1
- package/base.js +4 -2
- package/lib/coreRules.js +4 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -17,7 +17,25 @@ The license header is a Cratis *authoring* concern, so it lives only in `interna
|
|
|
17
17
|
yarn add -D @cratis/eslint-config eslint
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
`eslint`
|
|
20
|
+
`eslint` and the TypeScript programmatic API are peer dependencies. The parser, TypeScript rules, and other plugins used by these presets ship transitively.
|
|
21
|
+
|
|
22
|
+
### TypeScript 7
|
|
23
|
+
|
|
24
|
+
TypeScript 7.0 supplies the native `tsc` compiler but not the JavaScript compiler API required by typescript-eslint. Use [TypeScript's supported side-by-side setup](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/#running-side-by-side-with-typescript-6.0):
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm install -D @cratis/eslint-config eslint@latest \
|
|
28
|
+
'@typescript/native@npm:typescript@latest' \
|
|
29
|
+
'typescript@npm:@typescript/typescript6@latest'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The build still runs TypeScript 7's `tsc`; the separate compatibility package supplies the API used by lint tools and names its older compiler executable `tsc6`.
|
|
33
|
+
|
|
34
|
+
### React rules
|
|
35
|
+
|
|
36
|
+
JSX syntax and references are handled by the TypeScript parser and rules. These presets do not enable any `react/*` rules, and no longer install or register `eslint-plugin-react` implicitly. This avoids its incompatible ESLint 10 peer dependency.
|
|
37
|
+
|
|
38
|
+
If a custom configuration enables additional React-specific rules, register a compatible plugin explicitly in that configuration. The legacy `react/display-name` and `react/react-in-jsx-scope` entries remain disabled, and `settings.react.version` remains `detect`, so consumers that supply their own React plugin keep those defaults.
|
|
21
39
|
|
|
22
40
|
## Use — a project built on Cratis
|
|
23
41
|
|
|
@@ -58,3 +76,13 @@ export default cratis.configs.internal;
|
|
|
58
76
|
## Building blocks
|
|
59
77
|
|
|
60
78
|
`configs.base` (hygiene + ignores) and `configs.specs` (`for_*` relaxations) are exported too, so you can compose your own preset. Named exports `base`, `specs`, `consumer`, `internal`, and `ignores` are also available.
|
|
79
|
+
|
|
80
|
+
## Verify the published peer graph
|
|
81
|
+
|
|
82
|
+
From the repository root, run:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
node Source/ESLintConfig/scripts/verify-peer-graph.mjs
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The check packs this workspace and installs the tarball into an isolated consumer under `.ai-work/`, using the latest ESLint and TypeScript/compiler-API packages. It requires strict peer resolution and a clean complete dependency tree, then verifies the packed presets against JSX and representative consumer/internal rules. CI runs this in addition to the preset specs; workspace hoisting must not hide a broken published dependency graph.
|
package/base.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
1
4
|
import tseslintPlugin from '@typescript-eslint/eslint-plugin';
|
|
2
5
|
import tsParser from '@typescript-eslint/parser';
|
|
3
6
|
import noNull from 'eslint-plugin-no-null';
|
|
4
|
-
import react from 'eslint-plugin-react';
|
|
5
7
|
import globals from 'globals';
|
|
6
8
|
import { coreRules } from './lib/coreRules.js';
|
|
7
9
|
|
|
@@ -31,7 +33,6 @@ const base = [
|
|
|
31
33
|
files: ['**/*.ts', '**/*.tsx'],
|
|
32
34
|
plugins: {
|
|
33
35
|
'@typescript-eslint': tseslintPlugin,
|
|
34
|
-
react,
|
|
35
36
|
'no-null': noNull,
|
|
36
37
|
},
|
|
37
38
|
languageOptions: {
|
|
@@ -39,6 +40,7 @@ const base = [
|
|
|
39
40
|
parser: tsParser,
|
|
40
41
|
sourceType: 'module',
|
|
41
42
|
},
|
|
43
|
+
// Preserve version detection for consumers that explicitly provide a React plugin.
|
|
42
44
|
settings: {
|
|
43
45
|
react: { version: 'detect' },
|
|
44
46
|
},
|
package/lib/coreRules.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
1
4
|
import eslintJs from '@eslint/js';
|
|
2
5
|
import tseslint from 'typescript-eslint';
|
|
3
6
|
|
|
@@ -19,6 +22,7 @@ export const coreRules = {
|
|
|
19
22
|
|
|
20
23
|
'no-irregular-whitespace': 0,
|
|
21
24
|
semi: [2, 'always'],
|
|
25
|
+
// Keep these disabled for consumers that register their own React plugin; no React plugin is required here.
|
|
22
26
|
'react/display-name': 0,
|
|
23
27
|
'react/react-in-jsx-scope': 0,
|
|
24
28
|
'no-prototype-builtins': 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cratis/eslint-config",
|
|
3
|
-
"version": "7.18.
|
|
3
|
+
"version": "7.18.4",
|
|
4
4
|
"description": "Shared Cratis ESLint flat-config presets. `consumer` is for projects that build on Cratis; `internal` adds the Cratis-authoring rules (MIT license header) used inside the Cratis product repos.",
|
|
5
5
|
"author": "Cratis",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,12 +41,15 @@
|
|
|
41
41
|
"@typescript-eslint/eslint-plugin": "^8.67.0",
|
|
42
42
|
"@typescript-eslint/parser": "^8.67.0",
|
|
43
43
|
"eslint-plugin-no-null": "^1.0.2",
|
|
44
|
-
"eslint-plugin-react": "^7.37.5",
|
|
45
44
|
"globals": "^17.11.0",
|
|
46
45
|
"typescript-eslint": "^8.67.0"
|
|
47
46
|
},
|
|
48
47
|
"peerDependencies": {
|
|
49
48
|
"eslint": ">=9",
|
|
50
49
|
"typescript": ">=4.8.4"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"eslint": "^10.10.0",
|
|
53
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2"
|
|
51
54
|
}
|
|
52
55
|
}
|