@interlace/eslint-devkit 1.4.4 → 1.6.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/package.json +22 -12
- package/src/aria-definitions.js +0 -14
- package/src/ast/ast-utils.js +0 -72
- package/src/ast/index.js +0 -6
- package/src/ast-node-types.d.ts +29 -0
- package/src/ast-node-types.js +174 -0
- package/src/index.d.ts +11 -2
- package/src/index.js +5 -38
- package/src/messaging/config.js +0 -88
- package/src/messaging/constants.js +20 -142
- package/src/messaging/formatters-ai.js +0 -89
- package/src/messaging/formatters-v2.js +0 -151
- package/src/messaging/formatters.js +2 -145
- package/src/messaging/index.js +0 -6
- package/src/messaging/types-v2.js +0 -5
- package/src/messaging/types.js +0 -5
- package/src/node/fs.js +0 -61
- package/src/node/index.js +0 -6
- package/src/node/os.js +0 -33
- package/src/node/path.js +0 -126
- package/src/resolver/dependency-analysis.js +64 -562
- package/src/resolver/index.js +0 -6
- package/src/resolver/resolver-adapter.js +0 -39
- package/src/resolver/resolver-detection.js +0 -48
- package/src/resolver/resolver.d.ts +11 -0
- package/src/resolver/resolver.js +49 -112
- package/src/resolver.js +0 -5
- package/src/rule-creation/index.d.ts +1 -0
- package/src/rule-creation/index.js +1 -6
- package/src/rule-creation/mock-context.d.ts +5 -0
- package/src/rule-creation/mock-context.js +1 -9
- package/src/rule-creation/rule-creator.d.ts +59 -10
- package/src/rule-creation/rule-creator.js +64 -40
- package/src/rule-creation/sql-injection-rule.d.ts +68 -0
- package/src/rule-creation/sql-injection-rule.js +116 -0
- package/src/security/index.js +0 -6
- package/src/security/security-utils.js +9 -287
- package/src/types/index.js +0 -9
- package/src/types/meta-augmentation.js +0 -5
- package/src/types/type-utils.d.ts +1 -1
- package/src/types/type-utils.js +34 -145
- package/AGENTS.md +0 -151
- package/CHANGELOG.md +0 -153
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interlace/eslint-devkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Toolkit for building ESLint plugins in TypeScript — AST helpers, type utilities, rule-creation scaffolding, security benchmarks, and SARIF output.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"homepage": "https://github.com/ofri-peretz/eslint/tree/main/packages/eslint-devkit#readme",
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "https://github.com/ofri-peretz/eslint",
|
|
26
|
+
"url": "git+https://github.com/ofri-peretz/eslint.git",
|
|
27
27
|
"directory": "packages/eslint-devkit"
|
|
28
28
|
},
|
|
29
29
|
"bugs": {
|
|
@@ -34,11 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"src/",
|
|
37
|
-
"dist/",
|
|
38
37
|
"README.md",
|
|
39
|
-
"LICENSE"
|
|
40
|
-
"CHANGELOG.md",
|
|
41
|
-
"AGENTS.md"
|
|
38
|
+
"LICENSE"
|
|
42
39
|
],
|
|
43
40
|
"keywords": [
|
|
44
41
|
"eslint",
|
|
@@ -74,20 +71,33 @@
|
|
|
74
71
|
"typecheck": "tsc -p tsconfig.lib.json --noEmit"
|
|
75
72
|
},
|
|
76
73
|
"peerDependencies": {
|
|
74
|
+
"@typescript-eslint/utils": "^7.0.0 || ^8.0.0",
|
|
77
75
|
"eslint": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
78
|
-
"
|
|
76
|
+
"oxc-resolver": "^11.24.2",
|
|
77
|
+
"tslib": "^2.3.0",
|
|
78
|
+
"typescript": ">=4.8.4"
|
|
79
79
|
},
|
|
80
80
|
"peerDependenciesMeta": {
|
|
81
|
+
"@typescript-eslint/utils": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"oxc-resolver": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
81
87
|
"typescript": {
|
|
82
88
|
"optional": true
|
|
83
89
|
}
|
|
84
90
|
},
|
|
85
|
-
"dependencies": {
|
|
86
|
-
"@typescript-eslint/utils": "^7.0.0 || ^8.0.0",
|
|
87
|
-
"oxc-resolver": "^11.24.2"
|
|
88
|
-
},
|
|
89
91
|
"devDependencies": {
|
|
90
92
|
"@typescript-eslint/parser": "^8.46.2",
|
|
91
|
-
"gpt-tokenizer": "^3.4.0"
|
|
93
|
+
"gpt-tokenizer": "^3.4.0",
|
|
94
|
+
"@typescript-eslint/types": "^8.46.2",
|
|
95
|
+
"@typescript-eslint/utils": "^8.46.2",
|
|
96
|
+
"oxc-resolver": "^11.24.2",
|
|
97
|
+
"typescript": "^5.0.0 || ^6.0.0"
|
|
98
|
+
},
|
|
99
|
+
"funding": {
|
|
100
|
+
"type": "github",
|
|
101
|
+
"url": "https://github.com/ofri-peretz/eslint"
|
|
92
102
|
}
|
|
93
103
|
}
|
package/src/aria-definitions.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.ROLE_SUPPORTED_ARIA_PROPS = exports.GLOBAL_ARIA_PROPS = exports.ARIA_UNSUPPORTED_ELEMENTS = exports.ARIA_REQUIRED_PROPS = exports.ARIA_ATTRIBUTES = exports.ARIA_ROLES = void 0;
|
|
9
|
-
/**
|
|
10
|
-
* ARIA Definitions
|
|
11
|
-
* Lists of valid ARIA roles and attributes
|
|
12
|
-
*/
|
|
13
4
|
exports.ARIA_ROLES = new Set([
|
|
14
5
|
'alert',
|
|
15
6
|
'alertdialog',
|
|
@@ -177,10 +168,6 @@ exports.ARIA_UNSUPPORTED_ELEMENTS = new Set([
|
|
|
177
168
|
'title',
|
|
178
169
|
'track',
|
|
179
170
|
]);
|
|
180
|
-
/**
|
|
181
|
-
* Global ARIA properties valid on every element regardless of role.
|
|
182
|
-
* Per WAI-ARIA 1.2 § 6.2 "Global States and Properties".
|
|
183
|
-
*/
|
|
184
171
|
exports.GLOBAL_ARIA_PROPS = new Set([
|
|
185
172
|
'aria-atomic',
|
|
186
173
|
'aria-busy',
|
|
@@ -204,7 +191,6 @@ exports.GLOBAL_ARIA_PROPS = new Set([
|
|
|
204
191
|
'aria-relevant',
|
|
205
192
|
'aria-roledescription',
|
|
206
193
|
]);
|
|
207
|
-
// Mapping of roles to supported ARIA properties
|
|
208
194
|
exports.ROLE_SUPPORTED_ARIA_PROPS = {
|
|
209
195
|
alert: new Set([
|
|
210
196
|
'aria-expanded',
|
package/src/ast/ast-utils.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.isNodeOfType = isNodeOfType;
|
|
9
4
|
exports.isFunctionNode = isFunctionNode;
|
|
@@ -18,15 +13,9 @@ exports.isLiteral = isLiteral;
|
|
|
18
13
|
exports.isTemplateLiteral = isTemplateLiteral;
|
|
19
14
|
exports.getStaticValue = getStaticValue;
|
|
20
15
|
exports.extractFunctionSignature = extractFunctionSignature;
|
|
21
|
-
/**
|
|
22
|
-
* Check if a node is a specific type of node
|
|
23
|
-
*/
|
|
24
16
|
function isNodeOfType(node, type) {
|
|
25
17
|
return node?.type === type;
|
|
26
18
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Check if a node is a function-like node
|
|
29
|
-
*/
|
|
30
19
|
function isFunctionNode(node) {
|
|
31
20
|
if (!node)
|
|
32
21
|
return false;
|
|
@@ -34,48 +23,25 @@ function isFunctionNode(node) {
|
|
|
34
23
|
node.type === 'FunctionExpression' ||
|
|
35
24
|
node.type === 'ArrowFunctionExpression');
|
|
36
25
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Check if a node is a class-like node
|
|
39
|
-
*/
|
|
40
26
|
function isClassNode(node) {
|
|
41
27
|
if (!node)
|
|
42
28
|
return false;
|
|
43
29
|
return node.type === 'ClassDeclaration' || node.type === 'ClassExpression';
|
|
44
30
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Check if a node is a member expression accessing a specific property
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
|
-
* // Matches: console.log
|
|
51
|
-
* isMemberExpression(node, 'console', 'log')
|
|
52
|
-
*
|
|
53
|
-
* // Matches: foo.bar.baz
|
|
54
|
-
* isMemberExpression(node, ['foo', 'bar'], 'baz')
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
31
|
function isMemberExpression(node, objectName, propertyName) {
|
|
58
32
|
if (!node || node.type !== 'MemberExpression') {
|
|
59
33
|
return false;
|
|
60
34
|
}
|
|
61
35
|
const names = Array.isArray(objectName) ? objectName : [objectName];
|
|
62
|
-
// For nested paths like ['foo', 'bar'], we need to check that
|
|
63
|
-
// node.object matches the path foo.bar
|
|
64
|
-
// For 'foo.bar.baz', node.object should be the MemberExpression for 'foo.bar'
|
|
65
36
|
if (names.length > 1) {
|
|
66
|
-
// Build the expected chain by traversing backwards
|
|
67
|
-
// For ['foo', 'bar'], we expect: Identifier('foo').Identifier('bar')
|
|
68
37
|
let current = node.object;
|
|
69
|
-
// Check from the last name to the first
|
|
70
38
|
for (let i = names.length - 1; i >= 0; i--) {
|
|
71
39
|
if (i === 0) {
|
|
72
|
-
// First name should be an Identifier
|
|
73
40
|
if (current.type !== 'Identifier' || current.name !== names[0]) {
|
|
74
41
|
return false;
|
|
75
42
|
}
|
|
76
43
|
}
|
|
77
44
|
else {
|
|
78
|
-
// Other names should be properties of MemberExpressions
|
|
79
45
|
if (current.type !== 'MemberExpression') {
|
|
80
46
|
return false;
|
|
81
47
|
}
|
|
@@ -88,12 +54,10 @@ function isMemberExpression(node, objectName, propertyName) {
|
|
|
88
54
|
}
|
|
89
55
|
}
|
|
90
56
|
else {
|
|
91
|
-
// Simple case: single object name
|
|
92
57
|
if (node.object.type !== 'Identifier' || node.object.name !== names[0]) {
|
|
93
58
|
return false;
|
|
94
59
|
}
|
|
95
60
|
}
|
|
96
|
-
// Check property if specified
|
|
97
61
|
if (propertyName !== undefined) {
|
|
98
62
|
if (node.property.type !== 'Identifier' ||
|
|
99
63
|
node.property.name !== propertyName) {
|
|
@@ -102,27 +66,12 @@ function isMemberExpression(node, objectName, propertyName) {
|
|
|
102
66
|
}
|
|
103
67
|
return true;
|
|
104
68
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Get the identifier name from a node if it's an identifier
|
|
107
|
-
*/
|
|
108
69
|
function getIdentifierName(node) {
|
|
109
70
|
if (!node || node.type !== 'Identifier') {
|
|
110
71
|
return null;
|
|
111
72
|
}
|
|
112
73
|
return node.name;
|
|
113
74
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Check if a node is a call expression to a specific function
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```typescript
|
|
119
|
-
* // Matches: console.log()
|
|
120
|
-
* isCallExpression(node, 'console', 'log')
|
|
121
|
-
*
|
|
122
|
-
* // Matches: myFunction()
|
|
123
|
-
* isCallExpression(node, 'myFunction')
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
75
|
function isCallExpression(node, objectName, methodName) {
|
|
127
76
|
if (!node || node.type !== 'CallExpression') {
|
|
128
77
|
return false;
|
|
@@ -135,21 +84,12 @@ function isCallExpression(node, objectName, methodName) {
|
|
|
135
84
|
}
|
|
136
85
|
return getIdentifierName(node.callee) === objectName;
|
|
137
86
|
}
|
|
138
|
-
/**
|
|
139
|
-
* Get the name of a function node
|
|
140
|
-
*/
|
|
141
87
|
function getFunctionName(node) {
|
|
142
88
|
return node.id?.name ?? null;
|
|
143
89
|
}
|
|
144
|
-
/**
|
|
145
|
-
* Check if a node is inside a specific type of parent node
|
|
146
|
-
*/
|
|
147
90
|
function isInsideNode(node, parentType, ancestors) {
|
|
148
91
|
return ancestors.some((ancestor) => ancestor.type === parentType);
|
|
149
92
|
}
|
|
150
|
-
/**
|
|
151
|
-
* Get the first ancestor of a specific type
|
|
152
|
-
*/
|
|
153
93
|
function getAncestorOfType(type, ancestors) {
|
|
154
94
|
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
155
95
|
const ancestor = ancestors[i];
|
|
@@ -159,21 +99,12 @@ function getAncestorOfType(type, ancestors) {
|
|
|
159
99
|
}
|
|
160
100
|
return null;
|
|
161
101
|
}
|
|
162
|
-
/**
|
|
163
|
-
* Check if a node is a literal value
|
|
164
|
-
*/
|
|
165
102
|
function isLiteral(node) {
|
|
166
103
|
return node?.type === 'Literal';
|
|
167
104
|
}
|
|
168
|
-
/**
|
|
169
|
-
* Check if a node is a template literal
|
|
170
|
-
*/
|
|
171
105
|
function isTemplateLiteral(node) {
|
|
172
106
|
return node?.type === 'TemplateLiteral';
|
|
173
107
|
}
|
|
174
|
-
/**
|
|
175
|
-
* Get the static value of a node if it's a literal
|
|
176
|
-
*/
|
|
177
108
|
function getStaticValue(node) {
|
|
178
109
|
if (!node) {
|
|
179
110
|
return undefined;
|
|
@@ -186,9 +117,6 @@ function getStaticValue(node) {
|
|
|
186
117
|
}
|
|
187
118
|
return undefined;
|
|
188
119
|
}
|
|
189
|
-
/**
|
|
190
|
-
* Extract function signature for documentation
|
|
191
|
-
*/
|
|
192
120
|
function extractFunctionSignature(node) {
|
|
193
121
|
const params = node.params
|
|
194
122
|
.map((param) => {
|
package/src/ast/index.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
const tslib_1 = require("tslib");
|
|
9
|
-
// AST utilities for ESLint rule development
|
|
10
4
|
tslib_1.__exportStar(require("../ast/ast-utils"), exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
+
* MIT license that can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* `AST_NODE_TYPES`, inlined.
|
|
8
|
+
*
|
|
9
|
+
* ponytail: this table was the last runtime dependency in the package. It came
|
|
10
|
+
* from `@typescript-eslint/types` — 144 KB for what is, at runtime, 168
|
|
11
|
+
* self-mapped strings (`{ Identifier: 'Identifier', ... }`) totalling a few KB.
|
|
12
|
+
* Inlining it takes `@interlace/eslint-devkit` to ZERO runtime dependencies,
|
|
13
|
+
* which is the property that actually matters for a package sitting underneath
|
|
14
|
+
* every plugin in the ecosystem.
|
|
15
|
+
*
|
|
16
|
+
* The cast is load-bearing and deliberate. Upstream declares `AST_NODE_TYPES`
|
|
17
|
+
* as a string `enum`, and TypeScript does NOT accept a string literal where an
|
|
18
|
+
* enum member is expected — `const t: AST_NODE_TYPES.Identifier = 'Identifier'`
|
|
19
|
+
* is an error. A plain `as const` object would therefore break every consumer
|
|
20
|
+
* that builds node literals. Casting to `typeof Upstream` keeps the exported
|
|
21
|
+
* type byte-identical to what consumers see today; only the runtime values are
|
|
22
|
+
* ours. The type-only import is erased at compile time.
|
|
23
|
+
*
|
|
24
|
+
* `ast-node-types.test.ts` asserts this table against the real enum in both
|
|
25
|
+
* directions, so an upstream addition or rename fails the build rather than
|
|
26
|
+
* silently shipping a node type our rules can never match.
|
|
27
|
+
*/
|
|
28
|
+
import type { AST_NODE_TYPES as UpstreamASTNodeTypes } from '@typescript-eslint/utils';
|
|
29
|
+
export declare const AST_NODE_TYPES: typeof UpstreamASTNodeTypes;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AST_NODE_TYPES = void 0;
|
|
4
|
+
const AST_NODE_TYPES_VALUES = {
|
|
5
|
+
AccessorProperty: 'AccessorProperty',
|
|
6
|
+
ArrayExpression: 'ArrayExpression',
|
|
7
|
+
ArrayPattern: 'ArrayPattern',
|
|
8
|
+
ArrowFunctionExpression: 'ArrowFunctionExpression',
|
|
9
|
+
AssignmentExpression: 'AssignmentExpression',
|
|
10
|
+
AssignmentPattern: 'AssignmentPattern',
|
|
11
|
+
AwaitExpression: 'AwaitExpression',
|
|
12
|
+
BinaryExpression: 'BinaryExpression',
|
|
13
|
+
BlockStatement: 'BlockStatement',
|
|
14
|
+
BreakStatement: 'BreakStatement',
|
|
15
|
+
CallExpression: 'CallExpression',
|
|
16
|
+
CatchClause: 'CatchClause',
|
|
17
|
+
ChainExpression: 'ChainExpression',
|
|
18
|
+
ClassBody: 'ClassBody',
|
|
19
|
+
ClassDeclaration: 'ClassDeclaration',
|
|
20
|
+
ClassExpression: 'ClassExpression',
|
|
21
|
+
ConditionalExpression: 'ConditionalExpression',
|
|
22
|
+
ContinueStatement: 'ContinueStatement',
|
|
23
|
+
DebuggerStatement: 'DebuggerStatement',
|
|
24
|
+
Decorator: 'Decorator',
|
|
25
|
+
DoWhileStatement: 'DoWhileStatement',
|
|
26
|
+
EmptyStatement: 'EmptyStatement',
|
|
27
|
+
ExportAllDeclaration: 'ExportAllDeclaration',
|
|
28
|
+
ExportDefaultDeclaration: 'ExportDefaultDeclaration',
|
|
29
|
+
ExportNamedDeclaration: 'ExportNamedDeclaration',
|
|
30
|
+
ExportSpecifier: 'ExportSpecifier',
|
|
31
|
+
ExpressionStatement: 'ExpressionStatement',
|
|
32
|
+
ForInStatement: 'ForInStatement',
|
|
33
|
+
ForOfStatement: 'ForOfStatement',
|
|
34
|
+
ForStatement: 'ForStatement',
|
|
35
|
+
FunctionDeclaration: 'FunctionDeclaration',
|
|
36
|
+
FunctionExpression: 'FunctionExpression',
|
|
37
|
+
Identifier: 'Identifier',
|
|
38
|
+
IfStatement: 'IfStatement',
|
|
39
|
+
ImportAttribute: 'ImportAttribute',
|
|
40
|
+
ImportDeclaration: 'ImportDeclaration',
|
|
41
|
+
ImportDefaultSpecifier: 'ImportDefaultSpecifier',
|
|
42
|
+
ImportExpression: 'ImportExpression',
|
|
43
|
+
ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
|
|
44
|
+
ImportSpecifier: 'ImportSpecifier',
|
|
45
|
+
JSXAttribute: 'JSXAttribute',
|
|
46
|
+
JSXClosingElement: 'JSXClosingElement',
|
|
47
|
+
JSXClosingFragment: 'JSXClosingFragment',
|
|
48
|
+
JSXElement: 'JSXElement',
|
|
49
|
+
JSXEmptyExpression: 'JSXEmptyExpression',
|
|
50
|
+
JSXExpressionContainer: 'JSXExpressionContainer',
|
|
51
|
+
JSXFragment: 'JSXFragment',
|
|
52
|
+
JSXIdentifier: 'JSXIdentifier',
|
|
53
|
+
JSXMemberExpression: 'JSXMemberExpression',
|
|
54
|
+
JSXNamespacedName: 'JSXNamespacedName',
|
|
55
|
+
JSXOpeningElement: 'JSXOpeningElement',
|
|
56
|
+
JSXOpeningFragment: 'JSXOpeningFragment',
|
|
57
|
+
JSXSpreadAttribute: 'JSXSpreadAttribute',
|
|
58
|
+
JSXSpreadChild: 'JSXSpreadChild',
|
|
59
|
+
JSXText: 'JSXText',
|
|
60
|
+
LabeledStatement: 'LabeledStatement',
|
|
61
|
+
Literal: 'Literal',
|
|
62
|
+
LogicalExpression: 'LogicalExpression',
|
|
63
|
+
MemberExpression: 'MemberExpression',
|
|
64
|
+
MetaProperty: 'MetaProperty',
|
|
65
|
+
MethodDefinition: 'MethodDefinition',
|
|
66
|
+
NewExpression: 'NewExpression',
|
|
67
|
+
ObjectExpression: 'ObjectExpression',
|
|
68
|
+
ObjectPattern: 'ObjectPattern',
|
|
69
|
+
PrivateIdentifier: 'PrivateIdentifier',
|
|
70
|
+
Program: 'Program',
|
|
71
|
+
Property: 'Property',
|
|
72
|
+
PropertyDefinition: 'PropertyDefinition',
|
|
73
|
+
RestElement: 'RestElement',
|
|
74
|
+
ReturnStatement: 'ReturnStatement',
|
|
75
|
+
SequenceExpression: 'SequenceExpression',
|
|
76
|
+
SpreadElement: 'SpreadElement',
|
|
77
|
+
StaticBlock: 'StaticBlock',
|
|
78
|
+
Super: 'Super',
|
|
79
|
+
SwitchCase: 'SwitchCase',
|
|
80
|
+
SwitchStatement: 'SwitchStatement',
|
|
81
|
+
TSAbstractAccessorProperty: 'TSAbstractAccessorProperty',
|
|
82
|
+
TSAbstractKeyword: 'TSAbstractKeyword',
|
|
83
|
+
TSAbstractMethodDefinition: 'TSAbstractMethodDefinition',
|
|
84
|
+
TSAbstractPropertyDefinition: 'TSAbstractPropertyDefinition',
|
|
85
|
+
TSAnyKeyword: 'TSAnyKeyword',
|
|
86
|
+
TSArrayType: 'TSArrayType',
|
|
87
|
+
TSAsExpression: 'TSAsExpression',
|
|
88
|
+
TSAsyncKeyword: 'TSAsyncKeyword',
|
|
89
|
+
TSBigIntKeyword: 'TSBigIntKeyword',
|
|
90
|
+
TSBooleanKeyword: 'TSBooleanKeyword',
|
|
91
|
+
TSCallSignatureDeclaration: 'TSCallSignatureDeclaration',
|
|
92
|
+
TSClassImplements: 'TSClassImplements',
|
|
93
|
+
TSConditionalType: 'TSConditionalType',
|
|
94
|
+
TSConstructSignatureDeclaration: 'TSConstructSignatureDeclaration',
|
|
95
|
+
TSConstructorType: 'TSConstructorType',
|
|
96
|
+
TSDeclareFunction: 'TSDeclareFunction',
|
|
97
|
+
TSDeclareKeyword: 'TSDeclareKeyword',
|
|
98
|
+
TSEmptyBodyFunctionExpression: 'TSEmptyBodyFunctionExpression',
|
|
99
|
+
TSEnumBody: 'TSEnumBody',
|
|
100
|
+
TSEnumDeclaration: 'TSEnumDeclaration',
|
|
101
|
+
TSEnumMember: 'TSEnumMember',
|
|
102
|
+
TSExportAssignment: 'TSExportAssignment',
|
|
103
|
+
TSExportKeyword: 'TSExportKeyword',
|
|
104
|
+
TSExternalModuleReference: 'TSExternalModuleReference',
|
|
105
|
+
TSFunctionType: 'TSFunctionType',
|
|
106
|
+
TSImportEqualsDeclaration: 'TSImportEqualsDeclaration',
|
|
107
|
+
TSImportType: 'TSImportType',
|
|
108
|
+
TSIndexSignature: 'TSIndexSignature',
|
|
109
|
+
TSIndexedAccessType: 'TSIndexedAccessType',
|
|
110
|
+
TSInferType: 'TSInferType',
|
|
111
|
+
TSInstantiationExpression: 'TSInstantiationExpression',
|
|
112
|
+
TSInterfaceBody: 'TSInterfaceBody',
|
|
113
|
+
TSInterfaceDeclaration: 'TSInterfaceDeclaration',
|
|
114
|
+
TSInterfaceHeritage: 'TSInterfaceHeritage',
|
|
115
|
+
TSIntersectionType: 'TSIntersectionType',
|
|
116
|
+
TSIntrinsicKeyword: 'TSIntrinsicKeyword',
|
|
117
|
+
TSLiteralType: 'TSLiteralType',
|
|
118
|
+
TSMappedType: 'TSMappedType',
|
|
119
|
+
TSMethodSignature: 'TSMethodSignature',
|
|
120
|
+
TSModuleBlock: 'TSModuleBlock',
|
|
121
|
+
TSModuleDeclaration: 'TSModuleDeclaration',
|
|
122
|
+
TSNamedTupleMember: 'TSNamedTupleMember',
|
|
123
|
+
TSNamespaceExportDeclaration: 'TSNamespaceExportDeclaration',
|
|
124
|
+
TSNeverKeyword: 'TSNeverKeyword',
|
|
125
|
+
TSNonNullExpression: 'TSNonNullExpression',
|
|
126
|
+
TSNullKeyword: 'TSNullKeyword',
|
|
127
|
+
TSNumberKeyword: 'TSNumberKeyword',
|
|
128
|
+
TSObjectKeyword: 'TSObjectKeyword',
|
|
129
|
+
TSOptionalType: 'TSOptionalType',
|
|
130
|
+
TSParameterProperty: 'TSParameterProperty',
|
|
131
|
+
TSPrivateKeyword: 'TSPrivateKeyword',
|
|
132
|
+
TSPropertySignature: 'TSPropertySignature',
|
|
133
|
+
TSProtectedKeyword: 'TSProtectedKeyword',
|
|
134
|
+
TSPublicKeyword: 'TSPublicKeyword',
|
|
135
|
+
TSQualifiedName: 'TSQualifiedName',
|
|
136
|
+
TSReadonlyKeyword: 'TSReadonlyKeyword',
|
|
137
|
+
TSRestType: 'TSRestType',
|
|
138
|
+
TSSatisfiesExpression: 'TSSatisfiesExpression',
|
|
139
|
+
TSStaticKeyword: 'TSStaticKeyword',
|
|
140
|
+
TSStringKeyword: 'TSStringKeyword',
|
|
141
|
+
TSSymbolKeyword: 'TSSymbolKeyword',
|
|
142
|
+
TSTemplateLiteralType: 'TSTemplateLiteralType',
|
|
143
|
+
TSThisType: 'TSThisType',
|
|
144
|
+
TSTupleType: 'TSTupleType',
|
|
145
|
+
TSTypeAliasDeclaration: 'TSTypeAliasDeclaration',
|
|
146
|
+
TSTypeAnnotation: 'TSTypeAnnotation',
|
|
147
|
+
TSTypeAssertion: 'TSTypeAssertion',
|
|
148
|
+
TSTypeLiteral: 'TSTypeLiteral',
|
|
149
|
+
TSTypeOperator: 'TSTypeOperator',
|
|
150
|
+
TSTypeParameter: 'TSTypeParameter',
|
|
151
|
+
TSTypeParameterDeclaration: 'TSTypeParameterDeclaration',
|
|
152
|
+
TSTypeParameterInstantiation: 'TSTypeParameterInstantiation',
|
|
153
|
+
TSTypePredicate: 'TSTypePredicate',
|
|
154
|
+
TSTypeQuery: 'TSTypeQuery',
|
|
155
|
+
TSTypeReference: 'TSTypeReference',
|
|
156
|
+
TSUndefinedKeyword: 'TSUndefinedKeyword',
|
|
157
|
+
TSUnionType: 'TSUnionType',
|
|
158
|
+
TSUnknownKeyword: 'TSUnknownKeyword',
|
|
159
|
+
TSVoidKeyword: 'TSVoidKeyword',
|
|
160
|
+
TaggedTemplateExpression: 'TaggedTemplateExpression',
|
|
161
|
+
TemplateElement: 'TemplateElement',
|
|
162
|
+
TemplateLiteral: 'TemplateLiteral',
|
|
163
|
+
ThisExpression: 'ThisExpression',
|
|
164
|
+
ThrowStatement: 'ThrowStatement',
|
|
165
|
+
TryStatement: 'TryStatement',
|
|
166
|
+
UnaryExpression: 'UnaryExpression',
|
|
167
|
+
UpdateExpression: 'UpdateExpression',
|
|
168
|
+
VariableDeclaration: 'VariableDeclaration',
|
|
169
|
+
VariableDeclarator: 'VariableDeclarator',
|
|
170
|
+
WhileStatement: 'WhileStatement',
|
|
171
|
+
WithStatement: 'WithStatement',
|
|
172
|
+
YieldExpression: 'YieldExpression',
|
|
173
|
+
};
|
|
174
|
+
exports.AST_NODE_TYPES = AST_NODE_TYPES_VALUES;
|
package/src/index.d.ts
CHANGED
|
@@ -30,7 +30,16 @@ export * from './aria-definitions';
|
|
|
30
30
|
export type { Severity, OWASPCategory, OWASP2025Category, OWASP2021Category, OWASPServerlessCategory, ComplianceFramework, LLMMessageOptions, EnterpriseMessageOptions, SARIFResult, } from './messaging';
|
|
31
31
|
export { CVSS_RANGES, CWE_MAPPING, CWE_COMPLIANCE_MAPPING, OWASP_DETAILS, OWASP_2025_DETAILS, OWASP_2021_DETAILS, OWASP_SERVERLESS_DETAILS, OWASP_2021_TO_2025, MessageIcons, getSecurityBenchmarks, severityToCVSS, toSARIF, } from './messaging';
|
|
32
32
|
/**
|
|
33
|
-
* Re-export commonly used types and utilities from
|
|
33
|
+
* Re-export commonly used types and utilities from typescript-eslint.
|
|
34
|
+
*
|
|
35
|
+
* ponytail: both of these used to be runtime imports from
|
|
36
|
+
* `@typescript-eslint/utils`, which declares a non-optional `typescript` peer
|
|
37
|
+
* and so pulled a 24 MB compiler into every consumer install. `AST_NODE_TYPES`
|
|
38
|
+
* is now an inlined table (`./ast-node-types`) and `ESLintUtils` is our own
|
|
39
|
+
* ported shim (`./rule-creation/rule-creator`). Together they take this
|
|
40
|
+
* package to zero runtime dependencies. The type-only re-exports below still
|
|
41
|
+
* point at `utils` — erased at compile time, so they cost nothing.
|
|
34
42
|
*/
|
|
35
|
-
export {
|
|
43
|
+
export { AST_NODE_TYPES } from './ast-node-types';
|
|
44
|
+
export { ESLintUtils } from './rule-creation/rule-creator';
|
|
36
45
|
export type { TSESLint, TSESTree, ParserServices, } from '@typescript-eslint/utils';
|
package/src/index.js
CHANGED
|
@@ -1,46 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.
|
|
3
|
+
exports.ESLintUtils = exports.AST_NODE_TYPES = exports.toSARIF = exports.severityToCVSS = exports.getSecurityBenchmarks = exports.MessageIcons = exports.OWASP_2021_TO_2025 = exports.OWASP_SERVERLESS_DETAILS = exports.OWASP_2021_DETAILS = exports.OWASP_2025_DETAILS = exports.OWASP_DETAILS = exports.CWE_COMPLIANCE_MAPPING = exports.CWE_MAPPING = exports.CVSS_RANGES = void 0;
|
|
9
4
|
const tslib_1 = require("tslib");
|
|
10
|
-
/**
|
|
11
|
-
* @interlace/eslint-devkit
|
|
12
|
-
*
|
|
13
|
-
* Core utilities for creating TypeScript ESLint plugins
|
|
14
|
-
* Inspired by typescript-eslint's infrastructure
|
|
15
|
-
*
|
|
16
|
-
* This package provides:
|
|
17
|
-
* - Rule creator utilities
|
|
18
|
-
* - AST utilities
|
|
19
|
-
* - Type utilities
|
|
20
|
-
* - LLM message formatting with enterprise security benchmarks
|
|
21
|
-
* - OWASP Top 10, CVSS, CWE mappings
|
|
22
|
-
* - SARIF output for security tool integration
|
|
23
|
-
* - Custom message templates for organizations
|
|
24
|
-
*/
|
|
25
|
-
// Rule creation utilities
|
|
26
|
-
// Side-effect import: extends `@typescript-eslint/utils` `RuleMetaDataDocs`
|
|
27
|
-
// with Interlace fields (cwe + cvss) so plugin authors can populate them
|
|
28
|
-
// without per-rule `@ts-expect-error`. See ./types/meta-augmentation.ts.
|
|
29
5
|
require("./types/meta-augmentation");
|
|
30
6
|
tslib_1.__exportStar(require("./rule-creation"), exports);
|
|
31
|
-
// AST utilities
|
|
32
7
|
tslib_1.__exportStar(require("./ast/ast-utils"), exports);
|
|
33
|
-
// Type utilities
|
|
34
8
|
tslib_1.__exportStar(require("./types/type-utils"), exports);
|
|
35
|
-
// LLM messaging utilities
|
|
36
9
|
tslib_1.__exportStar(require("./messaging"), exports);
|
|
37
|
-
// Security utilities
|
|
38
10
|
tslib_1.__exportStar(require("./security"), exports);
|
|
39
|
-
// Node utilities
|
|
40
11
|
tslib_1.__exportStar(require("./node"), exports);
|
|
41
|
-
// Resolver and dependency analysis utilities
|
|
42
12
|
tslib_1.__exportStar(require("./resolver"), exports);
|
|
43
|
-
// Other utilities
|
|
44
13
|
tslib_1.__exportStar(require("./aria-definitions"), exports);
|
|
45
14
|
var messaging_1 = require("./messaging");
|
|
46
15
|
Object.defineProperty(exports, "CVSS_RANGES", { enumerable: true, get: function () { return messaging_1.CVSS_RANGES; } });
|
|
@@ -55,9 +24,7 @@ Object.defineProperty(exports, "MessageIcons", { enumerable: true, get: function
|
|
|
55
24
|
Object.defineProperty(exports, "getSecurityBenchmarks", { enumerable: true, get: function () { return messaging_1.getSecurityBenchmarks; } });
|
|
56
25
|
Object.defineProperty(exports, "severityToCVSS", { enumerable: true, get: function () { return messaging_1.severityToCVSS; } });
|
|
57
26
|
Object.defineProperty(exports, "toSARIF", { enumerable: true, get: function () { return messaging_1.toSARIF; } });
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Object.defineProperty(exports, "ESLintUtils", { enumerable: true, get: function () { return utils_1.ESLintUtils; } });
|
|
63
|
-
Object.defineProperty(exports, "AST_NODE_TYPES", { enumerable: true, get: function () { return utils_1.AST_NODE_TYPES; } });
|
|
27
|
+
var ast_node_types_1 = require("./ast-node-types");
|
|
28
|
+
Object.defineProperty(exports, "AST_NODE_TYPES", { enumerable: true, get: function () { return ast_node_types_1.AST_NODE_TYPES; } });
|
|
29
|
+
var rule_creator_1 = require("./rule-creation/rule-creator");
|
|
30
|
+
Object.defineProperty(exports, "ESLintUtils", { enumerable: true, get: function () { return rule_creator_1.ESLintUtils; } });
|