@r_masseater/oxlint-typed-rules 0.1.0 → 0.1.2
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 +12 -2
- package/dist/eslint-utils-CTNWAzIf.mjs +352 -0
- package/dist/eslint-utils-CTNWAzIf.mjs.map +1 -0
- package/dist/index.d.mts +58 -17
- package/dist/index.mjs +1 -1
- package/dist/react.d.mts +14 -0
- package/dist/react.mjs +31118 -0
- package/dist/react.mjs.map +1 -0
- package/dist/tanstack-start.d.mts +5 -1
- package/dist/tanstack-start.mjs +17 -296
- package/dist/tanstack-start.mjs.map +1 -1
- package/dist/typed-rule-D8jasU_z.mjs +284 -0
- package/dist/typed-rule-D8jasU_z.mjs.map +1 -0
- package/package.json +34 -15
- package/dist/typed-rule-BPSyA0px.mjs +0 -146
- package/dist/typed-rule-BPSyA0px.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -13,11 +13,20 @@ ESLint を入れずに、型情報を使うルールを oxlint だけで回せ
|
|
|
13
13
|
|
|
14
14
|
- `@r_masseater/oxlint-typed-rules/tanstack-start`
|
|
15
15
|
- [@tanstack/eslint-plugin-start][tanstack] の 2 ルール
|
|
16
|
+
- `@r_masseater/oxlint-typed-rules/react`
|
|
17
|
+
- [@eslint-react/eslint-plugin][eslint-react] 5.28.8 の全ルールと configs
|
|
16
18
|
|
|
17
19
|
[tanstack]: https://github.com/TanStack/router/tree/main/packages/eslint-plugin-start
|
|
20
|
+
[eslint-react]: https://github.com/Rel1cx/eslint-react
|
|
18
21
|
|
|
19
22
|
元のリポのテストを手を入れずに移植し、すべて同じ結果になることを確かめている。
|
|
20
23
|
TanStack Start の 2 ルールは、ファイルをまたぐと違反を取りこぼす点を直してある。
|
|
24
|
+
@eslint-react はルールの ID と configs を元のプラグインと同じにしてあるので、
|
|
25
|
+
jsPlugins の `specifier` を差し替えるだけで乗り換えられる。
|
|
26
|
+
oxc の構文木は JSX の属性の文字参照を復号しないので([oxc#9667][oxc-9667])、
|
|
27
|
+
`jsx-no-children-prop` は属性の元の文字列から復号するよう直してある。
|
|
28
|
+
|
|
29
|
+
[oxc-9667]: https://github.com/oxc-project/oxc/issues/9667
|
|
21
30
|
|
|
22
31
|
## 使い方
|
|
23
32
|
|
|
@@ -49,9 +58,10 @@ export default defineConfig({
|
|
|
49
58
|
|
|
50
59
|
## TypeScript 7 との変換層
|
|
51
60
|
|
|
52
|
-
同梱したルールは TypeScript 6
|
|
61
|
+
同梱したルールは TypeScript 6 までの `ts` 名前空間と `Program`・`TypeChecker` を読む。
|
|
53
62
|
TypeScript 7.1 の `typescript/sync` は形が違う。
|
|
54
|
-
|
|
63
|
+
そこで、同梱したルールが使う分だけを `typescript/sync` と `typescript/ast` で組み立てる層を持つ。
|
|
64
|
+
ビルドでルールの `typescript` の import をこの層に向けるので、TypeScript 6 以前は入らない。
|
|
55
65
|
この層は暫定である。
|
|
56
66
|
typescript-eslint の [#12803][tse-12803] が同じ層を持つので、
|
|
57
67
|
それが公開されたら乗り換える([#13][issue-13])。
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { Array as Array$1, Function, Option, Predicate } from "effect";
|
|
2
|
+
import { SyntaxKind, SyntaxKind as SyntaxKind$1 } from "typescript/ast";
|
|
3
|
+
import { JsxEmit, JsxEmit as JsxEmit$1, SymbolFlags, SymbolFlags as SymbolFlags$1, TypeFlags, TypeFlags as TypeFlags$1 } from "typescript/sync";
|
|
4
|
+
import { isArrayBindingPattern, isArrayBindingPattern as isArrayBindingPattern$1, isArrowFunction, isArrowFunction as isArrowFunction$1, isBindingElement, isBindingElement as isBindingElement$1, isCallExpression, isCallExpression as isCallExpression$1, isClassDeclaration, isClassDeclaration as isClassDeclaration$1, isClassExpression, isClassExpression as isClassExpression$1, isEnumDeclaration, isEnumDeclaration as isEnumDeclaration$1, isEnumMember, isEnumMember as isEnumMember$1, isExpressionStatement, isExpressionStatement as isExpressionStatement$1, isFunctionDeclaration, isFunctionDeclaration as isFunctionDeclaration$1, isFunctionExpression, isFunctionExpression as isFunctionExpression$1, isIdentifier, isIdentifier as isIdentifier$1, isImportClause, isImportClause as isImportClause$1, isImportSpecifier, isImportSpecifier as isImportSpecifier$1, isInterfaceDeclaration, isInterfaceDeclaration as isInterfaceDeclaration$1, isIntersectionTypeNode, isIntersectionTypeNode as isIntersectionTypeNode$1, isJsxAttribute, isJsxAttribute as isJsxAttribute$1, isJsxExpression, isJsxExpression as isJsxExpression$1, isJsxOpeningElement, isJsxOpeningElement as isJsxOpeningElement$1, isJsxSelfClosingElement, isJsxSelfClosingElement as isJsxSelfClosingElement$1, isMappedTypeNode, isMappedTypeNode as isMappedTypeNode$1, isMethodDeclaration, isMethodDeclaration as isMethodDeclaration$1, isMethodSignatureDeclaration, isMethodSignatureDeclaration as isMethodSignature, isModuleDeclaration, isModuleDeclaration as isModuleDeclaration$1, isNamespaceExport, isNamespaceExport as isNamespaceExport$1, isNamespaceExportDeclaration, isNamespaceExportDeclaration as isNamespaceExportDeclaration$1, isNamespaceImport, isNamespaceImport as isNamespaceImport$1, isObjectBindingPattern, isObjectBindingPattern as isObjectBindingPattern$1, isObjectLiteralExpression, isObjectLiteralExpression as isObjectLiteralExpression$1, isParameterDeclaration, isParameterDeclaration as isParameter, isParenthesizedExpression, isParenthesizedExpression as isParenthesizedExpression$1, isPropertyAccessExpression, isPropertyAccessExpression as isPropertyAccessExpression$1, isPropertyAssignment, isPropertyAssignment as isPropertyAssignment$1, isPropertyDeclaration, isPropertyDeclaration as isPropertyDeclaration$1, isPropertySignatureDeclaration, isPropertySignatureDeclaration as isPropertySignature, isStringLiteral, isStringLiteral as isStringLiteral$1, isTypeAliasDeclaration, isTypeAliasDeclaration as isTypeAliasDeclaration$1, isTypeLiteralNode, isTypeLiteralNode as isTypeLiteralNode$1, isTypeParameterDeclaration, isTypeParameterDeclaration as isTypeParameterDeclaration$1, isTypeQueryNode, isTypeQueryNode as isTypeQueryNode$1, isTypeReferenceNode, isTypeReferenceNode as isTypeReferenceNode$1, isUnionTypeNode, isUnionTypeNode as isUnionTypeNode$1, isVariableDeclaration, isVariableDeclaration as isVariableDeclaration$1, isVariableStatement, isVariableStatement as isVariableStatement$1 } from "typescript/ast/is";
|
|
5
|
+
// \0rolldown/runtime.js
|
|
6
|
+
var __create = Object.create;
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
13
|
+
var __exportAll = (all, no_symbols) => {
|
|
14
|
+
let target = {};
|
|
15
|
+
for (var name in all) __defProp(target, name, {
|
|
16
|
+
get: all[name],
|
|
17
|
+
enumerable: true
|
|
18
|
+
});
|
|
19
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
20
|
+
return target;
|
|
21
|
+
};
|
|
22
|
+
var __copyProps = (to, from, except, desc) => {
|
|
23
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
24
|
+
key = keys[i];
|
|
25
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
26
|
+
get: ((k) => from[k]).bind(null, key),
|
|
27
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
33
|
+
value: mod,
|
|
34
|
+
enumerable: true
|
|
35
|
+
}) : target, mod));
|
|
36
|
+
// src/ts-compat.ts
|
|
37
|
+
var ts_compat_exports = /* @__PURE__ */ __exportAll({
|
|
38
|
+
JsxEmit: () => JsxEmit$1,
|
|
39
|
+
SymbolFlags: () => SymbolFlags$1,
|
|
40
|
+
SyntaxKind: () => SyntaxKind$1,
|
|
41
|
+
TypeFlags: () => TypeFlags$1,
|
|
42
|
+
default: () => ts,
|
|
43
|
+
forEachChild: () => forEachChild,
|
|
44
|
+
isArrayBindingPattern: () => isArrayBindingPattern$1,
|
|
45
|
+
isArrowFunction: () => isArrowFunction$1,
|
|
46
|
+
isBindingElement: () => isBindingElement$1,
|
|
47
|
+
isCallExpression: () => isCallExpression$1,
|
|
48
|
+
isClassDeclaration: () => isClassDeclaration$1,
|
|
49
|
+
isClassExpression: () => isClassExpression$1,
|
|
50
|
+
isEnumDeclaration: () => isEnumDeclaration$1,
|
|
51
|
+
isEnumMember: () => isEnumMember$1,
|
|
52
|
+
isExpressionStatement: () => isExpressionStatement$1,
|
|
53
|
+
isFunctionDeclaration: () => isFunctionDeclaration$1,
|
|
54
|
+
isFunctionExpression: () => isFunctionExpression$1,
|
|
55
|
+
isFunctionLike: () => isFunctionLike,
|
|
56
|
+
isIdentifier: () => isIdentifier$1,
|
|
57
|
+
isImportClause: () => isImportClause$1,
|
|
58
|
+
isImportSpecifier: () => isImportSpecifier$1,
|
|
59
|
+
isInterfaceDeclaration: () => isInterfaceDeclaration$1,
|
|
60
|
+
isIntersectionTypeNode: () => isIntersectionTypeNode$1,
|
|
61
|
+
isJsxAttribute: () => isJsxAttribute$1,
|
|
62
|
+
isJsxExpression: () => isJsxExpression$1,
|
|
63
|
+
isJsxOpeningElement: () => isJsxOpeningElement$1,
|
|
64
|
+
isJsxSelfClosingElement: () => isJsxSelfClosingElement$1,
|
|
65
|
+
isMappedTypeNode: () => isMappedTypeNode$1,
|
|
66
|
+
isMethodDeclaration: () => isMethodDeclaration$1,
|
|
67
|
+
isMethodSignature: () => isMethodSignature,
|
|
68
|
+
isModuleDeclaration: () => isModuleDeclaration$1,
|
|
69
|
+
isNamespaceExport: () => isNamespaceExport$1,
|
|
70
|
+
isNamespaceExportDeclaration: () => isNamespaceExportDeclaration$1,
|
|
71
|
+
isNamespaceImport: () => isNamespaceImport$1,
|
|
72
|
+
isObjectBindingPattern: () => isObjectBindingPattern$1,
|
|
73
|
+
isObjectLiteralExpression: () => isObjectLiteralExpression$1,
|
|
74
|
+
isParameter: () => isParameter,
|
|
75
|
+
isParenthesizedExpression: () => isParenthesizedExpression$1,
|
|
76
|
+
isPropertyAccessExpression: () => isPropertyAccessExpression$1,
|
|
77
|
+
isPropertyAssignment: () => isPropertyAssignment$1,
|
|
78
|
+
isPropertyDeclaration: () => isPropertyDeclaration$1,
|
|
79
|
+
isPropertySignature: () => isPropertySignature,
|
|
80
|
+
isStringLiteral: () => isStringLiteral$1,
|
|
81
|
+
isTypeAliasDeclaration: () => isTypeAliasDeclaration$1,
|
|
82
|
+
isTypeLiteralNode: () => isTypeLiteralNode$1,
|
|
83
|
+
isTypeParameterDeclaration: () => isTypeParameterDeclaration$1,
|
|
84
|
+
isTypeQueryNode: () => isTypeQueryNode$1,
|
|
85
|
+
isTypeReferenceNode: () => isTypeReferenceNode$1,
|
|
86
|
+
isUnionTypeNode: () => isUnionTypeNode$1,
|
|
87
|
+
isVariableDeclaration: () => isVariableDeclaration$1,
|
|
88
|
+
isVariableStatement: () => isVariableStatement$1
|
|
89
|
+
});
|
|
90
|
+
const FUNCTION_LIKE_KINDS = /* @__PURE__ */ new Set([
|
|
91
|
+
SyntaxKind.FunctionDeclaration,
|
|
92
|
+
SyntaxKind.MethodDeclaration,
|
|
93
|
+
SyntaxKind.Constructor,
|
|
94
|
+
SyntaxKind.GetAccessor,
|
|
95
|
+
SyntaxKind.SetAccessor,
|
|
96
|
+
SyntaxKind.FunctionExpression,
|
|
97
|
+
SyntaxKind.ArrowFunction,
|
|
98
|
+
SyntaxKind.MethodSignature,
|
|
99
|
+
SyntaxKind.CallSignature,
|
|
100
|
+
SyntaxKind.JSDocSignature,
|
|
101
|
+
SyntaxKind.ConstructSignature,
|
|
102
|
+
SyntaxKind.IndexSignature,
|
|
103
|
+
SyntaxKind.FunctionType,
|
|
104
|
+
SyntaxKind.ConstructorType
|
|
105
|
+
]);
|
|
106
|
+
const isFunctionLike = (node) => Option.fromNullishOr(node).pipe(Option.exists(({ kind }) => FUNCTION_LIKE_KINDS.has(kind)));
|
|
107
|
+
const forEachChild = Function.dual((args) => Array$1.head(Array$1.fromIterable(args)).pipe(Option.exists(Predicate.not(Predicate.isFunction))), (node, visit) => node.forEachChild(visit));
|
|
108
|
+
const ts = {
|
|
109
|
+
forEachChild,
|
|
110
|
+
isArrayBindingPattern,
|
|
111
|
+
isArrowFunction,
|
|
112
|
+
isBindingElement,
|
|
113
|
+
isCallExpression,
|
|
114
|
+
isClassDeclaration,
|
|
115
|
+
isClassExpression,
|
|
116
|
+
isEnumDeclaration,
|
|
117
|
+
isEnumMember,
|
|
118
|
+
isExpressionStatement,
|
|
119
|
+
isFunctionDeclaration,
|
|
120
|
+
isFunctionExpression,
|
|
121
|
+
isFunctionLike,
|
|
122
|
+
isIdentifier,
|
|
123
|
+
isImportClause,
|
|
124
|
+
isImportSpecifier,
|
|
125
|
+
isInterfaceDeclaration,
|
|
126
|
+
isIntersectionTypeNode,
|
|
127
|
+
isJsxAttribute,
|
|
128
|
+
isJsxExpression,
|
|
129
|
+
isJsxOpeningElement,
|
|
130
|
+
isJsxSelfClosingElement,
|
|
131
|
+
isMappedTypeNode,
|
|
132
|
+
isMethodDeclaration,
|
|
133
|
+
isMethodSignature: isMethodSignatureDeclaration,
|
|
134
|
+
isModuleDeclaration,
|
|
135
|
+
isNamespaceExport,
|
|
136
|
+
isNamespaceExportDeclaration,
|
|
137
|
+
isNamespaceImport,
|
|
138
|
+
isObjectBindingPattern,
|
|
139
|
+
isObjectLiteralExpression,
|
|
140
|
+
isParameter: isParameterDeclaration,
|
|
141
|
+
isParenthesizedExpression,
|
|
142
|
+
isPropertyAccessExpression,
|
|
143
|
+
isPropertyAssignment,
|
|
144
|
+
isPropertyDeclaration,
|
|
145
|
+
isPropertySignature: isPropertySignatureDeclaration,
|
|
146
|
+
isStringLiteral,
|
|
147
|
+
isTypeAliasDeclaration,
|
|
148
|
+
isTypeLiteralNode,
|
|
149
|
+
isTypeParameterDeclaration,
|
|
150
|
+
isTypeQueryNode,
|
|
151
|
+
isTypeReferenceNode,
|
|
152
|
+
isUnionTypeNode,
|
|
153
|
+
isVariableDeclaration,
|
|
154
|
+
isVariableStatement,
|
|
155
|
+
JsxEmit,
|
|
156
|
+
SymbolFlags,
|
|
157
|
+
SyntaxKind,
|
|
158
|
+
TypeFlags
|
|
159
|
+
};
|
|
160
|
+
// ../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/deepMerge.js
|
|
161
|
+
var require_deepMerge = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
162
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
163
|
+
exports.isObjectNotArray = isObjectNotArray;
|
|
164
|
+
exports.deepMerge = deepMerge;
|
|
165
|
+
/**
|
|
166
|
+
* Check if the variable contains an object strictly rejecting arrays
|
|
167
|
+
* @returns `true` if obj is an object
|
|
168
|
+
*/
|
|
169
|
+
function isObjectNotArray(obj) {
|
|
170
|
+
return typeof obj === "object" && obj != null && !Array.isArray(obj);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Pure function - doesn't mutate either parameter!
|
|
174
|
+
* Merges two objects together deeply, overwriting the properties in first with the properties in second
|
|
175
|
+
* @param first The first object
|
|
176
|
+
* @param second The second object
|
|
177
|
+
* @returns a new object
|
|
178
|
+
*/
|
|
179
|
+
function deepMerge(first = {}, second = {}) {
|
|
180
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(first), ...Object.keys(second)]);
|
|
181
|
+
return Object.fromEntries([...keys].map((key) => {
|
|
182
|
+
const firstHasKey = key in first;
|
|
183
|
+
const secondHasKey = key in second;
|
|
184
|
+
const firstValue = first[key];
|
|
185
|
+
const secondValue = second[key];
|
|
186
|
+
let value;
|
|
187
|
+
if (firstHasKey && secondHasKey) {
|
|
188
|
+
if (isObjectNotArray(firstValue) && isObjectNotArray(secondValue)) value = deepMerge(firstValue, secondValue);
|
|
189
|
+
else value = secondValue;
|
|
190
|
+
} else if (firstHasKey) value = firstValue;
|
|
191
|
+
else value = secondValue;
|
|
192
|
+
return [key, value];
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
}));
|
|
196
|
+
// ../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/applyDefault.js
|
|
197
|
+
var require_applyDefault = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
198
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
199
|
+
exports.applyDefault = applyDefault;
|
|
200
|
+
const deepMerge_1 = require_deepMerge();
|
|
201
|
+
/**
|
|
202
|
+
* Pure function - doesn't mutate either parameter!
|
|
203
|
+
* Uses the default options and overrides with the options provided by the user
|
|
204
|
+
* @param defaultOptions the defaults
|
|
205
|
+
* @param userOptions the user opts
|
|
206
|
+
* @returns the options with defaults
|
|
207
|
+
*/
|
|
208
|
+
function applyDefault(defaultOptions, userOptions) {
|
|
209
|
+
const options = structuredClone(defaultOptions);
|
|
210
|
+
if (userOptions == null) return options;
|
|
211
|
+
options.forEach((opt, i) => {
|
|
212
|
+
if (userOptions[i] !== void 0) {
|
|
213
|
+
const userOpt = userOptions[i];
|
|
214
|
+
if ((0, deepMerge_1.isObjectNotArray)(userOpt) && (0, deepMerge_1.isObjectNotArray)(opt)) options[i] = (0, deepMerge_1.deepMerge)(opt, userOpt);
|
|
215
|
+
else options[i] = userOpt;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
return options;
|
|
219
|
+
}
|
|
220
|
+
}));
|
|
221
|
+
// ../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/parserSeemsToBeTSESLint.js
|
|
222
|
+
var require_parserSeemsToBeTSESLint = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
223
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
224
|
+
exports.parserSeemsToBeTSESLint = parserSeemsToBeTSESLint;
|
|
225
|
+
function parserSeemsToBeTSESLint(parser) {
|
|
226
|
+
return !!parser && /(?:typescript-eslint|\.\.)[\w/\\]*parser/.test(parser);
|
|
227
|
+
}
|
|
228
|
+
}));
|
|
229
|
+
// ../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js
|
|
230
|
+
var require_getParserServices = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
231
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
232
|
+
exports.getParserServices = getParserServices;
|
|
233
|
+
const parserSeemsToBeTSESLint_1 = require_parserSeemsToBeTSESLint();
|
|
234
|
+
const ERROR_MESSAGE_REQUIRES_PARSER_SERVICES = "You have used a rule which requires type information, but don't have parserOptions set to generate type information for this file. See https://tseslint.com/typed-linting for enabling linting with type information.";
|
|
235
|
+
const ERROR_MESSAGE_UNKNOWN_PARSER = "Note: detected a parser other than @typescript-eslint/parser. Make sure the parser is configured to forward \"parserOptions.project\" to @typescript-eslint/parser.";
|
|
236
|
+
function getParserServices(context, allowWithoutFullTypeInformation = false) {
|
|
237
|
+
const parser = context.parserPath || context.languageOptions.parser?.meta?.name;
|
|
238
|
+
if (context.sourceCode.parserServices?.esTreeNodeToTSNodeMap == null || context.sourceCode.parserServices.tsNodeToESTreeNodeMap == null) throwError(parser);
|
|
239
|
+
if (context.sourceCode.parserServices.program == null && !allowWithoutFullTypeInformation) throwError(parser);
|
|
240
|
+
return context.sourceCode.parserServices;
|
|
241
|
+
}
|
|
242
|
+
function throwError(parser) {
|
|
243
|
+
const messages = [
|
|
244
|
+
ERROR_MESSAGE_REQUIRES_PARSER_SERVICES,
|
|
245
|
+
`Parser: ${parser || "(unknown)"}`,
|
|
246
|
+
!(0, parserSeemsToBeTSESLint_1.parserSeemsToBeTSESLint)(parser) && ERROR_MESSAGE_UNKNOWN_PARSER
|
|
247
|
+
].filter(Boolean);
|
|
248
|
+
throw new Error(messages.join("\n"));
|
|
249
|
+
}
|
|
250
|
+
}));
|
|
251
|
+
// ../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/InferTypesFromRule.js
|
|
252
|
+
var require_InferTypesFromRule = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
253
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
254
|
+
}));
|
|
255
|
+
// ../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/nullThrows.js
|
|
256
|
+
var require_nullThrows = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
257
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
258
|
+
exports.NullThrowsReasons = void 0;
|
|
259
|
+
exports.nullThrows = nullThrows;
|
|
260
|
+
/**
|
|
261
|
+
* A set of common reasons for calling nullThrows
|
|
262
|
+
*/
|
|
263
|
+
exports.NullThrowsReasons = {
|
|
264
|
+
MissingParent: "Expected node to have a parent.",
|
|
265
|
+
MissingToken: (token, thing) => `Expected to find a ${token} for the ${thing}.`
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Assert that a value must not be null or undefined.
|
|
269
|
+
* This is a nice explicit alternative to the non-null assertion operator.
|
|
270
|
+
*/
|
|
271
|
+
function nullThrows(value, message) {
|
|
272
|
+
if (value == null) throw new Error(`Non-null Assertion Failed: ${message}`);
|
|
273
|
+
return value;
|
|
274
|
+
}
|
|
275
|
+
}));
|
|
276
|
+
// ../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js
|
|
277
|
+
var require_RuleCreator = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
278
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
279
|
+
exports.RuleCreator = RuleCreator;
|
|
280
|
+
const applyDefault_1 = require_applyDefault();
|
|
281
|
+
/**
|
|
282
|
+
* Creates reusable function to create rules with default options and docs URLs.
|
|
283
|
+
*
|
|
284
|
+
* @param urlCreator Creates a documentation URL for a given rule name.
|
|
285
|
+
* @returns Function to create a rule with the docs URL format.
|
|
286
|
+
*/
|
|
287
|
+
function RuleCreator(urlCreator) {
|
|
288
|
+
return function createNamedRule({ meta, name, ...rule }) {
|
|
289
|
+
return createRule({
|
|
290
|
+
meta: {
|
|
291
|
+
...meta,
|
|
292
|
+
docs: {
|
|
293
|
+
...meta.docs,
|
|
294
|
+
url: urlCreator(name)
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
name,
|
|
298
|
+
...rule
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function createRule({ create, defaultOptions, meta, name }) {
|
|
303
|
+
const resolvedDefaultOptions = meta.defaultOptions ?? defaultOptions ?? [];
|
|
304
|
+
return {
|
|
305
|
+
create(context) {
|
|
306
|
+
return create(context, (0, applyDefault_1.applyDefault)(resolvedDefaultOptions, context.options));
|
|
307
|
+
},
|
|
308
|
+
defaultOptions,
|
|
309
|
+
meta,
|
|
310
|
+
name
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Creates a well-typed TSESLint custom ESLint rule without a docs URL.
|
|
315
|
+
*
|
|
316
|
+
* @returns Well-typed TSESLint custom ESLint rule.
|
|
317
|
+
* @remarks It is generally better to provide a docs URL function to RuleCreator.
|
|
318
|
+
*/
|
|
319
|
+
RuleCreator.withoutDocs = function withoutDocs(args) {
|
|
320
|
+
return createRule(args);
|
|
321
|
+
};
|
|
322
|
+
}));
|
|
323
|
+
// ../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js
|
|
324
|
+
var require_eslint_utils = /* @__PURE__ */ __commonJSMin(((exports, module, this$1) => {
|
|
325
|
+
var __createBinding = this$1 && this$1.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
326
|
+
if (k2 === void 0) k2 = k;
|
|
327
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
328
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
329
|
+
enumerable: true,
|
|
330
|
+
get: function() {
|
|
331
|
+
return m[k];
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
Object.defineProperty(o, k2, desc);
|
|
335
|
+
}) : (function(o, m, k, k2) {
|
|
336
|
+
if (k2 === void 0) k2 = k;
|
|
337
|
+
o[k2] = m[k];
|
|
338
|
+
}));
|
|
339
|
+
var __exportStar = this$1 && this$1.__exportStar || function(m, exports) {
|
|
340
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
341
|
+
};
|
|
342
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
343
|
+
__exportStar(require_applyDefault(), exports);
|
|
344
|
+
__exportStar(require_deepMerge(), exports);
|
|
345
|
+
__exportStar(require_getParserServices(), exports);
|
|
346
|
+
__exportStar(require_InferTypesFromRule(), exports);
|
|
347
|
+
__exportStar(require_nullThrows(), exports);
|
|
348
|
+
__exportStar(require_RuleCreator(), exports);
|
|
349
|
+
}));
|
|
350
|
+
export { __commonJSMin as _, isBindingElement$1 as a, isFunctionLike as c, isJsxSelfClosingElement$1 as d, isObjectBindingPattern$1 as f, ts_compat_exports as g, ts as h, isArrayBindingPattern$1 as i, isIdentifier$1 as l, isStringLiteral$1 as m, SymbolFlags$1 as n, isCallExpression$1 as o, isParameter as p, forEachChild as r, isExpressionStatement$1 as s, require_eslint_utils as t, isJsxOpeningElement$1 as u, __toESM as v };
|
|
351
|
+
|
|
352
|
+
//# sourceMappingURL=eslint-utils-CTNWAzIf.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-utils-CTNWAzIf.mjs","names":["Arr"],"sources":["../src/ts-compat.ts","../../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/deepMerge.js","../../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/applyDefault.js","../../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/parserSeemsToBeTSESLint.js","../../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js","../../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/InferTypesFromRule.js","../../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/nullThrows.js","../../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js","../../../node_modules/.pnpm/@typescript-eslint+utils@8.72.1_eslint@9.39.5_jiti@2.6.1_supports-color@7.2.0__supports_2877df148a0882acc0458de6a80f6c02/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js"],"sourcesContent":["import { Array as Arr, Function, Option, Predicate } from \"effect\";\nimport { SyntaxKind } from \"typescript/ast\";\nimport type { Node } from \"typescript/ast\";\nimport {\n isArrayBindingPattern,\n isArrowFunction,\n isBindingElement,\n isCallExpression,\n isClassDeclaration,\n isClassExpression,\n isEnumDeclaration,\n isEnumMember,\n isExpressionStatement,\n isFunctionDeclaration,\n isFunctionExpression,\n isIdentifier,\n isImportClause,\n isImportSpecifier,\n isInterfaceDeclaration,\n isIntersectionTypeNode,\n isJsxAttribute,\n isJsxExpression,\n isJsxOpeningElement,\n isJsxSelfClosingElement,\n isMappedTypeNode,\n isMethodDeclaration,\n isMethodSignatureDeclaration,\n isModuleDeclaration,\n isNamespaceExport,\n isNamespaceExportDeclaration,\n isNamespaceImport,\n isObjectBindingPattern,\n isObjectLiteralExpression,\n isParameterDeclaration,\n isParenthesizedExpression,\n isPropertyAccessExpression,\n isPropertyAssignment,\n isPropertyDeclaration,\n isPropertySignatureDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n isTypeParameterDeclaration,\n isTypeQueryNode,\n isTypeReferenceNode,\n isUnionTypeNode,\n isVariableDeclaration,\n isVariableStatement,\n} from \"typescript/ast/is\";\nimport { JsxEmit, SymbolFlags, TypeFlags } from \"typescript/sync\";\n\nconst FUNCTION_LIKE_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.FunctionDeclaration,\n SyntaxKind.MethodDeclaration,\n SyntaxKind.Constructor,\n SyntaxKind.GetAccessor,\n SyntaxKind.SetAccessor,\n SyntaxKind.FunctionExpression,\n SyntaxKind.ArrowFunction,\n SyntaxKind.MethodSignature,\n SyntaxKind.CallSignature,\n SyntaxKind.JSDocSignature,\n SyntaxKind.ConstructSignature,\n SyntaxKind.IndexSignature,\n SyntaxKind.FunctionType,\n SyntaxKind.ConstructorType,\n]);\n\nconst isFunctionLike = (node: Node | null | undefined): boolean =>\n Option.fromNullishOr(node).pipe(Option.exists(({ kind }) => FUNCTION_LIKE_KINDS.has(kind)));\n\nconst forEachChild: {\n <Result>(visit: (child: Node) => Result | undefined): (node: Node) => Result | undefined;\n <Result>(node: Node, visit: (child: Node) => Result | undefined): Result | undefined;\n} = Function.dual(\n (args) =>\n Arr.head(Arr.fromIterable(args)).pipe(Option.exists(Predicate.not(Predicate.isFunction))),\n <Result>(node: Node, visit: (child: Node) => Result | undefined): Result | undefined =>\n node.forEachChild(visit),\n);\n\nconst ts = {\n forEachChild,\n isArrayBindingPattern,\n isArrowFunction,\n isBindingElement,\n isCallExpression,\n isClassDeclaration,\n isClassExpression,\n isEnumDeclaration,\n isEnumMember,\n isExpressionStatement,\n isFunctionDeclaration,\n isFunctionExpression,\n isFunctionLike,\n isIdentifier,\n isImportClause,\n isImportSpecifier,\n isInterfaceDeclaration,\n isIntersectionTypeNode,\n isJsxAttribute,\n isJsxExpression,\n isJsxOpeningElement,\n isJsxSelfClosingElement,\n isMappedTypeNode,\n isMethodDeclaration,\n isMethodSignature: isMethodSignatureDeclaration,\n isModuleDeclaration,\n isNamespaceExport,\n isNamespaceExportDeclaration,\n isNamespaceImport,\n isObjectBindingPattern,\n isObjectLiteralExpression,\n isParameter: isParameterDeclaration,\n isParenthesizedExpression,\n isPropertyAccessExpression,\n isPropertyAssignment,\n isPropertyDeclaration,\n isPropertySignature: isPropertySignatureDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n isTypeParameterDeclaration,\n isTypeQueryNode,\n isTypeReferenceNode,\n isUnionTypeNode,\n isVariableDeclaration,\n isVariableStatement,\n JsxEmit,\n SymbolFlags,\n SyntaxKind,\n TypeFlags,\n} as const;\n\nexport { forEachChild, isFunctionLike };\nexport {\n isArrayBindingPattern,\n isArrowFunction,\n isBindingElement,\n isCallExpression,\n isClassDeclaration,\n isClassExpression,\n isEnumDeclaration,\n isEnumMember,\n isExpressionStatement,\n isFunctionDeclaration,\n isFunctionExpression,\n isIdentifier,\n isImportClause,\n isImportSpecifier,\n isInterfaceDeclaration,\n isIntersectionTypeNode,\n isJsxAttribute,\n isJsxExpression,\n isJsxOpeningElement,\n isJsxSelfClosingElement,\n isMappedTypeNode,\n isMethodDeclaration,\n isMethodSignatureDeclaration as isMethodSignature,\n isModuleDeclaration,\n isNamespaceExport,\n isNamespaceExportDeclaration,\n isNamespaceImport,\n isObjectBindingPattern,\n isObjectLiteralExpression,\n isParameterDeclaration as isParameter,\n isParenthesizedExpression,\n isPropertyAccessExpression,\n isPropertyAssignment,\n isPropertyDeclaration,\n isPropertySignatureDeclaration as isPropertySignature,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n isTypeParameterDeclaration,\n isTypeQueryNode,\n isTypeReferenceNode,\n isUnionTypeNode,\n isVariableDeclaration,\n isVariableStatement,\n} from \"typescript/ast/is\";\nexport { SyntaxKind } from \"typescript/ast\";\nexport { JsxEmit, SymbolFlags, TypeFlags } from \"typescript/sync\";\nexport default ts;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isObjectNotArray = isObjectNotArray;\nexports.deepMerge = deepMerge;\n/**\n * Check if the variable contains an object strictly rejecting arrays\n * @returns `true` if obj is an object\n */\nfunction isObjectNotArray(obj) {\n return typeof obj === 'object' && obj != null && !Array.isArray(obj);\n}\n/**\n * Pure function - doesn't mutate either parameter!\n * Merges two objects together deeply, overwriting the properties in first with the properties in second\n * @param first The first object\n * @param second The second object\n * @returns a new object\n */\nfunction deepMerge(first = {}, second = {}) {\n // get the unique set of keys across both objects\n const keys = new Set([...Object.keys(first), ...Object.keys(second)]);\n return Object.fromEntries([...keys].map(key => {\n const firstHasKey = key in first;\n const secondHasKey = key in second;\n const firstValue = first[key];\n const secondValue = second[key];\n let value;\n if (firstHasKey && secondHasKey) {\n if (isObjectNotArray(firstValue) && isObjectNotArray(secondValue)) {\n // object type\n value = deepMerge(firstValue, secondValue);\n }\n else {\n // value type\n value = secondValue;\n }\n }\n else if (firstHasKey) {\n value = firstValue;\n }\n else {\n value = secondValue;\n }\n return [key, value];\n }));\n}\n//# sourceMappingURL=deepMerge.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.applyDefault = applyDefault;\nconst deepMerge_1 = require(\"./deepMerge\");\n/**\n * Pure function - doesn't mutate either parameter!\n * Uses the default options and overrides with the options provided by the user\n * @param defaultOptions the defaults\n * @param userOptions the user opts\n * @returns the options with defaults\n */\nfunction applyDefault(defaultOptions, userOptions) {\n // clone defaults\n const options = structuredClone(defaultOptions);\n if (userOptions == null) {\n return options;\n }\n // For avoiding the type error\n // `This expression is not callable. Type 'unknown' has no call signatures.ts(2349)`\n options.forEach((opt, i) => {\n // eslint-disable-next-line @typescript-eslint/internal/eqeq-nullish\n if (userOptions[i] !== undefined) {\n const userOpt = userOptions[i];\n if ((0, deepMerge_1.isObjectNotArray)(userOpt) && (0, deepMerge_1.isObjectNotArray)(opt)) {\n options[i] = (0, deepMerge_1.deepMerge)(opt, userOpt);\n }\n else {\n options[i] = userOpt;\n }\n }\n });\n return options;\n}\n//# sourceMappingURL=applyDefault.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parserSeemsToBeTSESLint = parserSeemsToBeTSESLint;\nfunction parserSeemsToBeTSESLint(parser) {\n return !!parser && /(?:typescript-eslint|\\.\\.)[\\w/\\\\]*parser/.test(parser);\n}\n//# sourceMappingURL=parserSeemsToBeTSESLint.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getParserServices = getParserServices;\nconst parserSeemsToBeTSESLint_1 = require(\"./parserSeemsToBeTSESLint\");\nconst ERROR_MESSAGE_REQUIRES_PARSER_SERVICES = \"You have used a rule which requires type information, but don't have parserOptions set to generate type information for this file. See https://tseslint.com/typed-linting for enabling linting with type information.\";\nconst ERROR_MESSAGE_UNKNOWN_PARSER = 'Note: detected a parser other than @typescript-eslint/parser. Make sure the parser is configured to forward \"parserOptions.project\" to @typescript-eslint/parser.';\nfunction getParserServices(context, allowWithoutFullTypeInformation = false) {\n const parser = \n // eslint-disable-next-line @typescript-eslint/no-deprecated -- For compatibility with ESLint 8\n context.parserPath || context.languageOptions.parser?.meta?.name;\n // This check is unnecessary if the user is using the latest version of our parser.\n //\n // However the world isn't perfect:\n // - Users often use old parser versions.\n // Old versions of the parser would not return any parserServices unless parserOptions.project was set.\n // - Users sometimes use parsers that aren't @typescript-eslint/parser\n // Other parsers won't return the parser services we expect (if they return any at all).\n //\n // This check allows us to handle bad user setups whilst providing a nice user-facing\n // error message explaining the problem.\n if (context.sourceCode.parserServices?.esTreeNodeToTSNodeMap == null ||\n context.sourceCode.parserServices.tsNodeToESTreeNodeMap == null) {\n throwError(parser);\n }\n // if a rule requires full type information, then hard fail if it doesn't exist\n // this forces the user to supply parserOptions.project\n if (context.sourceCode.parserServices.program == null &&\n !allowWithoutFullTypeInformation) {\n throwError(parser);\n }\n return context.sourceCode.parserServices;\n}\n/* eslint-enable @typescript-eslint/unified-signatures */\nfunction throwError(parser) {\n const messages = [\n ERROR_MESSAGE_REQUIRES_PARSER_SERVICES,\n `Parser: ${parser || '(unknown)'}`,\n !(0, parserSeemsToBeTSESLint_1.parserSeemsToBeTSESLint)(parser) && ERROR_MESSAGE_UNKNOWN_PARSER,\n ].filter(Boolean);\n throw new Error(messages.join('\\n'));\n}\n//# sourceMappingURL=getParserServices.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=InferTypesFromRule.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NullThrowsReasons = void 0;\nexports.nullThrows = nullThrows;\n/**\n * A set of common reasons for calling nullThrows\n */\nexports.NullThrowsReasons = {\n MissingParent: 'Expected node to have a parent.',\n MissingToken: (token, thing) => `Expected to find a ${token} for the ${thing}.`,\n};\n/**\n * Assert that a value must not be null or undefined.\n * This is a nice explicit alternative to the non-null assertion operator.\n */\nfunction nullThrows(value, message) {\n if (value == null) {\n throw new Error(`Non-null Assertion Failed: ${message}`);\n }\n return value;\n}\n//# sourceMappingURL=nullThrows.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RuleCreator = RuleCreator;\nconst applyDefault_1 = require(\"./applyDefault\");\n/**\n * Creates reusable function to create rules with default options and docs URLs.\n *\n * @param urlCreator Creates a documentation URL for a given rule name.\n * @returns Function to create a rule with the docs URL format.\n */\nfunction RuleCreator(urlCreator) {\n // This function will get much easier to call when this is merged https://github.com/Microsoft/TypeScript/pull/26349\n // TODO - when the above PR lands; add type checking for the context.report `data` property\n return function createNamedRule({ meta, name, ...rule }) {\n const ruleWithDocs = createRule({\n meta: {\n ...meta,\n docs: {\n ...meta.docs,\n url: urlCreator(name),\n },\n },\n name,\n ...rule,\n });\n return ruleWithDocs;\n };\n}\nfunction createRule({ create, \n// Keep accepting deprecated defaultOptions for backward compatibility.\n// eslint-disable-next-line @typescript-eslint/no-deprecated\ndefaultOptions, meta, name, }) {\n const resolvedDefaultOptions = (meta.defaultOptions ??\n defaultOptions ??\n []);\n return {\n create(context) {\n const optionsWithDefault = (0, applyDefault_1.applyDefault)(resolvedDefaultOptions, context.options);\n return create(context, optionsWithDefault);\n },\n // eslint-disable-next-line @typescript-eslint/no-deprecated -- For compatibility with ESLint 8, see #12842\n defaultOptions,\n meta,\n name,\n };\n}\n/**\n * Creates a well-typed TSESLint custom ESLint rule without a docs URL.\n *\n * @returns Well-typed TSESLint custom ESLint rule.\n * @remarks It is generally better to provide a docs URL function to RuleCreator.\n */\nRuleCreator.withoutDocs = function withoutDocs(args) {\n return createRule(args);\n};\n//# sourceMappingURL=RuleCreator.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./applyDefault\"), exports);\n__exportStar(require(\"./deepMerge\"), exports);\n__exportStar(require(\"./getParserServices\"), exports);\n__exportStar(require(\"./InferTypesFromRule\"), exports);\n__exportStar(require(\"./nullThrows\"), exports);\n__exportStar(require(\"./RuleCreator\"), exports);\n//# sourceMappingURL=index.js.map"],"ignoreList":[1,2,3,4,5,6,7,8],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,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
|
1
|
+
import { Record } from "effect";
|
|
2
|
+
import { Node, SourceFile } from "typescript/ast";
|
|
3
|
+
import { CompilerOptions, Project, Symbol, SymbolFlags, Type, TypeFlags } from "typescript/sync";
|
|
4
4
|
import { Context, CreateRule, Location, Range, RuleMeta, Visitor } from "vite-plus/lint/plugins";
|
|
5
|
-
interface
|
|
5
|
+
interface LegacySymbol {
|
|
6
|
+
readonly getName: () => string;
|
|
7
|
+
readonly getDeclarations: () => readonly Node[];
|
|
8
|
+
}
|
|
9
|
+
declare class CompatSymbol implements LegacySymbol {
|
|
10
|
+
#private;
|
|
6
11
|
readonly native: Symbol;
|
|
7
12
|
readonly flags: SymbolFlags;
|
|
8
13
|
readonly name: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
private constructor();
|
|
15
|
+
static intern(project: Project, native: Symbol): CompatSymbol;
|
|
16
|
+
static optional(project: Project, native: Symbol | undefined): CompatSymbol | undefined;
|
|
17
|
+
get declarations(): readonly Node[];
|
|
18
|
+
getName(): string;
|
|
19
|
+
getDeclarations(): readonly Node[];
|
|
20
|
+
}
|
|
21
|
+
interface PseudoBigInt {
|
|
22
|
+
readonly negative: boolean;
|
|
23
|
+
readonly base10Value: string;
|
|
24
|
+
}
|
|
25
|
+
type LiteralValue = string | number | boolean | PseudoBigInt;
|
|
26
|
+
interface LegacyType {
|
|
27
|
+
readonly symbol: CompatSymbol | undefined;
|
|
28
|
+
readonly aliasSymbol: CompatSymbol | undefined;
|
|
29
|
+
readonly types: readonly CompatType[];
|
|
30
|
+
readonly getProperty: (name: string) => CompatSymbol | undefined;
|
|
31
|
+
readonly getProperties: () => readonly CompatSymbol[];
|
|
32
|
+
}
|
|
33
|
+
declare class CompatType implements LegacyType {
|
|
34
|
+
#private;
|
|
35
|
+
readonly native: Type;
|
|
36
|
+
readonly flags: TypeFlags;
|
|
37
|
+
readonly intrinsicName: string | undefined;
|
|
38
|
+
readonly value: LiteralValue | undefined;
|
|
39
|
+
readonly isUnion: () => boolean;
|
|
40
|
+
readonly isLiteral: () => boolean;
|
|
41
|
+
readonly isStringLiteral: () => boolean;
|
|
42
|
+
readonly isNumberLiteral: () => boolean;
|
|
43
|
+
private constructor();
|
|
44
|
+
static intern(project: Project, native: Type): CompatType;
|
|
45
|
+
get symbol(): CompatSymbol | undefined;
|
|
46
|
+
get aliasSymbol(): CompatSymbol | undefined;
|
|
47
|
+
get types(): readonly CompatType[];
|
|
48
|
+
getProperty(name: string): CompatSymbol | undefined;
|
|
49
|
+
getProperties(): readonly CompatSymbol[];
|
|
12
50
|
}
|
|
13
51
|
interface CompatChecker {
|
|
14
52
|
readonly getSymbolAtLocation: (node: Node) => CompatSymbol | undefined;
|
|
15
53
|
readonly getAliasedSymbol: (symbol: CompatSymbol) => CompatSymbol;
|
|
54
|
+
readonly getTypeAtLocation: (node: Node) => CompatType;
|
|
55
|
+
readonly getTypeOfSymbol: (symbol: CompatSymbol) => CompatType;
|
|
56
|
+
readonly getBaseConstraintOfType: (type: CompatType) => CompatType | undefined;
|
|
57
|
+
readonly getFullyQualifiedName: (symbol: CompatSymbol) => string;
|
|
16
58
|
}
|
|
17
59
|
interface CompatProgram {
|
|
18
60
|
readonly getSourceFile: (fileName: string) => SourceFile | undefined;
|
|
19
61
|
readonly getSourceFiles: () => readonly SourceFile[];
|
|
20
62
|
readonly getTypeChecker: () => CompatChecker;
|
|
63
|
+
readonly getCompilerOptions: () => CompilerOptions;
|
|
21
64
|
}
|
|
22
65
|
interface RangedNode {
|
|
23
66
|
readonly range: Readonly<Range>;
|
|
@@ -35,17 +78,15 @@ interface ParserServices {
|
|
|
35
78
|
readonly tsNodeToESTreeNodeMap: {
|
|
36
79
|
readonly get: (node: Node) => MappedNode | undefined;
|
|
37
80
|
};
|
|
81
|
+
readonly getTypeAtLocation: (node: RangedNode) => CompatType;
|
|
82
|
+
readonly getSymbolAtLocation: (node: RangedNode) => CompatSymbol | undefined;
|
|
38
83
|
}
|
|
39
|
-
|
|
40
|
-
readonly
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
readonly
|
|
44
|
-
|
|
45
|
-
readonly sourceCode: {
|
|
46
|
-
readonly parserServices: ParserServices;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
84
|
+
type TypedSourceCode = Context["sourceCode"] & {
|
|
85
|
+
readonly parserServices: ParserServices | undefined;
|
|
86
|
+
};
|
|
87
|
+
type TypedContext = Omit<Context, "sourceCode"> & {
|
|
88
|
+
readonly sourceCode: TypedSourceCode;
|
|
89
|
+
};
|
|
49
90
|
interface TypedRule {
|
|
50
91
|
readonly meta: RuleMeta;
|
|
51
92
|
readonly create: (context: TypedContext) => Visitor;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { n as typedRules, i as withTypeInformation } from "./typed-rule-D8jasU_z.mjs";
|
package/dist/react.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Record } from "effect";
|
|
2
|
+
import { Plugin } from "vite-plus/lint/plugins";
|
|
3
|
+
interface Config {
|
|
4
|
+
readonly rules?: Readonly<Record<string, unknown>> | undefined;
|
|
5
|
+
}
|
|
6
|
+
type ReactPlugin = Plugin & {
|
|
7
|
+
readonly meta: {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
};
|
|
10
|
+
readonly configs: Readonly<Record<string, Config>>;
|
|
11
|
+
};
|
|
12
|
+
declare const plugin: ReactPlugin;
|
|
13
|
+
export { type Config, type ReactPlugin, plugin as default };
|
|
14
|
+
//# sourceMappingURL=react.d.mts.map
|