@stride.it/appoint-lint-governance 0.1.24 → 0.1.25
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 +110 -39
- package/package.json +7 -9
package/README.md
CHANGED
|
@@ -1,91 +1,162 @@
|
|
|
1
|
-
# @stride
|
|
1
|
+
# @stride.it/appoint-lint-governance
|
|
2
2
|
|
|
3
|
-
Shareable ESLint
|
|
3
|
+
Shareable ESLint v9 flat-config builders to normalize TypeScript linting across repositories.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This package focuses on framework-agnostic TypeScript quality gates (correctness, imports hygiene, security, maintainability, and optional type-aware checks). It is designed to be composed in consumer repos, not to enforce an all-or-nothing mega-config.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## What you get
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
-
|
|
9
|
+
- Composable flat-config builders (arrays of ESLint config objects).
|
|
10
|
+
- A minimal baseline for fast adoption.
|
|
11
|
+
- A recommended preset that composes the major rule groups.
|
|
12
|
+
- Optional type-aware rules (requires a TSConfig project).
|
|
13
|
+
- Optional Prettier interop preset to disable formatting-rule conflicts.
|
|
14
|
+
|
|
15
|
+
Non-goals:
|
|
16
|
+
|
|
17
|
+
- No framework/domain targeting (React/Next/Vue/a11y/test-runner plugins are out of scope).
|
|
18
|
+
- No formatting (Prettier remains the formatter; ESLint formatting conflicts are disabled via the interop preset).
|
|
18
19
|
|
|
19
20
|
## Install
|
|
20
21
|
|
|
21
22
|
In a consumer repo:
|
|
22
23
|
|
|
23
24
|
```bash
|
|
24
|
-
pnpm add -D @stride
|
|
25
|
+
pnpm add -D @stride.it/appoint-lint-governance eslint
|
|
25
26
|
```
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
ESLint is a peer dependency; your repo owns the ESLint version.
|
|
29
|
+
|
|
30
|
+
## Quick start (ESLint v9 flat config)
|
|
28
31
|
|
|
29
32
|
Create (or edit) `eslint.config.mjs`:
|
|
30
33
|
|
|
31
34
|
```js
|
|
32
35
|
import { typescriptMinimal } from "@stride.it/appoint-lint-governance";
|
|
33
36
|
|
|
34
|
-
export default [
|
|
35
|
-
...typescriptMinimal(),
|
|
36
|
-
];
|
|
37
|
+
export default [...typescriptMinimal()];
|
|
37
38
|
```
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
Run ESLint in your repo as usual:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pnpm lint
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Public API
|
|
47
|
+
|
|
48
|
+
These builders return arrays you spread into your `eslint.config.*`:
|
|
49
|
+
|
|
50
|
+
- `typescriptBase(options?)`\
|
|
51
|
+
Baseline correctness + safe defaults (files globs, languageOptions).
|
|
52
|
+
- `typescriptMinimal(options?)`\
|
|
53
|
+
Minimal preset (fast adoption baseline).
|
|
54
|
+
- `typescriptRecommended(options?)`\
|
|
55
|
+
Recommended preset that composes core groups and can optionally enable type-aware rules.
|
|
56
|
+
- `typescriptPrettierInterop(options?)`\
|
|
57
|
+
Disables formatting-rule conflicts when the consumer repo uses Prettier.
|
|
40
58
|
|
|
41
|
-
|
|
59
|
+
Additionally:
|
|
60
|
+
|
|
61
|
+
- `plugin`\
|
|
62
|
+
Optional plugin export used by internal configs.
|
|
63
|
+
|
|
64
|
+
## Recommended preset (most repos)
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import { typescriptRecommended } from "@stride.it/appoint-lint-governance";
|
|
68
|
+
|
|
69
|
+
export default [...typescriptRecommended()];
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Type-aware linting (optional)
|
|
73
|
+
|
|
74
|
+
Type-aware rules can catch issues ESLint cannot detect from syntax alone (for example: misused promises, unsafe operations). They require a TSConfig project.
|
|
42
75
|
|
|
43
76
|
```js
|
|
44
77
|
import { typescriptRecommended } from "@stride.it/appoint-lint-governance";
|
|
45
78
|
|
|
46
79
|
export default [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
80
|
+
...typescriptRecommended({
|
|
81
|
+
typeChecked: true,
|
|
82
|
+
tsconfigPath: "./tsconfig.json",
|
|
83
|
+
tsconfigRootDir: import.meta.dirname,
|
|
84
|
+
}),
|
|
52
85
|
];
|
|
53
86
|
```
|
|
54
87
|
|
|
55
|
-
|
|
88
|
+
If your Node.js version does not support `import.meta.dirname`, use this portable alternative:
|
|
56
89
|
|
|
57
|
-
|
|
90
|
+
```js
|
|
91
|
+
import { fileURLToPath } from "node:url";
|
|
92
|
+
|
|
93
|
+
const tsconfigRootDir = fileURLToPath(new URL(".", import.meta.url));
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Then pass `tsconfigRootDir` into `typescriptRecommended({ ... })`.
|
|
97
|
+
|
|
98
|
+
## Prettier interop (optional)
|
|
99
|
+
|
|
100
|
+
If your project uses Prettier, include the interop preset last so it can override earlier formatting rules:
|
|
58
101
|
|
|
59
102
|
```js
|
|
60
|
-
import {
|
|
103
|
+
import {
|
|
104
|
+
typescriptPrettierInterop,
|
|
105
|
+
typescriptRecommended,
|
|
106
|
+
} from "@stride.it/appoint-lint-governance";
|
|
61
107
|
|
|
62
108
|
export default [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
...typescriptPrettierInterop(), // Must be last
|
|
109
|
+
...typescriptRecommended(),
|
|
110
|
+
...typescriptPrettierInterop(),
|
|
66
111
|
];
|
|
67
112
|
```
|
|
68
113
|
|
|
69
|
-
##
|
|
114
|
+
## Overriding rules in consumer repos
|
|
115
|
+
|
|
116
|
+
Flat config is order-dependent: later entries win. Consumers can override by appending their own config object after spreading a preset.
|
|
117
|
+
|
|
118
|
+
If your organization wants to prevent overrides, ESLint itself cannot lock consumer rules; enforce that with CI/policy checks on the consumer repo’s `eslint.config.*`.
|
|
119
|
+
|
|
120
|
+
## Suggested companion quality gates (outside ESLint)
|
|
121
|
+
|
|
122
|
+
This package intentionally focuses on ESLint rules. Many teams also enforce these CI gates:
|
|
123
|
+
|
|
124
|
+
- Type checking: `tsc --noEmit`
|
|
125
|
+
- Dependency audit: `pnpm audit` (or your org-approved alternative)
|
|
126
|
+
- Secret scanning and SAST (org-dependent)
|
|
70
127
|
|
|
71
|
-
|
|
128
|
+
## Development (this repo)
|
|
72
129
|
|
|
73
130
|
```bash
|
|
74
131
|
pnpm install
|
|
132
|
+
pnpm test
|
|
75
133
|
pnpm build
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
To validate the publish output locally:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
76
139
|
npm pack
|
|
77
140
|
```
|
|
78
141
|
|
|
79
|
-
Then
|
|
142
|
+
Then install the generated `.tgz` into a consumer repo.
|
|
143
|
+
|
|
144
|
+
## Publishing
|
|
145
|
+
|
|
146
|
+
1) Bump version:
|
|
80
147
|
|
|
81
148
|
```bash
|
|
82
|
-
pnpm
|
|
149
|
+
pnpm version patch
|
|
83
150
|
```
|
|
84
151
|
|
|
85
|
-
|
|
152
|
+
1) Dry run:
|
|
86
153
|
|
|
87
|
-
|
|
154
|
+
```bash
|
|
155
|
+
pnpm publish --dry-run
|
|
156
|
+
```
|
|
88
157
|
|
|
89
|
-
|
|
158
|
+
1) Publish (requires npm credentials with access to the `@stride.it` scope):
|
|
90
159
|
|
|
91
|
-
|
|
160
|
+
```bash
|
|
161
|
+
pnpm publish --access public
|
|
162
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stride.it/appoint-lint-governance",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
4
4
|
"description": "Shareable ESLint flat-config profiles (MVP: TypeScript) for normalizing lint across repos.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"packageManager": "pnpm@9.0.0",
|
|
15
14
|
"files": [
|
|
16
15
|
"dist",
|
|
17
16
|
"README.md"
|
|
@@ -19,13 +18,6 @@
|
|
|
19
18
|
"publishConfig": {
|
|
20
19
|
"access": "public"
|
|
21
20
|
},
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "tsup",
|
|
24
|
-
"lint": "eslint . --fix",
|
|
25
|
-
"lint:fix": "eslint . --fix",
|
|
26
|
-
"prepack": "pnpm build",
|
|
27
|
-
"test": "vitest run --passWithNoTests"
|
|
28
|
-
},
|
|
29
21
|
"dependencies": {
|
|
30
22
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
|
|
31
23
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -51,5 +43,11 @@
|
|
|
51
43
|
"tsup": "^8.5.0",
|
|
52
44
|
"typescript": "^5.9.3",
|
|
53
45
|
"vitest": "^4.0.17"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsup",
|
|
49
|
+
"lint": "eslint . --fix",
|
|
50
|
+
"lint:fix": "eslint . --fix",
|
|
51
|
+
"test": "vitest run --passWithNoTests"
|
|
54
52
|
}
|
|
55
53
|
}
|