@r_masseater/oxlint-typed-rules 0.4.3 → 0.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.
Files changed (32) hide show
  1. package/README.md +9 -1
  2. package/dist/config-rules-Buk48gLL.mjs +6 -0
  3. package/dist/config-rules-Buk48gLL.mjs.map +1 -0
  4. package/dist/drizzle.mjs +2 -2
  5. package/dist/{eslint-utils-ujGlgEMD.mjs → eslint-utils-BF_HFO08.mjs} +14 -14
  6. package/dist/{eslint-utils-ujGlgEMD.mjs.map → eslint-utils-BF_HFO08.mjs.map} +1 -1
  7. package/dist/index.d.mts +9 -8
  8. package/dist/index.mjs +1 -1
  9. package/dist/react.mjs +311 -322
  10. package/dist/react.mjs.map +1 -1
  11. package/dist/remotion.mjs +3 -3
  12. package/dist/remotion.mjs.map +1 -1
  13. package/dist/tanstack-query.mjs +199 -199
  14. package/dist/tanstack-query.mjs.map +1 -1
  15. package/dist/tanstack-router.mjs +11 -11
  16. package/dist/tanstack-router.mjs.map +1 -1
  17. package/dist/tanstack-start.mjs +35 -34
  18. package/dist/tanstack-start.mjs.map +1 -1
  19. package/dist/{typed-rule-DFpV2XgE.mjs → typed-rule-FCRt1nKZ.mjs} +25 -52
  20. package/dist/typed-rule-FCRt1nKZ.mjs.map +1 -0
  21. package/dist/{typescript-eslint-utils-C6OO2FjX.mjs → typescript-eslint-utils-C7ew0-XM.mjs} +2 -2
  22. package/dist/{typescript-eslint-utils-C6OO2FjX.mjs.map → typescript-eslint-utils-C7ew0-XM.mjs.map} +1 -1
  23. package/dist/{upstream-plugin-D4Lz9A1H.mjs → upstream-plugin-eT7t_K7e.mjs} +3 -4
  24. package/dist/upstream-plugin-eT7t_K7e.mjs.map +1 -0
  25. package/dist/version-BMMFrB-m.mjs +83 -0
  26. package/dist/version-BMMFrB-m.mjs.map +1 -0
  27. package/package.json +28 -27
  28. package/skills/run-typed-eslint-rules/SKILL.md +30 -2
  29. package/dist/ts-compat-CFDky9Ie.mjs +0 -132
  30. package/dist/ts-compat-CFDky9Ie.mjs.map +0 -1
  31. package/dist/typed-rule-DFpV2XgE.mjs.map +0 -1
  32. package/dist/upstream-plugin-D4Lz9A1H.mjs.map +0 -1
@@ -1,18 +1,10 @@
1
- import { Array, BigInt, Cause, Effect, Exit, Layer, ManagedRuntime, Match, Option, Predicate, Record, String as String$1, pipe } from "effect";
1
+ import { Array, BigInt, Cause, Effect, Exit, Function, Layer, ManagedRuntime, Match, Option, Predicate, Record, String as String$1, pipe } from "effect";
2
2
  import { FetchHttpClient } from "effect/http";
3
3
  import { OtlpSerialization, OtlpTracer } from "effect/observability";
4
- import { createFileSystemLayer } from "typescript/fs";
5
- import { API } from "typescript/sync";
6
- import { SyntaxKind } from "typescript/ast";
4
+ import { createFileSystemLayer } from "tsrs/fs";
5
+ import { API } from "tsrs/sync";
6
+ import { SyntaxKind } from "tsrs/ast";
7
7
  // src/shared/lib/memo.ts
8
- const memoizeByKey = (compute) => {
9
- const cache = /* @__PURE__ */ new WeakMap();
10
- return (key) => Option.fromNullishOr(cache.get(key)).pipe(Option.getOrElse(() => {
11
- const computed = compute(key);
12
- cache.set(key, computed);
13
- return computed;
14
- }));
15
- };
16
8
  const lazily = (compute) => {
17
9
  const cell = {};
18
10
  return () => {
@@ -39,11 +31,7 @@ var CompatSymbol = class CompatSymbol {
39
31
  this.name = native.name;
40
32
  }
41
33
  static intern(project, native) {
42
- return Option.fromNullishOr(CompatSymbol.#interned.get(native)).pipe(Option.getOrElse(() => {
43
- const created = new CompatSymbol(project, native);
44
- CompatSymbol.#interned.set(native, created);
45
- return created;
46
- }));
34
+ return CompatSymbol.#interned.getOrInsertComputed(native, () => new CompatSymbol(project, native));
47
35
  }
48
36
  static optional(project, native) {
49
37
  return Option.fromNullishOr(native).pipe(Option.map((symbol) => CompatSymbol.intern(project, symbol)), Option.getOrUndefined);
@@ -52,12 +40,8 @@ var CompatSymbol = class CompatSymbol {
52
40
  this.#declarations ??= resolveAll(this.#project, this.native.declarations);
53
41
  return this.#declarations;
54
42
  }
55
- getName() {
56
- return this.name;
57
- }
58
- getDeclarations() {
59
- return this.declarations;
60
- }
43
+ getName = () => this.name;
44
+ getDeclarations = () => this.declarations;
61
45
  };
62
46
  // src/shared/lib/compat-type.ts
63
47
  const ZERO = 0n;
@@ -94,11 +78,7 @@ var CompatType = class CompatType {
94
78
  this.isNumberLiteral = native.isNumberLiteralType.bind(native);
95
79
  }
96
80
  static intern(project, native) {
97
- return Option.fromNullishOr(CompatType.#interned.get(native)).pipe(Option.getOrElse(() => {
98
- const created = new CompatType(project, native);
99
- CompatType.#interned.set(native, created);
100
- return created;
101
- }));
81
+ return CompatType.#interned.getOrInsertComputed(native, () => new CompatType(project, native));
102
82
  }
