@api-extractor-tools/eslint-plugin 0.1.0-alpha.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/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +183 -0
- package/api-extractor.json +10 -0
- package/dist/configs/index.d.ts +6 -0
- package/dist/configs/index.d.ts.map +1 -0
- package/dist/configs/index.js +11 -0
- package/dist/configs/index.js.map +1 -0
- package/dist/configs/recommended.d.ts +31 -0
- package/dist/configs/recommended.d.ts.map +1 -0
- package/dist/configs/recommended.js +45 -0
- package/dist/configs/recommended.js.map +1 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +68 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/index.d.ts +14 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +20 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/missing-release-tag.d.ts +8 -0
- package/dist/rules/missing-release-tag.d.ts.map +1 -0
- package/dist/rules/missing-release-tag.js +148 -0
- package/dist/rules/missing-release-tag.js.map +1 -0
- package/dist/rules/override-keyword.d.ts +8 -0
- package/dist/rules/override-keyword.d.ts.map +1 -0
- package/dist/rules/override-keyword.js +106 -0
- package/dist/rules/override-keyword.js.map +1 -0
- package/dist/rules/package-documentation.d.ts +8 -0
- package/dist/rules/package-documentation.d.ts.map +1 -0
- package/dist/rules/package-documentation.js +70 -0
- package/dist/rules/package-documentation.js.map +1 -0
- package/dist/types.d.ts +90 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +19 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/config-loader.d.ts +47 -0
- package/dist/utils/config-loader.d.ts.map +1 -0
- package/dist/utils/config-loader.js +163 -0
- package/dist/utils/config-loader.js.map +1 -0
- package/dist/utils/entry-point.d.ts +56 -0
- package/dist/utils/entry-point.d.ts.map +1 -0
- package/dist/utils/entry-point.js +198 -0
- package/dist/utils/entry-point.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/tsdoc-parser.d.ts +58 -0
- package/dist/utils/tsdoc-parser.d.ts.map +1 -0
- package/dist/utils/tsdoc-parser.js +137 -0
- package/dist/utils/tsdoc-parser.js.map +1 -0
- package/package.json +44 -0
- package/src/configs/index.ts +6 -0
- package/src/configs/recommended.ts +46 -0
- package/src/index.ts +111 -0
- package/src/rules/index.ts +18 -0
- package/src/rules/missing-release-tag.ts +203 -0
- package/src/rules/override-keyword.ts +139 -0
- package/src/rules/package-documentation.ts +90 -0
- package/src/types.ts +104 -0
- package/src/utils/config-loader.ts +194 -0
- package/src/utils/entry-point.ts +247 -0
- package/src/utils/index.ts +17 -0
- package/src/utils/tsdoc-parser.ts +163 -0
- package/temp/eslint-plugin.api.md +118 -0
- package/test/index.test.ts +66 -0
- package/test/rules/missing-release-tag.test.ts +184 -0
- package/test/rules/override-keyword.test.ts +171 -0
- package/test/rules/package-documentation.test.ts +152 -0
- package/test/tsconfig.json +11 -0
- package/test/utils/config-loader.test.ts +199 -0
- package/test/utils/entry-point.test.ts +172 -0
- package/test/utils/tsdoc-parser.test.ts +113 -0
- package/tsconfig.json +12 -0
- package/vitest.config.mts +25 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @api-extractor-tools/eslint-plugin
|
|
2
|
+
|
|
3
|
+
## 0.1.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#49](https://github.com/mike-north/api-extractor-tools/pull/49) [`f30c449`](https://github.com/mike-north/api-extractor-tools/commit/f30c449e69eb052722b15e38863ef23312523c6b) Thanks [@mike-north](https://github.com/mike-north)! - feat: add ESLint plugin for API Extractor authoring-time feedback
|
|
8
|
+
|
|
9
|
+
New ESLint plugin providing authoring-time feedback aligned with API Extractor validations:
|
|
10
|
+
- `api-extractor/missing-release-tag`: Detects exported symbols missing release tags (@public, @beta, @alpha, @internal)
|
|
11
|
+
- `api-extractor/override-keyword`: Requires TypeScript `override` keyword when @override TSDoc tag is present
|
|
12
|
+
- `api-extractor/package-documentation`: Ensures entry point files have @packageDocumentation comment
|
|
13
|
+
|
|
14
|
+
Features:
|
|
15
|
+
- Auto-discovery of api-extractor.json configuration
|
|
16
|
+
- Severity levels read from API Extractor config
|
|
17
|
+
- Sharable 'recommended' config for both flat and legacy ESLint formats
|
|
18
|
+
- Auto-fix support for override-keyword rule
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mike North
|
|
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
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# @api-extractor-tools/eslint-plugin
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@api-extractor-tools/eslint-plugin)
|
|
4
|
+
|
|
5
|
+
ESLint plugin providing authoring-time feedback for [API Extractor](https://api-extractor.com/). Catch common API Extractor issues during development rather than waiting for the build step.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install --save-dev @api-extractor-tools/eslint-plugin
|
|
11
|
+
# or
|
|
12
|
+
pnpm add -D @api-extractor-tools/eslint-plugin
|
|
13
|
+
# or
|
|
14
|
+
yarn add -D @api-extractor-tools/eslint-plugin
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Flat Config (eslint.config.js) - Recommended
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import apiExtractorPlugin from '@api-extractor-tools/eslint-plugin'
|
|
23
|
+
|
|
24
|
+
export default [
|
|
25
|
+
// Use the recommended configuration
|
|
26
|
+
apiExtractorPlugin.configs.recommended,
|
|
27
|
+
|
|
28
|
+
// Or configure rules individually
|
|
29
|
+
{
|
|
30
|
+
plugins: {
|
|
31
|
+
'@api-extractor-tools': apiExtractorPlugin,
|
|
32
|
+
},
|
|
33
|
+
rules: {
|
|
34
|
+
'@api-extractor-tools/missing-release-tag': 'error',
|
|
35
|
+
'@api-extractor-tools/override-keyword': 'error',
|
|
36
|
+
'@api-extractor-tools/package-documentation': 'warn',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Legacy Config (.eslintrc.js)
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
module.exports = {
|
|
46
|
+
plugins: ['@api-extractor-tools'],
|
|
47
|
+
extends: ['plugin:@api-extractor-tools/recommended-legacy'],
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or configure rules individually:
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
module.exports = {
|
|
55
|
+
plugins: ['@api-extractor-tools'],
|
|
56
|
+
rules: {
|
|
57
|
+
'@api-extractor-tools/missing-release-tag': 'error',
|
|
58
|
+
'@api-extractor-tools/override-keyword': 'error',
|
|
59
|
+
'@api-extractor-tools/package-documentation': 'warn',
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Rules
|
|
65
|
+
|
|
66
|
+
### `@api-extractor-tools/missing-release-tag`
|
|
67
|
+
|
|
68
|
+
Requires exported symbols to have a release tag (`@public`, `@beta`, `@alpha`, or `@internal`).
|
|
69
|
+
|
|
70
|
+
This rule mirrors API Extractor's `ae-missing-release-tag` message. When an `api-extractor.json` is found, the rule severity is automatically determined from the configuration.
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
// ❌ Bad - missing release tag
|
|
74
|
+
export function myFunction() {}
|
|
75
|
+
|
|
76
|
+
// ✅ Good
|
|
77
|
+
/**
|
|
78
|
+
* A public function.
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
export function myFunction() {}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Options
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"@api-extractor-tools/missing-release-tag": [
|
|
89
|
+
"error",
|
|
90
|
+
{
|
|
91
|
+
"configPath": "./api-extractor.json"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- `configPath` (optional): Path to the `api-extractor.json` file. If not provided, the rule will search upward from the linted file.
|
|
98
|
+
|
|
99
|
+
### `@api-extractor-tools/override-keyword`
|
|
100
|
+
|
|
101
|
+
Requires the TypeScript `override` keyword when the `@override` TSDoc tag is present.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
// ❌ Bad - has @override tag but missing override keyword
|
|
105
|
+
class Child extends Parent {
|
|
106
|
+
/**
|
|
107
|
+
* @override
|
|
108
|
+
*/
|
|
109
|
+
doSomething() {}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ✅ Good
|
|
113
|
+
class Child extends Parent {
|
|
114
|
+
/**
|
|
115
|
+
* @override
|
|
116
|
+
*/
|
|
117
|
+
override doSomething() {}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
This rule provides an auto-fix to add the missing `override` keyword.
|
|
122
|
+
|
|
123
|
+
### `@api-extractor-tools/package-documentation`
|
|
124
|
+
|
|
125
|
+
Requires package entry point files to have a `@packageDocumentation` comment.
|
|
126
|
+
|
|
127
|
+
Entry points are determined from `package.json` fields:
|
|
128
|
+
|
|
129
|
+
- `main`
|
|
130
|
+
- `types` / `typings`
|
|
131
|
+
- `exports`
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
// ❌ Bad - entry point without @packageDocumentation
|
|
135
|
+
export function foo() {}
|
|
136
|
+
|
|
137
|
+
// ✅ Good
|
|
138
|
+
/**
|
|
139
|
+
* This package provides utilities for working with APIs.
|
|
140
|
+
*
|
|
141
|
+
* @packageDocumentation
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
export function foo() {}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Configuration Discovery
|
|
148
|
+
|
|
149
|
+
Rules that read from `api-extractor.json` use the following strategy:
|
|
150
|
+
|
|
151
|
+
1. **Explicit option**: Use the `configPath` rule option
|
|
152
|
+
2. **Auto-discovery**: Search upward from the linted file for `api-extractor.json`
|
|
153
|
+
3. **Fallback**: Use sensible defaults (all rules enabled as warnings)
|
|
154
|
+
|
|
155
|
+
## Recommended Configuration
|
|
156
|
+
|
|
157
|
+
The `recommended` configuration enables all rules with these defaults:
|
|
158
|
+
|
|
159
|
+
| Rule | Severity |
|
|
160
|
+
| ----------------------- | -------- |
|
|
161
|
+
| `missing-release-tag` | warn |
|
|
162
|
+
| `override-keyword` | error |
|
|
163
|
+
| `package-documentation` | warn |
|
|
164
|
+
|
|
165
|
+
## Requirements
|
|
166
|
+
|
|
167
|
+
- ESLint >= 8.0.0
|
|
168
|
+
- TypeScript >= 5.5.0
|
|
169
|
+
|
|
170
|
+
## Related
|
|
171
|
+
|
|
172
|
+
- [API Extractor](https://api-extractor.com/)
|
|
173
|
+
- [TSDoc](https://tsdoc.org/)
|
|
174
|
+
- [eslint-plugin-tsdoc](https://www.npmjs.com/package/eslint-plugin-tsdoc) - For TSDoc syntax validation
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
MIT
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "../../api-extractor-base.json",
|
|
4
|
+
|
|
5
|
+
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
|
|
6
|
+
|
|
7
|
+
"compiler": {
|
|
8
|
+
"tsconfigFilePath": "<projectFolder>/tsconfig.json"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/configs/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration exports.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createFlatRecommendedConfig = exports.recommendedRules = void 0;
|
|
8
|
+
var recommended_1 = require("./recommended");
|
|
9
|
+
Object.defineProperty(exports, "recommendedRules", { enumerable: true, get: function () { return recommended_1.recommendedRules; } });
|
|
10
|
+
Object.defineProperty(exports, "createFlatRecommendedConfig", { enumerable: true, get: function () { return recommended_1.createFlatRecommendedConfig; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/configs/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6CAA6E;AAApE,+GAAA,gBAAgB,OAAA;AAAE,0HAAA,2BAA2B,OAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recommended ESLint configuration for API Extractor.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This configuration works with both flat config (eslint.config.js) and
|
|
6
|
+
* legacy config (.eslintrc.js) formats.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
11
|
+
/**
|
|
12
|
+
* Recommended rule configuration.
|
|
13
|
+
* These are the rules enabled by default with appropriate severity.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export declare const recommendedRules: TSESLint.Linter.RulesRecord;
|
|
17
|
+
/**
|
|
18
|
+
* Flat-config recommended configuration.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Use with eslint.config.js:
|
|
22
|
+
* ```js
|
|
23
|
+
* import apiExtractorPlugin from '@api-extractor-tools/eslint-plugin';
|
|
24
|
+
*
|
|
25
|
+
* export default [
|
|
26
|
+
* apiExtractorPlugin.configs.recommended,
|
|
27
|
+
* ];
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function createFlatRecommendedConfig(plugin: Record<string, unknown>): TSESLint.FlatConfig.Config;
|
|
31
|
+
//# sourceMappingURL=recommended.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommended.d.ts","sourceRoot":"","sources":["../../src/configs/recommended.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAExD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,WAI9C,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,QAAQ,CAAC,UAAU,CAAC,MAAM,CAO5B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Recommended ESLint configuration for API Extractor.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This configuration works with both flat config (eslint.config.js) and
|
|
7
|
+
* legacy config (.eslintrc.js) formats.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.recommendedRules = void 0;
|
|
13
|
+
exports.createFlatRecommendedConfig = createFlatRecommendedConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Recommended rule configuration.
|
|
16
|
+
* These are the rules enabled by default with appropriate severity.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
exports.recommendedRules = {
|
|
20
|
+
'@api-extractor-tools/missing-release-tag': 'warn',
|
|
21
|
+
'@api-extractor-tools/override-keyword': 'error',
|
|
22
|
+
'@api-extractor-tools/package-documentation': 'warn',
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Flat-config recommended configuration.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* Use with eslint.config.js:
|
|
29
|
+
* ```js
|
|
30
|
+
* import apiExtractorPlugin from '@api-extractor-tools/eslint-plugin';
|
|
31
|
+
*
|
|
32
|
+
* export default [
|
|
33
|
+
* apiExtractorPlugin.configs.recommended,
|
|
34
|
+
* ];
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
function createFlatRecommendedConfig(plugin) {
|
|
38
|
+
return {
|
|
39
|
+
plugins: {
|
|
40
|
+
'@api-extractor-tools': plugin,
|
|
41
|
+
},
|
|
42
|
+
rules: exports.recommendedRules,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=recommended.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommended.js","sourceRoot":"","sources":["../../src/configs/recommended.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AA4BH,kEASC;AAjCD;;;;GAIG;AACU,QAAA,gBAAgB,GAAgC;IAC3D,0CAA0C,EAAE,MAAM;IAClD,uCAAuC,EAAE,OAAO;IAChD,4CAA4C,EAAE,MAAM;CACrD,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,2BAA2B,CACzC,MAA+B;IAE/B,OAAO;QACL,OAAO,EAAE;YACP,sBAAsB,EAAE,MAAoC;SAC7D;QACD,KAAK,EAAE,wBAAgB;KACxB,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint plugin providing authoring-time feedback for API Extractor.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This plugin provides ESLint rules that mirror API Extractor's validations,
|
|
6
|
+
* enabling developers to catch issues during development rather than at build time.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* Using with flat config (eslint.config.js):
|
|
10
|
+
* ```js
|
|
11
|
+
* import apiExtractorPlugin from '@api-extractor-tools/eslint-plugin';
|
|
12
|
+
*
|
|
13
|
+
* export default [
|
|
14
|
+
* apiExtractorPlugin.configs.recommended,
|
|
15
|
+
* // Or configure rules individually:
|
|
16
|
+
* {
|
|
17
|
+
* plugins: {
|
|
18
|
+
* '@api-extractor-tools': apiExtractorPlugin,
|
|
19
|
+
* },
|
|
20
|
+
* rules: {
|
|
21
|
+
* '@api-extractor-tools/missing-release-tag': 'error',
|
|
22
|
+
* },
|
|
23
|
+
* },
|
|
24
|
+
* ];
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* Using with legacy config (.eslintrc.js):
|
|
29
|
+
* ```js
|
|
30
|
+
* module.exports = {
|
|
31
|
+
* plugins: ['@api-extractor-tools'],
|
|
32
|
+
* extends: ['plugin:@api-extractor-tools/recommended-legacy'],
|
|
33
|
+
* };
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @packageDocumentation
|
|
37
|
+
*/
|
|
38
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
39
|
+
import { rules } from './rules';
|
|
40
|
+
import { recommendedRules } from './configs';
|
|
41
|
+
export type { ApiExtractorConfig, ApiExtractorLogLevel, ApiExtractorMessagesConfig, MessageConfig, ReleaseTag, MissingReleaseTagRuleOptions, OverrideKeywordRuleOptions, PackageDocumentationRuleOptions, ResolvedEntryPoints, } from './types';
|
|
42
|
+
export { RELEASE_TAGS } from './types';
|
|
43
|
+
/**
|
|
44
|
+
* Plugin configuration type.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
interface PluginConfigs {
|
|
48
|
+
recommended: TSESLint.FlatConfig.Config;
|
|
49
|
+
'recommended-legacy': {
|
|
50
|
+
plugins: string[];
|
|
51
|
+
rules: TSESLint.Linter.RulesRecord;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The ESLint plugin type.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export interface ApiExtractorEslintPlugin {
|
|
59
|
+
meta: {
|
|
60
|
+
name: string;
|
|
61
|
+
version: string;
|
|
62
|
+
};
|
|
63
|
+
rules: typeof rules;
|
|
64
|
+
configs: PluginConfigs;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The ESLint plugin object.
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
declare const plugin: ApiExtractorEslintPlugin;
|
|
71
|
+
export default plugin;
|
|
72
|
+
export { rules };
|
|
73
|
+
export { recommendedRules };
|
|
74
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,gBAAgB,EAA+B,MAAM,WAAW,CAAA;AAGzE,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,aAAa,EACb,UAAU,EACV,4BAA4B,EAC5B,0BAA0B,EAC1B,+BAA+B,EAC/B,mBAAmB,GACpB,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC;;;GAGG;AACH,UAAU,aAAa;IACrB,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAA;IACvC,oBAAoB,EAAE;QACpB,OAAO,EAAE,MAAM,EAAE,CAAA;QACjB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAA;KACnC,CAAA;CACF;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,KAAK,EAAE,OAAO,KAAK,CAAA;IACnB,OAAO,EAAE,aAAa,CAAA;CACvB;AAED;;;GAGG;AACH,QAAA,MAAM,MAAM,EAAE,wBAab,CAAA;AAOD,eAAe,MAAM,CAAA;AAGrB,OAAO,EAAE,KAAK,EAAE,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ESLint plugin providing authoring-time feedback for API Extractor.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This plugin provides ESLint rules that mirror API Extractor's validations,
|
|
7
|
+
* enabling developers to catch issues during development rather than at build time.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* Using with flat config (eslint.config.js):
|
|
11
|
+
* ```js
|
|
12
|
+
* import apiExtractorPlugin from '@api-extractor-tools/eslint-plugin';
|
|
13
|
+
*
|
|
14
|
+
* export default [
|
|
15
|
+
* apiExtractorPlugin.configs.recommended,
|
|
16
|
+
* // Or configure rules individually:
|
|
17
|
+
* {
|
|
18
|
+
* plugins: {
|
|
19
|
+
* '@api-extractor-tools': apiExtractorPlugin,
|
|
20
|
+
* },
|
|
21
|
+
* rules: {
|
|
22
|
+
* '@api-extractor-tools/missing-release-tag': 'error',
|
|
23
|
+
* },
|
|
24
|
+
* },
|
|
25
|
+
* ];
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* Using with legacy config (.eslintrc.js):
|
|
30
|
+
* ```js
|
|
31
|
+
* module.exports = {
|
|
32
|
+
* plugins: ['@api-extractor-tools'],
|
|
33
|
+
* extends: ['plugin:@api-extractor-tools/recommended-legacy'],
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @packageDocumentation
|
|
38
|
+
*/
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.recommendedRules = exports.rules = exports.RELEASE_TAGS = void 0;
|
|
41
|
+
const rules_1 = require("./rules");
|
|
42
|
+
Object.defineProperty(exports, "rules", { enumerable: true, get: function () { return rules_1.rules; } });
|
|
43
|
+
const configs_1 = require("./configs");
|
|
44
|
+
Object.defineProperty(exports, "recommendedRules", { enumerable: true, get: function () { return configs_1.recommendedRules; } });
|
|
45
|
+
var types_1 = require("./types");
|
|
46
|
+
Object.defineProperty(exports, "RELEASE_TAGS", { enumerable: true, get: function () { return types_1.RELEASE_TAGS; } });
|
|
47
|
+
/**
|
|
48
|
+
* The ESLint plugin object.
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
const plugin = {
|
|
52
|
+
meta: {
|
|
53
|
+
name: '@api-extractor-tools/eslint-plugin',
|
|
54
|
+
version: '0.0.1',
|
|
55
|
+
},
|
|
56
|
+
rules: rules_1.rules,
|
|
57
|
+
configs: {
|
|
58
|
+
recommended: null,
|
|
59
|
+
'recommended-legacy': {
|
|
60
|
+
plugins: ['@api-extractor-tools'],
|
|
61
|
+
rules: configs_1.recommendedRules,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
// Add flat config after plugin is defined (needed for self-reference)
|
|
66
|
+
plugin.configs.recommended = (0, configs_1.createFlatRecommendedConfig)(plugin);
|
|
67
|
+
exports.default = plugin;
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;;;AAGH,mCAA+B;AAsEtB,sFAtEA,aAAK,OAsEA;AArEd,uCAAyE;AAsEhE,iGAtEA,0BAAgB,OAsEA;AAvDzB,iCAAsC;AAA7B,qGAAA,YAAY,OAAA;AA2BrB;;;GAGG;AACH,MAAM,MAAM,GAA6B;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,oCAAoC;QAC1C,OAAO,EAAE,OAAO;KACjB;IACD,KAAK,EAAL,aAAK;IACL,OAAO,EAAE;QACP,WAAW,EAAE,IAA6C;QAC1D,oBAAoB,EAAE;YACpB,OAAO,EAAE,CAAC,sBAAsB,CAAC;YACjC,KAAK,EAAE,0BAAgB;SACxB;KACF;CACF,CAAA;AAED,sEAAsE;AACtE,MAAM,CAAC,OAAO,CAAC,WAAW,GAAG,IAAA,qCAA2B,EACtD,MAA4C,CAC7C,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint rules for API Extractor.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* All available ESLint rules.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare const rules: {
|
|
10
|
+
readonly 'missing-release-tag': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"missingReleaseTag", [import("..").MissingReleaseTagRuleOptions], unknown, import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
11
|
+
readonly 'override-keyword': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"missingOverrideKeyword", [import("..").OverrideKeywordRuleOptions], unknown, import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
12
|
+
readonly 'package-documentation': import("@typescript-eslint/utils/dist/ts-eslint").RuleModule<"missingPackageDocumentation", [import("..").PackageDocumentationRuleOptions], unknown, import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;CAIR,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ESLint rules for API Extractor.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.rules = void 0;
|
|
8
|
+
const missing_release_tag_1 = require("./missing-release-tag");
|
|
9
|
+
const override_keyword_1 = require("./override-keyword");
|
|
10
|
+
const package_documentation_1 = require("./package-documentation");
|
|
11
|
+
/**
|
|
12
|
+
* All available ESLint rules.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
exports.rules = {
|
|
16
|
+
'missing-release-tag': missing_release_tag_1.missingReleaseTag,
|
|
17
|
+
'override-keyword': override_keyword_1.overrideKeyword,
|
|
18
|
+
'package-documentation': package_documentation_1.packageDocumentation,
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyD;AACzD,yDAAoD;AACpD,mEAA8D;AAE9D;;;GAGG;AACU,QAAA,KAAK,GAAG;IACnB,qBAAqB,EAAE,uCAAiB;IACxC,kBAAkB,EAAE,kCAAe;IACnC,uBAAuB,EAAE,4CAAoB;CACrC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint rule for detecting missing release tags on exported symbols.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
6
|
+
import type { MissingReleaseTagRuleOptions } from '../types';
|
|
7
|
+
export declare const missingReleaseTag: ESLintUtils.RuleModule<"missingReleaseTag", [MissingReleaseTagRuleOptions], unknown, ESLintUtils.RuleListener>;
|
|
8
|
+
//# sourceMappingURL=missing-release-tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missing-release-tag.d.ts","sourceRoot":"","sources":["../../src/rules/missing-release-tag.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAkB,WAAW,EAAY,MAAM,0BAA0B,CAAA;AAQhF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAS5D,eAAO,MAAM,iBAAiB,gHAoL5B,CAAA"}
|