103
83
  static optional(project, native) {
104
84
  return Option.fromNullishOr(native).pipe(Option.map((type) => CompatType.intern(project, type)), Option.getOrUndefined);
@@ -120,23 +100,19 @@ var CompatType = class CompatType {
120
100
  this.#types ??= pipe(constituentsOf(this.native), Array.map((member) => CompatType.intern(project, member)));
121
101
  return this.#types;
122
102
  }
123
- getSymbol() {
124
- return this.symbol;
125
- }
126
- getProperty(name) {
127
- return CompatSymbol.optional(this.#project, this.native.getProperty(name));
128
- }
129
- getProperties() {
103
+ getSymbol = () => this.symbol;
104
+ getProperty = (name) => CompatSymbol.optional(this.#project, this.native.getProperty(name));
105
+ getProperties = () => {
130
106
  const project = this.#project;
131
107
  return pipe(this.native.getProperties(), Array.map((property) => CompatSymbol.intern(project, property)));
132
- }
133
- getCallSignatures() {
108
+ };
109
+ getCallSignatures = () => {
134
110
  const project = this.#project;
135
111
  return pipe(this.native.getCallSignatures(), Array.map((signature) => ({
136
112
  native: signature,
137
113
  getReturnType: () => CompatType.intern(project, signature.getReturnType())
138
114
  })));
139
- }
115
+ };
140
116
  };
141
117
  // src/shared/lib/compat.ts
142
118
  const compatChecker = (project, checker) => ({
@@ -150,12 +126,13 @@ const compatChecker = (project, checker) => ({
150
126
  typeToString: (type) => checker.typeToString(type.native)
151
127
  });
152
128
  const isOwnSourceFile = (fileName) => !String$1.includes("/node_modules/")(fileName) && !String$1.endsWith(".d.ts")(fileName);
153
- const ownSourceFiles = memoizeByKey((program) => pipe(program.getSourceFileNames(), Array.filter(isOwnSourceFile), Array.flatMap((fileName) => Option.fromNullishOr(program.getSourceFile(fileName)).pipe(Option.toArray))));
129
+ const ownSourceFiles = Function.memoize((program) => pipe(program.getSourceFileNames(), Array.filter(isOwnSourceFile), Array.flatMap((fileName) => Option.fromNullishOr(program.getSourceFile(fileName)).pipe(Option.toArray))));
154
130
  const compatPrograms = /* @__PURE__ */ new WeakMap();
155
131
  const internProgram = (project) => Option.fromNullishOr(compatPrograms.get(project.program)).pipe(Option.getOrElse(() => {
156
132
  const { program } = project;
157
133
  const checker = compatChecker(project, project.checker);
158
134
  const created = {
135
+ native: project,
159
136
  getSourceFile: program.getSourceFile.bind(program),
160
137
  getSourceFiles: () => ownSourceFiles(program),
161
138
  getTypeChecker: () => checker,
@@ -177,14 +154,10 @@ const startApi = () => {
177
154
  };
178
155
  const api = startApi();
179
156
  const snapshots = /* @__PURE__ */ new Map([[api, api.createSnapshot()]]);
180
- const currentSnapshot = () => Option.fromNullishOr(snapshots.get(api)).pipe(Option.getOrElse(() => {
181
- const created = api.createSnapshot();
182
- snapshots.set(api, created);
183
- return created;
184
- }));
157
+ const currentSnapshot = () => snapshots.getOrInsertComputed(api, () => api.createSnapshot());
185
158
  const matchesText = (project, overlay) => Option.fromNullishOr(project.program.getSourceFile(overlay.fileName)).pipe(Option.exists((sourceFile) => sourceFile.text === overlay.text));
186
159
  const directoryOf = (fileName) => String$1.replace(/[\\/][^\\/]*$/u, "")(fileName);
187
- const directoryProjects = memoizeByKey((_snapshot) => /* @__PURE__ */ new Map());
160
+ const directoryProjects = Function.memoize((_snapshot) => /* @__PURE__ */ new Map());
188
161
  const defaultProject = (snapshot, fileName) => Option.fromNullishOr(snapshot.getDefaultProjectForFile(fileName)).pipe(Option.map((project) => {
189
162
  directoryProjects(snapshot).set(directoryOf(fileName), project);
190
163
  return project;
@@ -235,16 +208,16 @@ const toMappedNode = ({ context }, node) => {
235
208
  };
236
209
  const rangeKey = ([start, end]) => `${String(start)}:${String(end)}`;
237
210
  const isRangedNode = (value) => Predicate.hasProperty(value, "type") && Predicate.isString(value.type) && Predicate.hasProperty(value, "range") && Array.isArray(value.range);
238
- const childNodesOf = (node, keys) => pipe(keys, Array.flatMap((key) => {
239
- const child = Reflect.get(node, key);
240
- return Array.ensure(child);
241
- }), Array.filter(isRangedNode));
211
+ const childNodesOf = (node, keys) => pipe(keys, Array.flatMap((key) => pipe(Option.liftPredicate(node, Predicate.hasProperty(key)), Option.match({
212
+ onNone: () => [],
213
+ onSome: (found) => Array.ensure(found[key])
214
+ }))), Array.filter(isRangedNode));
242
215
  const esTreeIndex = ({ context }) => {
243
216
  const index = /* @__PURE__ */ new Map();
244
217
  const { visitorKeys } = context.sourceCode;
245
218
  const visit = (node) => {
246
219
  const key = rangeKey(node.range);
247
- if (!index.has(key)) index.set(key, node);
220
+ index.getOrInsert(key, node);
248
221
  for (const child of childNodesOf(node, visitorKeys[node.type] ?? [])) visit(child);
249
222
  };
250
223
  visit(context.sourceCode.ast);
@@ -252,7 +225,7 @@ const esTreeIndex = ({ context }) => {
252
225
  };
253
226
  const createParserServices = (file) => {
254
227
  const esTreeNodes = lazily(() => esTreeIndex(file));
255
- const toTSNode = memoizeByKey((node) => innermostSpanning(file.sourceFile, node.range));
228
+ const toTSNode = Function.memoize((node) => innermostSpanning(file.sourceFile, node.range));
256
229
  const checker = file.program.getTypeChecker();
257
230
  const toESTreeNode = (node) => {
258
231
  const key = rangeKey([node.getStart(), node.end]);
@@ -297,4 +270,4 @@ const typedRules = (rules) => pipe(rules, Record.filter(isTypedRule), Record.map
297
270
  const optionallyTypedRules = (rules) => pipe(rules, Record.filter(isTypedRule), Record.map(withOptionalTypeInformation));
298
271
  export { withTypeInformation as a, withOptionalTypeInformation as i, optionallyTypedRules as n, typedRules as r, isTypedRule as t };
299
272
 
300
- //# sourceMappingURL=typed-rule-DFpV2XgE.mjs.map
273
+ //# sourceMappingURL=typed-rule-FCRt1nKZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-rule-FCRt1nKZ.mjs","names":["Arr","BigInt_","Arr","Str","Fn","Arr","Str","Fn","Arr","Fn"],"sources":["../src/shared/lib/memo.ts","../src/shared/lib/compat-symbol.ts","../src/shared/lib/compat-type.ts","../src/shared/lib/compat.ts","../src/shared/lib/program.ts","../src/entities/typed-rule/model/parser-services.ts","../src/entities/typed-rule/model/typed-rule.ts"],"sourcesContent":["import { Option } from \"effect\";\n\nexport const lazily = <Value>(compute: () => Value): (() => Value) => {\n const cell: { value?: Option.Option<Value> } = {};\n return () => {\n const cached = Option.flatten(Option.fromNullishOr(cell.value));\n if (Option.isSome(cached)) {\n return cached.value;\n }\n const computed = compute();\n cell.value = Option.some(computed);\n return computed;\n };\n};\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport type { Node } from \"tsrs/ast\";\nimport type { NodeHandle, Project, Symbol as NativeSymbol, SymbolFlags } from \"tsrs/sync\";\n\nconst resolveAll = (project: Project, handles: readonly NodeHandle[]): readonly Node[] =>\n pipe(\n handles,\n Arr.flatMap((handle) => Option.fromNullishOr(handle.resolve(project)).pipe(Option.toArray)),\n );\n\nexport interface LegacySymbol {\n readonly getName: () => string;\n readonly getDeclarations: () => readonly Node[];\n}\n\nexport class CompatSymbol implements LegacySymbol {\n static readonly #interned = new WeakMap<NativeSymbol, CompatSymbol>();\n\n public readonly native: NativeSymbol;\n\n public readonly flags: SymbolFlags;\n\n public readonly name: string;\n\n readonly #project: Project;\n\n #declarations: readonly Node[] | undefined;\n\n private constructor(project: Project, native: NativeSymbol) {\n this.#project = project;\n this.native = native;\n this.flags = native.flags;\n this.name = native.name;\n }\n\n public static intern(project: Project, native: NativeSymbol): CompatSymbol {\n return CompatSymbol.#interned.getOrInsertComputed(\n native,\n () => new CompatSymbol(project, native),\n );\n }\n\n public static optional(\n project: Project,\n native: NativeSymbol | undefined,\n ): CompatSymbol | undefined {\n return Option.fromNullishOr(native).pipe(\n Option.map((symbol) => CompatSymbol.intern(project, symbol)),\n Option.getOrUndefined,\n );\n }\n\n public get declarations(): readonly Node[] {\n this.#declarations ??= resolveAll(this.#project, this.native.declarations);\n return this.#declarations;\n }\n\n public readonly getName = (): string => this.name;\n\n public readonly getDeclarations = (): readonly Node[] => this.declarations;\n}\n","import { Array as Arr, BigInt as BigInt_, Match, Option, Predicate, pipe } from \"effect\";\nimport type {\n Project,\n Signature as NativeSignature,\n Type as NativeType,\n TypeFlags,\n UnionOrIntersectionType,\n} from \"tsrs/sync\";\n\nimport { CompatSymbol } from \"./compat-symbol.ts\";\n\nexport interface PseudoBigInt {\n readonly negative: boolean;\n readonly base10Value: string;\n}\n\nexport type LiteralValue = string | number | boolean | PseudoBigInt;\n\nconst ZERO = 0n;\n\nconst pseudoBigInt = (value: bigint): PseudoBigInt => ({\n negative: value < ZERO,\n base10Value: BigInt_.abs(value).toString(),\n});\n\nconst literalValueOf = (native: NativeType): Option.Option<LiteralValue> =>\n Option.liftPredicate(native, (type) => type.isLiteralType()).pipe(\n Option.map(({ value }) =>\n Match.value(value).pipe(\n Match.when(Predicate.isBigInt, pseudoBigInt),\n Match.orElse((primitive) => primitive),\n ),\n ),\n );\n\nconst isUnionOrIntersection = (type: NativeType): type is UnionOrIntersectionType =>\n type.isUnionType() || type.isIntersectionType();\n\nconst constituentsOf = (native: NativeType): readonly NativeType[] =>\n Option.liftPredicate(native, isUnionOrIntersection).pipe(\n Option.map((type) => type.getTypes()),\n Option.getOrElse((): readonly NativeType[] => []),\n );\n\nexport interface CompatSignature {\n readonly native: NativeSignature;\n readonly getReturnType: () => CompatType;\n}\n\nexport interface LegacyType {\n readonly symbol: CompatSymbol | undefined;\n readonly aliasSymbol: CompatSymbol | undefined;\n readonly types: readonly CompatType[];\n readonly getSymbol: () => CompatSymbol | undefined;\n readonly getProperty: (name: string) => CompatSymbol | undefined;\n readonly getProperties: () => readonly CompatSymbol[];\n readonly getCallSignatures: () => readonly CompatSignature[];\n}\n\nexport class CompatType implements LegacyType {\n static readonly #interned = new WeakMap<NativeType, CompatType>();\n\n public readonly native: NativeType;\n\n public readonly flags: TypeFlags;\n\n public readonly intrinsicName: string | undefined;\n\n public readonly value: LiteralValue | undefined;\n\n public readonly isUnion: () => boolean;\n\n public readonly isLiteral: () => boolean;\n\n public readonly isStringLiteral: () => boolean;\n\n public readonly isNumberLiteral: () => boolean;\n\n readonly #project: Project;\n\n #symbol: Option.Option<CompatSymbol | undefined> = Option.none();\n\n #aliasSymbol: Option.Option<CompatSymbol | undefined> = Option.none();\n\n #types: readonly CompatType[] | undefined;\n\n private constructor(project: Project, native: NativeType) {\n this.#project = project;\n this.native = native;\n this.flags = native.flags;\n this.intrinsicName = Option.liftPredicate(native, (type) => type.isIntrinsicType()).pipe(\n Option.map(({ intrinsicName }) => intrinsicName),\n Option.getOrUndefined,\n );\n this.value = Option.getOrUndefined(literalValueOf(native));\n this.isUnion = native.isUnionType.bind(native);\n this.isLiteral = native.isLiteralType.bind(native);\n this.isStringLiteral = native.isStringLiteralType.bind(native);\n this.isNumberLiteral = native.isNumberLiteralType.bind(native);\n }\n\n public static intern(project: Project, native: NativeType): CompatType {\n return CompatType.#interned.getOrInsertComputed(native, () => new CompatType(project, native));\n }\n\n public static optional(project: Project, native: NativeType | undefined): CompatType | undefined {\n return Option.fromNullishOr(native).pipe(\n Option.map((type) => CompatType.intern(project, type)),\n Option.getOrUndefined,\n );\n }\n\n public get symbol(): CompatSymbol | undefined {\n const { native } = this;\n const project = this.#project;\n this.#symbol = Option.orElse(this.#symbol, () =>\n Option.some(CompatSymbol.optional(project, native.getSymbol())),\n );\n return Option.getOrUndefined(this.#symbol);\n }\n\n public get aliasSymbol(): CompatSymbol | undefined {\n const { native } = this;\n const project = this.#project;\n this.#aliasSymbol = Option.orElse(this.#aliasSymbol, () =>\n Option.some(CompatSymbol.optional(project, native.getAliasSymbol())),\n );\n return Option.getOrUndefined(this.#aliasSymbol);\n }\n\n public get types(): readonly CompatType[] {\n const project = this.#project;\n this.#types ??= pipe(\n constituentsOf(this.native),\n Arr.map((member) => CompatType.intern(project, member)),\n );\n return this.#types;\n }\n\n public readonly getSymbol = (): CompatSymbol | undefined => this.symbol;\n\n public readonly getProperty = (name: string): CompatSymbol | undefined =>\n CompatSymbol.optional(this.#project, this.native.getProperty(name));\n\n public readonly getProperties = (): readonly CompatSymbol[] => {\n const project = this.#project;\n return pipe(\n this.native.getProperties(),\n Arr.map((property) => CompatSymbol.intern(project, property)),\n );\n };\n\n public readonly getCallSignatures = (): readonly CompatSignature[] => {\n const project = this.#project;\n return pipe(\n this.native.getCallSignatures(),\n Arr.map((signature): CompatSignature => ({\n native: signature,\n getReturnType: () => CompatType.intern(project, signature.getReturnType()),\n })),\n );\n };\n}\n","import { Array as Arr, Function as Fn, Option, pipe, String as Str } from \"effect\";\nimport type { Node, SourceFile } from \"tsrs/ast\";\nimport type { Checker, CompilerOptions, Program as NativeProgram, Project } from \"tsrs/sync\";\n\nimport { CompatSymbol } from \"./compat-symbol.ts\";\nimport { CompatType } from \"./compat-type.ts\";\n\nexport interface CompatChecker {\n readonly getSymbolAtLocation: (node: Node) => CompatSymbol | undefined;\n readonly getAliasedSymbol: (symbol: CompatSymbol) => CompatSymbol;\n readonly getTypeAtLocation: (node: Node) => CompatType;\n readonly getTypeOfSymbol: (symbol: CompatSymbol) => CompatType;\n readonly getBaseConstraintOfType: (type: CompatType) => CompatType | undefined;\n readonly getAwaitedType: (type: CompatType) => CompatType | undefined;\n readonly getFullyQualifiedName: (symbol: CompatSymbol) => string;\n readonly typeToString: (type: CompatType) => string;\n}\n\nexport interface CompatProgram {\n readonly native: Project;\n readonly getSourceFile: (fileName: string) => SourceFile | undefined;\n readonly getSourceFiles: () => readonly SourceFile[];\n readonly getTypeChecker: () => CompatChecker;\n readonly getCompilerOptions: () => CompilerOptions;\n}\n\nconst compatChecker = (project: Project, checker: Checker): CompatChecker => ({\n getSymbolAtLocation: (node) => CompatSymbol.optional(project, checker.getSymbolAtLocation(node)),\n getAliasedSymbol: (symbol) =>\n CompatSymbol.intern(project, checker.getAliasedSymbol(symbol.native)),\n getTypeAtLocation: (node) => CompatType.intern(project, checker.getTypeAtLocation(node)),\n getTypeOfSymbol: (symbol) => CompatType.intern(project, checker.getTypeOfSymbol(symbol.native)),\n getBaseConstraintOfType: (type) =>\n CompatType.optional(project, checker.getBaseConstraintOfType(type.native)),\n getAwaitedType: (type) => CompatType.optional(project, checker.getAwaitedType(type.native)),\n getFullyQualifiedName: (symbol) => checker.getFullyQualifiedName(symbol.native),\n typeToString: (type) => checker.typeToString(type.native),\n});\n\nconst isOwnSourceFile = (fileName: string): boolean =>\n !Str.includes(\"/node_modules/\")(fileName) && !Str.endsWith(\".d.ts\")(fileName);\n\nconst ownSourceFiles = Fn.memoize((program: NativeProgram): readonly SourceFile[] =>\n pipe(\n program.getSourceFileNames(),\n Arr.filter(isOwnSourceFile),\n Arr.flatMap((fileName) =>\n Option.fromNullishOr(program.getSourceFile(fileName)).pipe(Option.toArray),\n ),\n ),\n);\n\nconst compatPrograms = new WeakMap<NativeProgram, CompatProgram>();\n\nexport const internProgram = (project: Project): CompatProgram =>\n Option.fromNullishOr(compatPrograms.get(project.program)).pipe(\n Option.getOrElse(() => {\n const { program } = project;\n const checker = compatChecker(project, project.checker);\n const created: CompatProgram = {\n native: project,\n getSourceFile: program.getSourceFile.bind(program),\n getSourceFiles: () => ownSourceFiles(program),\n getTypeChecker: () => checker,\n getCompilerOptions: program.getCompilerOptions.bind(program),\n };\n compatPrograms.set(program, created);\n return created;\n }),\n );\n","import {\n Cause,\n Effect,\n Exit,\n Function as Fn,\n Layer,\n ManagedRuntime,\n Option,\n String as Str,\n} from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { OtlpSerialization, OtlpTracer } from \"effect/observability\";\nimport { createFileSystemLayer } from \"tsrs/fs\";\nimport { API } from \"tsrs/sync\";\nimport type { Project, Snapshot } from \"tsrs/sync\";\n\nimport { internProgram } from \"./compat.ts\";\nimport type { CompatProgram } from \"./compat.ts\";\n\nconst tracing = OtlpTracer.layerFromConfig({\n resource: { serviceName: \"oxlint-typed-rules\" },\n}).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer));\n\nconst runtime = ManagedRuntime.make(tracing);\n\nexport interface Overlay {\n readonly fileName: string;\n readonly text: string;\n}\n\nconst startApi = (): API => {\n const started = new API();\n process.once(\"beforeExit\", () => {\n started.close();\n Effect.runFork(runtime.disposeEffect);\n });\n return started;\n};\n\nconst api = startApi();\n\nconst snapshots = new Map<API, Snapshot>([[api, api.createSnapshot()]]);\n\nconst currentSnapshot = (): Snapshot =>\n snapshots.getOrInsertComputed(api, () => api.createSnapshot());\n\nconst matchesText = (project: Project, overlay: Overlay): boolean =>\n Option.fromNullishOr(project.program.getSourceFile(overlay.fileName)).pipe(\n Option.exists((sourceFile) => sourceFile.text === overlay.text),\n );\n\nconst directoryOf = (fileName: string): string => Str.replace(/[\\\\/][^\\\\/]*$/u, \"\")(fileName);\n\nconst directoryProjects = Fn.memoize(\n (_snapshot: Snapshot): Map<string, Project> => new Map<string, Project>(),\n);\n\nconst defaultProject = (snapshot: Snapshot, fileName: string): Option.Option<Project> =>\n Option.fromNullishOr(snapshot.getDefaultProjectForFile(fileName)).pipe(\n Option.map((project) => {\n directoryProjects(snapshot).set(directoryOf(fileName), project);\n return project;\n }),\n );\n\nconst currentProject = (overlay: Overlay): Option.Option<Project> => {\n const snapshot = currentSnapshot();\n return Option.fromNullishOr(directoryProjects(snapshot).get(directoryOf(overlay.fileName))).pipe(\n Option.filter((project) => matchesText(project, overlay)),\n Option.orElse(() =>\n defaultProject(snapshot, overlay.fileName).pipe(\n Option.filter((project) => matchesText(project, overlay)),\n ),\n ),\n );\n};\n\nconst openFile = (overlay: Overlay): Effect.Effect<Option.Option<Project>> =>\n Effect.sync(() => {\n const updated = currentSnapshot().update({\n openFiles: [overlay.fileName],\n fileSystem: createFileSystemLayer([[overlay.fileName, overlay.text]]),\n });\n snapshots.set(api, updated);\n return defaultProject(updated, overlay.fileName);\n }).pipe(\n Effect.withSpan(\"oxlint-typed-rules.open-file\", {\n attributes: { fileName: overlay.fileName },\n }),\n );\n\nconst projectOfFile = (overlay: Overlay): Effect.Effect<Option.Option<Project>> =>\n Effect.suspend(() =>\n Option.match(currentProject(overlay), {\n onSome: Effect.succeedSome,\n onNone: () => openFile(overlay),\n }),\n );\n\nexport const programFor = (overlay: Overlay): Option.Option<CompatProgram> =>\n Exit.match(runtime.runSyncExit(projectOfFile(overlay)), {\n onSuccess: Option.map(internProgram),\n onFailure: (cause) => {\n throw Cause.squash(cause);\n },\n });\n","import { Array as Arr, Function as Fn, Option, Predicate, pipe } from \"effect\";\nimport { SyntaxKind } from \"tsrs/ast\";\nimport type { Node, SourceFile } from \"tsrs/ast\";\nimport type { Context, Location, Range } from \"vite-plus/lint/plugins\";\n\nimport type { CompatSymbol } from \"#/shared/lib/compat-symbol.ts\";\nimport type { CompatType } from \"#/shared/lib/compat-type.ts\";\nimport type { CompatProgram } from \"#/shared/lib/compat.ts\";\nimport { lazily } from \"#/shared/lib/memo.ts\";\n\nexport interface RangedNode {\n readonly range: Readonly<Range>;\n}\n\nexport interface MappedNode {\n readonly type: string;\n readonly range: Readonly<Range>;\n readonly loc: Location;\n}\n\nexport interface ParserServices {\n readonly program: CompatProgram;\n readonly esTreeNodeToTSNodeMap: { readonly get: (node: RangedNode) => Node };\n readonly tsNodeToESTreeNodeMap: {\n readonly get: (node: Node) => MappedNode | undefined;\n };\n readonly getTypeAtLocation: (node: RangedNode) => CompatType;\n readonly getSymbolAtLocation: (node: RangedNode) => CompatSymbol | undefined;\n}\n\nexport interface FileProgram {\n readonly context: Context;\n readonly program: CompatProgram;\n readonly sourceFile: SourceFile;\n}\n\nconst covers = (node: Node, [start, end]: Readonly<Range>): boolean =>\n node.getStart() <= start && node.end >= end;\n\nconst spans = (node: Node, [start, end]: Readonly<Range>): boolean =>\n node.getStart() === start && node.end === end;\n\nconst innermostSpanning = (sourceFile: SourceFile, range: Readonly<Range>): Node => {\n const visit = (node: Node, found: Node): Node => {\n if (!covers(node, range)) {\n return found;\n }\n const matched = Option.liftPredicate(node, (candidate) => spans(candidate, range)).pipe(\n Option.getOrElse(() => found),\n );\n return Option.fromNullishOr(\n node.forEachChild((child) =>\n Option.liftPredicate(visit(child, matched), (deeper) => deeper !== matched).pipe(\n Option.getOrUndefined,\n ),\n ),\n ).pipe(Option.getOrElse(() => matched));\n };\n return visit(sourceFile, sourceFile);\n};\n\nconst toMappedNode = ({ context }: FileProgram, node: Node): MappedNode => {\n const start = node.getStart();\n return {\n type: SyntaxKind[node.kind],\n range: [start, node.end],\n loc: {\n start: context.sourceCode.getLocFromIndex(start),\n end: context.sourceCode.getLocFromIndex(node.end),\n },\n };\n};\n\nconst rangeKey = ([start, end]: Readonly<Range>): string => `${String(start)}:${String(end)}`;\n\nconst isRangedNode = (value: unknown): value is MappedNode =>\n Predicate.hasProperty(value, \"type\") &&\n Predicate.isString(value.type) &&\n Predicate.hasProperty(value, \"range\") &&\n Arr.isArray(value.range);\n\nconst childNodesOf = (node: MappedNode, keys: readonly string[]): readonly MappedNode[] =>\n pipe(\n keys,\n Arr.flatMap((key) =>\n pipe(\n Option.liftPredicate(node, Predicate.hasProperty(key)),\n Option.match({ onNone: () => [], onSome: (found) => Arr.ensure(found[key]) }),\n ),\n ),\n Arr.filter(isRangedNode),\n );\n\nconst esTreeIndex = ({ context }: FileProgram): ReadonlyMap<string, MappedNode> => {\n const index = new Map<string, MappedNode>();\n const { visitorKeys } = context.sourceCode;\n const visit = (node: MappedNode): void => {\n const key = rangeKey(node.range);\n index.getOrInsert(key, node);\n for (const child of childNodesOf(node, visitorKeys[node.type] ?? [])) {\n visit(child);\n }\n };\n visit(context.sourceCode.ast);\n return index;\n};\n\nexport const createParserServices = (file: FileProgram): ParserServices => {\n const esTreeNodes = lazily(() => esTreeIndex(file));\n const toTSNode = Fn.memoize((node: RangedNode) => innermostSpanning(file.sourceFile, node.range));\n const checker = file.program.getTypeChecker();\n const toESTreeNode = (node: Node): MappedNode => {\n const key = rangeKey([node.getStart(), node.end]);\n return Option.fromNullishOr(esTreeNodes().get(key)).pipe(\n Option.getOrElse(() => toMappedNode(file, node)),\n );\n };\n return {\n program: file.program,\n esTreeNodeToTSNodeMap: { get: toTSNode },\n getTypeAtLocation: (node) => checker.getTypeAtLocation(toTSNode(node)),\n getSymbolAtLocation: (node) => checker.getSymbolAtLocation(toTSNode(node)),\n tsNodeToESTreeNodeMap: {\n get: (node) =>\n Option.liftPredicate(\n node,\n (candidate) => candidate.getSourceFile().fileName === file.sourceFile.fileName,\n ).pipe(Option.map(toESTreeNode), Option.getOrUndefined),\n },\n };\n};\n","import { Option, Predicate, Record, pipe } from \"effect\";\nimport type { Context, CreateRule, RuleMeta, Visitor } from \"vite-plus/lint/plugins\";\n\nimport { lazily } from \"#/shared/lib/memo.ts\";\nimport { programFor } from \"#/shared/lib/program.ts\";\n\nimport { createParserServices } from \"./parser-services.ts\";\nimport type { ParserServices } from \"./parser-services.ts\";\n\nexport type TypedSourceCode = Context[\"sourceCode\"] & {\n readonly parserServices: ParserServices | undefined;\n};\n\nexport type TypedContext = Omit<Context, \"sourceCode\"> & { readonly sourceCode: TypedSourceCode };\n\nexport interface TypedRule {\n readonly meta: RuleMeta;\n readonly create: (context: TypedContext) => Visitor;\n}\n\nexport const isTypedRule = <Rule>(rule: Rule): rule is Rule & TypedRule =>\n Predicate.hasProperty(rule, \"meta\") &&\n Predicate.hasProperty(rule, \"create\") &&\n Predicate.isFunction(rule.create);\n\nconst isTypedContext = (value: unknown): value is TypedContext =>\n Predicate.hasProperty(value, \"report\") &&\n Predicate.hasProperty(value, \"sourceCode\") &&\n Predicate.hasProperty(value.sourceCode, \"parserServices\");\n\nconst inheriting = (\n prototype: object,\n name: string,\n descriptor: Readonly<PropertyDescriptor>,\n): unknown => Object.create(prototype, { [name]: { ...descriptor, enumerable: true } });\n\nconst parserServicesOf = (context: Context): Option.Option<ParserServices> =>\n programFor({ fileName: context.filename, text: context.sourceCode.text }).pipe(\n Option.flatMap((program) =>\n Option.fromNullishOr(program.getSourceFile(context.filename)).pipe(\n Option.map((sourceFile) => createParserServices({ context, program, sourceFile })),\n ),\n ),\n );\n\nconst withParserServices = (\n context: Context,\n parserServices: () => ParserServices | undefined,\n): TypedContext => {\n const sourceCode = inheriting(context.sourceCode, \"parserServices\", { get: parserServices });\n return Option.liftPredicate(\n inheriting(context, \"sourceCode\", { value: sourceCode }),\n isTypedContext,\n ).pipe(Option.getOrThrowWith(() => new TypeError(\"The rule context has no source code.\")));\n};\n\nexport const withTypeInformation = (rule: TypedRule): CreateRule => ({\n meta: rule.meta,\n create: (context) =>\n parserServicesOf(context).pipe(\n Option.map((parserServices) =>\n rule.create(withParserServices(context, () => parserServices)),\n ),\n Option.getOrElse(() => ({})),\n ),\n});\n\nexport const withOptionalTypeInformation = (rule: TypedRule): CreateRule => ({\n meta: rule.meta,\n create: (context) =>\n rule.create(\n withParserServices(\n context,\n lazily(() => Option.getOrUndefined(parserServicesOf(context))),\n ),\n ),\n});\n\nexport const typedRules = (\n rules: Record.ReadonlyRecord<string, unknown>,\n): Record.ReadonlyRecord<string, CreateRule> =>\n pipe(rules, Record.filter(isTypedRule), Record.map(withTypeInformation));\n\nexport const optionallyTypedRules = (\n rules: Record.ReadonlyRecord<string, unknown>,\n): Record.ReadonlyRecord<string, CreateRule> =>\n pipe(rules, Record.filter(isTypedRule), Record.map(withOptionalTypeInformation));\n"],"mappings":";;;;;;;AAEA,MAAa,UAAiB,YAAwC;CACpE,MAAM,OAAyC,CAAC;CAChD,aAAa;EACX,MAAM,SAAS,OAAO,QAAQ,OAAO,cAAc,KAAK,KAAK,CAAC;EAC9D,IAAI,OAAO,OAAO,MAAM,GACtB,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,CAAC,GACvD,cACF,CAAC,CAAC,KAAK,OAAO,qCAAqB,IAAI,UAAU,sCAAsC,CAAC,CAAC;AAC3F;AAEA,MAAa,uBAAuB,UAAiC;CACnE,MAAM,KAAK;CACX,SAAS,YACP,iBAAiB,OAAO,CAAC,CAAC,KACxB,OAAO,KAAK,mBACV,KAAK,OAAO,mBAAmB,eAAe,cAAc,CAAC,CAC/D,GACA,OAAO,iBAAiB,CAAC,EAAE,CAC7B;AACJ;AAEA,MAAa,+BAA+B,UAAiC;CAC3E,MAAM,KAAK;CACX,SAAS,YACP,KAAK,OACH,mBACE,SACA,aAAa,OAAO,eAAe,iBAAiB,OAAO,CAAC,CAAC,CAC/D,CACF;AACJ;AAEA,MAAa,cACX,UAEA,KAAK,OAAO,OAAO,OAAO,WAAW,GAAG,OAAO,IAAI,mBAAmB,CAAC;AAEzE,MAAa,wBACX,UAEA,KAAK,OAAO,OAAO,OAAO,WAAW,GAAG,OAAO,IAAI,2BAA2B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { a as __toESM, n as __esmMin, r as __exportAll } from "./rolldown-runtime-DQp2zzRu.mjs";
2
- import { n as require_dist, t as require_eslint_utils } from "./eslint-utils-ujGlgEMD.mjs";
2
+ import { n as require_dist, t as require_eslint_utils } from "./eslint-utils-BF_HFO08.mjs";
3
3
  // src/shared/lib/typescript-eslint-utils.ts
4
4
  var typescript_eslint_utils_exports = /* @__PURE__ */ __exportAll({
5
5
  AST_NODE_TYPES: () => import_dist.AST_NODE_TYPES,
@@ -13,4 +13,4 @@ var init_typescript_eslint_utils = __esmMin((() => {
13
13
  }));
14
14
  export { typescript_eslint_utils_exports as i, import_eslint_utils as n, init_typescript_eslint_utils as r, import_dist as t };
15
15
 
16
- //# sourceMappingURL=typescript-eslint-utils-C6OO2FjX.mjs.map
16
+ //# sourceMappingURL=typescript-eslint-utils-C7ew0-XM.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-eslint-utils-C6OO2FjX.mjs","names":[],"sources":["../src/shared/lib/typescript-eslint-utils.ts"],"sourcesContent":["export { AST_NODE_TYPES, TSESTree } from \"@typescript-eslint/types\";\nexport * as ESLintUtils from \"@typescript-eslint/utils/eslint-utils\";\n"],"mappings":""}
1
+ {"version":3,"file":"typescript-eslint-utils-C7ew0-XM.mjs","names":[],"sources":["../src/shared/lib/typescript-eslint-utils.ts"],"sourcesContent":["export { AST_NODE_TYPES, TSESTree } from \"@typescript-eslint/types\";\nexport * as ESLintUtils from \"@typescript-eslint/utils/eslint-utils\";\n"],"mappings":""}
@@ -1,6 +1,5 @@
1
+ import { t as rulesOf } from "./config-rules-Buk48gLL.mjs";
1
2
  import { Array, Function, Option, Predicate, Record, Schema, String, pipe } from "effect";
2
- // src/entities/upstream-plugin/model/config-rules.ts
3
- const rulesOf = (config) => Option.liftPredicate(config, Predicate.hasProperty("rules")).pipe(Option.flatMap(({ rules }) => Option.liftPredicate(rules, Predicate.isReadonlyObject)));
4
3
  // src/entities/upstream-plugin/model/upstream-plugin.ts
5
4
  const Severities = Schema.Literals([
6
5
  "error",
@@ -16,6 +15,6 @@ const upstreamPlugin = Function.dual(3, (name, upstream, rulesOfUpstream) => ({
16
15
  configs: pipe(upstream.configs, Record.map(configOf(name))),
17
16
  rules: rulesOfUpstream(upstream.rules)
18
17
  }));
19
- export { upstreamPlugin as n, rulesOf as r, plainRules as t };
18
+ export { upstreamPlugin as n, plainRules as t };
20
19
 
21
- //# sourceMappingURL=upstream-plugin-D4Lz9A1H.mjs.map
20
+ //# sourceMappingURL=upstream-plugin-eT7t_K7e.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-plugin-eT7t_K7e.mjs","names":["Arr","Str","Fn"],"sources":["../src/entities/upstream-plugin/model/upstream-plugin.ts"],"sourcesContent":["import {\n Array as Arr,\n Function as Fn,\n Option,\n Predicate,\n Record,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { CreateRule, Plugin } from \"vite-plus/lint/plugins\";\n\nimport { rulesOf } from \"./config-rules.ts\";\n\nconst Severities: Schema.Literals<readonly [\"error\", \"warn\", \"off\"]> = Schema.Literals([\n \"error\",\n \"warn\",\n \"off\",\n]);\n\nexport type Severity = typeof Severities.Type;\n\nexport interface Config {\n readonly rules?: Readonly<Record<string, Severity>> | undefined;\n}\n\nexport type UpstreamPlugin<ConfigName extends string> = Plugin & {\n readonly meta: { readonly name: string };\n readonly configs: Readonly<Record<ConfigName, Config>>;\n};\n\nexport interface Upstream<ConfigName extends string> {\n readonly rules: Readonly<Record<string, unknown>>;\n readonly configs: Readonly<Record<ConfigName, unknown>>;\n}\n\nexport type RulesOf = (\n rules: Readonly<Record<string, unknown>>,\n) => Readonly<Record<string, CreateRule>>;\n\nconst isRule = (rule: unknown): rule is CreateRule =>\n Predicate.hasProperty(rule, \"create\") && Predicate.isFunction(rule.create);\n\nexport const plainRules: RulesOf = Record.filter(isRule);\n\nconst ruleIdOf = (key: string): string => Arr.lastNonEmpty(Str.split(key, \"/\"));\n\nconst configOf =\n (name: string) =>\n (config: unknown): Config => ({\n rules: pipe(\n Arr.ensure(config),\n Arr.flatMap((entry) => Option.toArray(rulesOf(entry))),\n Arr.flatMap(Record.toEntries),\n Record.fromEntries,\n Record.filter(Schema.is(Severities)),\n Record.mapKeys((key) => `${name}/${ruleIdOf(key)}`),\n ),\n });\n\nconst DATA_FIRST_ARITY_3 = 3;\n\nexport const upstreamPlugin: {\n <ConfigName extends string>(\n upstream: Upstream<ConfigName>,\n rulesOfUpstream: RulesOf,\n ): (name: string) => UpstreamPlugin<ConfigName>;\n <ConfigName extends string>(\n name: string,\n upstream: Upstream<ConfigName>,\n rulesOfUpstream: RulesOf,\n ): UpstreamPlugin<ConfigName>;\n} = Fn.dual(\n DATA_FIRST_ARITY_3,\n <ConfigName extends string>(\n name: string,\n upstream: Upstream<ConfigName>,\n rulesOfUpstream: RulesOf,\n ): UpstreamPlugin<ConfigName> => ({\n meta: { name },\n configs: pipe(upstream.configs, Record.map(configOf(name))),\n rules: rulesOfUpstream(upstream.rules),\n }),\n);\n"],"mappings":";;;AAcA,MAAM,aAAiE,OAAO,SAAS;CACrF;CACA;CACA;AACF,CAAC;AAsBD,MAAM,UAAU,SACd,UAAU,YAAY,MAAM,QAAQ,KAAK,UAAU,WAAW,KAAK,MAAM;AAE3E,MAAa,aAAsB,OAAO,OAAO,MAAM;AAEvD,MAAM,YAAY,QAAwBA,MAAI,aAAaC,OAAI,MAAM,KAAK,GAAG,CAAC;AAE9E,MAAM,YACH,UACA,YAA6B,EAC5B,OAAO,KACLD,MAAI,OAAO,MAAM,GACjBA,MAAI,SAAS,UAAU,OAAO,QAAQ,QAAQ,KAAK,CAAC,CAAC,GACrDA,MAAI,QAAQ,OAAO,SAAS,GAC5B,OAAO,aACP,OAAO,OAAO,OAAO,GAAG,UAAU,CAAC,GACnC,OAAO,SAAS,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,GAAG,CACpD,EACF;AAIF,MAAa,iBAUTE,SAAG,KACL,IAEE,MACA,UACA,qBACgC;CAChC,MAAM,EAAE,KAAK;CACb,SAAS,KAAK,SAAS,SAAS,OAAO,IAAI,SAAS,IAAI,CAAC,CAAC;CAC1D,OAAO,gBAAgB,SAAS,KAAK;AACvC,EACF"}
@@ -0,0 +1,83 @@
1
+ import { t as __commonJSMin } from "./rolldown-runtime-DQp2zzRu.mjs";
2
+ // ../../node_modules/.pnpm/typescript@7.1.0-dev.20261124.1/node_modules/typescript/package.json
3
+ var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ module.exports = {
5
+ "name": "typescript",
6
+ "version": "7.1.0-dev.20261124.1",
7
+ "license": "Apache-2.0",
8
+ "author": "Microsoft Corp.",
9
+ "homepage": "https://www.typescriptlang.org/",
10
+ "description": "TypeScript is a language for application scale JavaScript development",
11
+ "keywords": [
12
+ "TypeScript",
13
+ "Microsoft",
14
+ "compiler",
15
+ "language",
16
+ "javascript"
17
+ ],
18
+ "bugs": { "url": "https://github.com/microsoft/TypeScript/issues" },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/microsoft/TypeScript.git"
22
+ },
23
+ "type": "module",
24
+ "preferUnplugged": true,
25
+ "engines": { "node": ">=16.20.0" },
26
+ "files": [
27
+ "bin",
28
+ "lib",
29
+ "schemas",
30
+ "dist",
31
+ "enums",
32
+ "vendor",
33
+ "NOTICE.txt"
34
+ ],
35
+ "bin": { "tsc": "./bin/tsc" },
36
+ "exports": {
37
+ "./package.json": "./package.json",
38
+ "./schemas/tsconfig.schema.json": "./schemas/tsconfig.schema.json",
39
+ "./schemas/jsconfig.schema.json": "./schemas/jsconfig.schema.json",
40
+ "./schemas/contentmapper.schema.json": "./schemas/contentmapper.schema.json",
41
+ ".": "./lib/version.cjs",
42
+ "./vscode": "./dist/vscode/extensionApi.js",
43
+ "./sync": "./dist/api/sync/api.js",
44
+ "./sync/transport": "./dist/api/sync/transport.js",
45
+ "./async": "./dist/api/async/api.js",
46
+ "./async/transport": "./dist/api/async/transport.js",
47
+ "./fs": "./dist/api/fs.js",
48
+ "./path": "./dist/api/typedPaths.js",
49
+ "./proto": "./dist/api/proto.js",
50
+ "./wasm": "./dist/wasm/index.js",
51
+ "./ast": "./dist/ast/index.js",
52
+ "./ast/is": "./dist/ast/is.js",
53
+ "./ast/factory": "./dist/ast/factory.generated.js",
54
+ "./ast/utils": "./dist/ast/utils.js",
55
+ "./ast/scanner": "./dist/ast/scanner.js",
56
+ "./ast/visitor": "./dist/ast/visitor.js",
57
+ "./ast/clone": "./dist/ast/clone.js"
58
+ },
59
+ "gitHead": "88071f4e84b1517c58429b4e10908275824c225c",
60
+ "publishConfig": {
61
+ "access": "public",
62
+ "tag": "next"
63
+ },
64
+ "optionalDependencies": {
65
+ "@typescript/typescript-win32-x64": "7.1.0-dev.20261124.1",
66
+ "@typescript/typescript-win32-arm64": "7.1.0-dev.20261124.1",
67
+ "@typescript/typescript-linux-x64": "7.1.0-dev.20261124.1",
68
+ "@typescript/typescript-linux-arm": "7.1.0-dev.20261124.1",
69
+ "@typescript/typescript-linux-arm64": "7.1.0-dev.20261124.1",
70
+ "@typescript/typescript-darwin-x64": "7.1.0-dev.20261124.1",
71
+ "@typescript/typescript-darwin-arm64": "7.1.0-dev.20261124.1"
72
+ }
73
+ };
74
+ }));
75
+ // ../../node_modules/.pnpm/typescript@7.1.0-dev.20261124.1/node_modules/typescript/lib/version.cjs
76
+ var require_version = /* @__PURE__ */ __commonJSMin(((exports) => {
77
+ const { version } = require_package();
78
+ exports.version = version;
79
+ exports.versionMajorMinor = "7.1";
80
+ }));
81
+ export { require_version as t };
82
+
83
+ //# sourceMappingURL=version-BMMFrB-m.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-BMMFrB-m.mjs","names":[],"sources":["../../../node_modules/.pnpm/typescript@7.1.0-dev.20261124.1/node_modules/typescript/package.json","../../../node_modules/.pnpm/typescript@7.1.0-dev.20261124.1/node_modules/typescript/lib/version.cjs"],"sourcesContent":["","const { version } = require(\"../package.json\");\nexports.version = version;\nexports.versionMajorMinor = \"7.1\";\n"],"ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CCAA,MAAM,EAAE,YAAA,gBAAA;CACR,QAAQ,UAAU;CAClB,QAAQ,oBAAoB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r_masseater/oxlint-typed-rules",
3
- "version": "0.4.3",
3
+ "version": "0.6.0",
4
4
  "description": "Run ESLint rules that need type information as oxlint JS plugins on TypeScript 7, including TanStack Start's React Server Component rules, TanStack Query, TanStack Router, Drizzle, Remotion and ESLint React.",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -16,14 +16,14 @@
16
16
  "tanstack-start",
17
17
  "typescript"
18
18
  ],
19
- "homepage": "https://github.com/masseater/masseater.dev/tree/main/libs/oxlint-typed-rules#readme",
19
+ "homepage": "https://github.com/masseater/ecosystems/tree/main/libs/oxlint-typed-rules#readme",
20
20
  "bugs": {
21
- "url": "https://github.com/masseater/masseater.dev/issues"
21
+ "url": "https://github.com/masseater/ecosystems/issues"
22
22
  },
23
23
  "license": "MIT",
24
24
  "repository": {
25
25
  "type": "git",
26
- "url": "git+https://github.com/masseater/masseater.dev.git",
26
+ "url": "git+https://github.com/masseater/ecosystems.git",
27
27
  "directory": "libs/oxlint-typed-rules"
28
28
  },
29
29
  "files": [
@@ -32,6 +32,7 @@
32
32
  "skills/run-typed-eslint-rules"
33
33
  ],
34
34
  "type": "module",
35
+ "sideEffects": false,
35
36
  "imports": {
36
37
  "#/*": "./src/*"
37
38
  },
@@ -72,41 +73,42 @@
72
73
  },
73
74
  "dependencies": {},
74
75
  "devDependencies": {
75
- "@effect/platform-node": "4.1.4",
76
- "@effect/vitest": "4.1.4",
77
- "@eslint-react/eslint-plugin": "5.30.2",
78
- "@r_masseater/vite-plus-adopt": "0.9.0",
79
- "@remotion/eslint-plugin": "4.0.543",
76
+ "@effect/platform-node": "4.1.5",
77
+ "@effect/vitest": "4.1.5",
78
+ "@eslint-react/eslint-plugin": "5.30.6",
79
+ "@r_masseater/vite-plus-adopt": "0.19.1",
80
+ "@remotion/eslint-plugin": "4.0.547",
80
81
  "@size-limit/file": "14.3.0",
81
- "@tanstack/eslint-plugin-query": "5.107.1",
82
+ "@tanstack/eslint-plugin-query": "5.108.4",
82
83
  "@tanstack/eslint-plugin-router": "1.162.0",
83
84
  "@tanstack/eslint-plugin-start": "0.1.0",
84
85
  "@tsconfig/strictest": "2.0.9",
85
- "@types/node": "26.6.6",
86
- "@types/react": "19.3.0",
87
- "@typescript-eslint/parser": "8.72.2",
88
- "@typescript-eslint/types": "8.72.2",
89
- "@typescript-eslint/typescript-estree": "8.72.2",
90
- "@typescript-eslint/utils": "^8.72.1",
86
+ "@types/node": "26.6.10",
87
+ "@types/react": "19.3.1",
88
+ "@typescript-eslint/parser": "8.74.0",
89
+ "@typescript-eslint/types": "8.74.0",
90
+ "@typescript-eslint/typescript-estree": "8.74.0",
91
+ "@typescript-eslint/utils": "8.74.0",
91
92
  "combinate": "1.1.11",
92
93
  "dedent": "1.7.2",
93
- "effect": "4.1.4",
94
+ "effect": "4.1.5",
94
95
  "eslint": "10.15.0",
95
96
  "eslint-plugin-drizzle": "0.2.3",
96
97
  "publint": "0.3.25",
97
98
  "size-limit": "14.3.0",
98
- "typescript": "7.1.0-beta",
99
- "vite-plus": "1.6.0"
99
+ "tsrs": "7.1.0-beta.tsrs5",
100
+ "typescript": "7.1.0-dev.20261124.1",
101
+ "vite-plus": "1.8.0"
100
102
  },
101
103
  "peerDependencies": {
102
- "effect": "^4.1.2",
103
- "typescript": ">=7.1.0-beta"
104
+ "effect": "^4.1.0",
105
+ "tsrs": ">=7.1.0-beta.tsrs5"
104
106
  },
105
107
  "size-limit": [
106
108
  {
107
109
  "name": "react",
108
110
  "path": "dist/react.mjs",
109
- "limit": "175820 B"
111
+ "limit": "177355 B"
110
112
  },
111
113
  {
112
114
  "name": "tanstack-query",
@@ -116,7 +118,7 @@
116
118
  {
117
119
  "name": "tanstack-router",
118
120
  "path": "dist/tanstack-router.mjs",
119
- "limit": "3429 B"
121
+ "limit": "3430 B"
120
122
  },
121
123
  {
122
124
  "name": "drizzle",
@@ -126,7 +128,7 @@
126
128
  {
127
129
  "name": "remotion",
128
130
  "path": "dist/remotion.mjs",
129
- "limit": "5408 B"
131
+ "limit": "5411 B"
130
132
  },
131
133
  {
132
134
  "name": "core",
@@ -142,7 +144,6 @@
142
144
  }
143
145
  ],
144
146
  "engines": {
145
- "node": ">=26"
146
- },
147
- "scripts": {}
147
+ "node": ">=26.13.1"
148
+ }
148
149
  }
@@ -4,11 +4,11 @@ description: >
4
4
  Use when running ESLint rules that need type information inside oxlint with
5
5
  @r_masseater/oxlint-typed-rules: the bundled TanStack Start, TanStack Query, TanStack Router,
6
6
  Drizzle, Remotion and ESLint React plugins, wrapping another typed ESLint plugin with typedRules,
7
- and choosing between this package and tsgolint.
7
+ writing a typed rule with withTypeInformation, and choosing between this package and
8
+ tsgolint.
8
9
  metadata:
9
10
  type: core
10
11
  library: "@r_masseater/oxlint-typed-rules"
11
- library_version: 0.4.2
12
12
  sources:
13
13
  - src/app/**
14
14
  - src/entities/typed-rule/**
@@ -73,6 +73,34 @@ export default {
73
73
  };
74
74
  ```
75
75
 
76
+ ## Write a typed rule
77
+
78
+ `withTypeInformation(rule)` gives a rule of your own the same `parserServices`.
79
+ `parserServices.program.native` is the TypeScript 7 `Project` of the linted file. Read its `checker` and `program` for what the ESLint-shaped services do not answer.
80
+
81
+ ```ts
82
+ import { withTypeInformation } from "@r_masseater/oxlint-typed-rules";
83
+
84
+ export const noAnyParameter = withTypeInformation({
85
+ meta: { type: "problem", messages: { any: "Give the parameter a type." } },
86
+ create: (context) => {
87
+ const services = context.sourceCode.parserServices;
88
+ if (services === undefined) {
89
+ return {};
90
+ }
91
+ const { checker } = services.program.native;
92
+ return {
93
+ Identifier: (node) => {
94
+ const type = services.getTypeAtLocation(node).native;
95
+ if (checker.typeToString(type) === "any") {
96
+ context.report({ node, messageId: "any" });
97
+ }
98
+ },
99
+ };
100
+ },
101
+ });
102
+ ```
103
+
76
104
  ## Choose the tool
77
105
 
78
106
  A typescript-eslint rule that oxlint also has, such as `no-floating-promises`, runs faster in tsgolint.