@foldkit/oxlint-plugin 0.10.0 → 0.11.0-canary.d902ee3d7d0b

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/dist/guards.d.ts CHANGED
@@ -1,21 +1,21 @@
1
1
  import { Option } from 'effect';
2
2
  import { type ESTree } from 'effect-oxlint';
3
3
  export declare const isIdentifier: (node: unknown, name?: string) => node is Readonly<{
4
- type: "Identifier";
4
+ type: 'Identifier';
5
5
  name: string;
6
6
  }>;
7
7
  export declare const isStringLiteral: (node: unknown) => node is ESTree.StringLiteral;
8
8
  export declare const isTemplateLiteral: (node: unknown) => node is ESTree.TemplateLiteral;
9
9
  export declare const isCallExpression: (node: unknown) => node is ESTree.CallExpression;
10
10
  export declare const isMemberExpression: (node: unknown) => node is Readonly<{
11
- type: "MemberExpression";
11
+ type: 'MemberExpression';
12
12
  object: unknown;
13
13
  property: unknown;
14
14
  computed?: boolean;
15
15
  }>;
16
16
  export declare const isObjectExpression: (node: unknown) => node is ESTree.ObjectExpression;
17
17
  export declare const isArrayExpression: (node: unknown) => node is Readonly<{
18
- type: "ArrayExpression";
18
+ type: 'ArrayExpression';
19
19
  elements: ReadonlyArray<unknown>;
20
20
  }>;
21
21
  export declare const isSpreadElement: (node: unknown) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,eAAO,MAAM,YAAY,GACvB,MAAM,OAAO,EACb,OAAO,MAAM,KACZ,IAAI,IAAI,QAAQ,CAAC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAOZ,CAAA;AAE5C,eAAO,MAAM,eAAe,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,MAAM,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AAe,SAAU,OAAO,KAAG,OAIjB,CAAA;AAE/B,eAAO,MAAM,gBAAgB,WAAY,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAYtE,CAAA;AAED,eAAO,MAAM,uBAAuB,WAC1B,OAAO,cACH,MAAM,KACjB,OACmE,CAAA;AAEtE,eAAO,MAAM,iBAAiB,SAAU,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAUrE,CAAA;AAED,eAAO,MAAM,oBAAoB,SACzB,OAAO,KACZ,IAAI,IAAI,MAAM,CAAC,kBAIkB,CAAA;AAEpC,eAAO,MAAM,qBAAqB,SAC1B,OAAO,KACZ,IAAI,IAAI,MAAM,CAAC,mBAImB,CAAA;AAErC,eAAO,MAAM,SAAS,SAAU,OAAO,KAAG,IAAI,IAAI,MAAM,CAAC,OAIhC,CAAA;AAEzB,eAAO,MAAM,mBAAmB,SACxB,MAAM,CAAC,cAAc,KAC1B,MAAM,CAAC,aAAa,GAAG,SAGzB,CAAA"}
package/dist/index.d.ts CHANGED
@@ -8,10 +8,6 @@ type OverriddenConfig = Plugin.OxlintConfig & {
8
8
  overrides: Array<Override>;
9
9
  };
10
10
  declare const _default: {
11
- configs: {
12
- recommended: OverriddenConfig;
13
- all: OverriddenConfig;
14
- };
15
11
  meta: {
16
12
  readonly name: string;
17
13
  };
@@ -44,6 +40,10 @@ declare const _default: {
44
40
  readonly 'selection-submodel-factory-at-module-scope': import("effect-oxlint").CreateRule;
45
41
  readonly 'wrap-child-output-in-got-message': import("effect-oxlint").CreateRule;
46
42
  };
43
+ configs: {
44
+ recommended: OverriddenConfig;
45
+ all: OverriddenConfig;
46
+ };
47
47
  };
48
48
  export default _default;
49
49
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAiEtC,KAAK,QAAQ,GAAG,QAAQ,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACpB,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAA;CAC3C,CAAC,CAAA;AAEF,KAAK,gBAAgB,GAAG,MAAM,CAAC,YAAY,GAAG;IAC5C,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;CAC3B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDD,wBAMC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAiEtC,KAAK,QAAQ,GAAG,QAAQ,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACpB,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAA;CAC3C,CAAC,CAAA;AAEF,KAAK,gBAAgB,GAAG,MAAM,CAAC,YAAY,GAAG;IAC5C,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;CAC3B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoDG,WAAW;QACX,GAAG"}
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ var __export = (target, all5) => {
4
4
  __defProp(target, name, { get: all5[name], enumerable: true });
5
5
  };
6
6
 
7
- // ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-rc.112/node_modules/effect-oxlint/dist/chunk.js
7
+ // ../../node_modules/.pnpm/effect-oxlint@0.3.4_effect@4.0.0-rc.112/node_modules/effect-oxlint/dist/rolldown-runtime.js
8
8
  var __defProp2 = Object.defineProperty;
9
9
  var __exportAll = (all5, no_symbols) => {
10
10
  let target = {};
@@ -7399,7 +7399,7 @@ var flatMapEager2 = flatMapEager;
7399
7399
  var catchEager2 = catchEager;
7400
7400
  var fnUntracedEager2 = fnUntracedEager;
7401
7401
 
7402
- // ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-rc.112/node_modules/effect-oxlint/dist/RuleContext.js
7402
+ // ../../node_modules/.pnpm/effect-oxlint@0.3.4_effect@4.0.0-rc.112/node_modules/effect-oxlint/dist/RuleContext.js
7403
7403
  var RuleContextBase = Service()("effect-oxlint/RuleContext");
7404
7404
  var RuleContext = class extends RuleContextBase {
7405
7405
  };
@@ -9594,6 +9594,7 @@ function decodeUnknownSync(schema, options) {
9594
9594
  return runSchemaErrorSync(parser(input, options2));
9595
9595
  };
9596
9596
  }
9597
+ var decodeSync2 = decodeUnknownSync;
9597
9598
  var make13 = make12;
9598
9599
  function Literal2(literal) {
9599
9600
  const out = make13(new Literal(literal), {
@@ -10014,7 +10015,7 @@ var updateSomeAndGet = /* @__PURE__ */ dual(2, (self, pf) => sync2(() => {
10014
10015
  }));
10015
10016
  var getUnsafe3 = (self) => self.ref.current;
10016
10017
 
10017
- // ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-rc.112/node_modules/effect-oxlint/dist/index.js
10018
+ // ../../node_modules/.pnpm/effect-oxlint@0.3.4_effect@4.0.0-rc.112/node_modules/effect-oxlint/dist/index.js
10018
10019
  var AST_exports = /* @__PURE__ */ __exportAll({
10019
10020
  calleeIdentifier: () => calleeIdentifier,
10020
10021
  calleeName: () => calleeName,
@@ -10218,10 +10219,11 @@ var define = (config) => ({
10218
10219
  const decodeOptions = () => {
10219
10220
  const schema = config.options;
10220
10221
  if (schema === void 0) return void 0;
10221
- return decodeUnknownSync(schema)(oxlintContext.options[0]);
10222
+ return decodeSync2(schema)(oxlintContext.options[0]);
10222
10223
  };
10223
10224
  const options = run2(sync2(decodeOptions));
10224
- return toOxlintVisitor(run2(gen4(() => config.create(options))), run2);
10225
+ const effectVisitor = run2(gen4(() => config.create(options)));
10226
+ return toOxlintVisitor(effectVisitor, run2);
10225
10227
  }
10226
10228
  });
10227
10229
  var meta = (opts) => ({
@@ -11086,92 +11088,134 @@ var lazyViewStableReferences = Rule_exports.define({
11086
11088
 
11087
11089
  // src/rules/mount-factory-must-use-element.ts
11088
11090
  var MOUNT_DEFINITION_METHODS = ["define", "defineStream"];
11089
- var NO_ELEMENT_PARAMETER_MESSAGE = "This Mount factory never receives the element: it declares no usable element parameter. A Mount exists for element-caused, element-targeted work. If the element is irrelevant, use a Command, Subscription, or ManagedResource instead.";
11090
- var ignoredElementParameterMessage = (parameterName) => `The element parameter \`${parameterName}\` is named as ignored. A Mount factory must read or write its live element; if the element does not matter here, the side effect has a different cause and belongs in a Command, Subscription, or ManagedResource.`;
11091
- var unusedElementParameterMessage = (parameterName) => `The element parameter \`${parameterName}\` is never referenced in this Mount factory. A Mount factory must use its live element; work that does not need the element belongs in a Command, Subscription, or ManagedResource.`;
11092
- var isFactoryFunction = (node) => node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression";
11093
- var isMountDefinitionChain = (call) => {
11094
- if (call.callee.type === "MemberExpression") {
11095
- return AST_exports.isMember(call.callee, "Mount", MOUNT_DEFINITION_METHODS);
11096
- }
11097
- if (call.callee.type === "CallExpression") {
11098
- return isMountDefinitionChain(call.callee);
11099
- }
11100
- return false;
11101
- };
11102
- var returnedFactoryFunction = (statement) => {
11103
- if (statement.type !== "ReturnStatement" || statement.argument === null) {
11104
- return Option_exports.none();
11105
- }
11106
- return isFactoryFunction(statement.argument) ? Option_exports.some(statement.argument) : Option_exports.none();
11107
- };
11108
- var descendToElementFactory = (builder) => {
11109
- const body = builder.body;
11110
- if (body === null) return builder;
11111
- if (isFactoryFunction(body)) return body;
11112
- if (body.type === "BlockStatement") {
11113
- return pipe(
11114
- body.body,
11115
- Array_exports.findFirst(returnedFactoryFunction),
11116
- Option_exports.getOrElse(() => builder)
11117
- );
11118
- }
11119
- return builder;
11120
- };
11091
+ var ELEMENT_FIELD = "element";
11092
+ var NO_ELEMENT_BINDING_MESSAGE = `This Mount's \`execute\` never receives the element: it does not destructure \`element\` from its input. A Mount exists for element-caused, element-targeted work. If the element is irrelevant, use a Command, Subscription, or ManagedResource instead.`;
11093
+ var ignoredElementBindingMessage = (bindingName) => `The element binding \`${bindingName}\` is named as ignored. A Mount's \`execute\` must read or write its live element; if the element does not matter here, the side effect has a different cause and belongs in a Command, Subscription, or ManagedResource.`;
11094
+ var unusedElementBindingMessage = (bindingName) => `The element binding \`${bindingName}\` is never referenced in this Mount's \`execute\`. A Mount's \`execute\` must use its live element; work that does not need the element belongs in a Command, Subscription, or ManagedResource.`;
11095
+ var unreadElementFieldMessage = (bindingName) => `This Mount's \`execute\` reads other fields off \`${bindingName}\` but never its \`element\`. Destructure \`element\` from the input so the check can see the read, or if the element is irrelevant, use a Command, Subscription, or ManagedResource instead.`;
11096
+ var unusedInputMessage = (bindingName) => `This Mount's \`execute\` never references \`${bindingName}\`, so it never reaches the live element. Destructure \`element\` from the input so the check can see the read, or if the element is irrelevant, use a Command, Subscription, or ManagedResource instead.`;
11097
+ var isExecuteFunction = (node) => node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression";
11121
11098
  var isRecord = (value) => typeof value === "object" && value !== null;
11122
- var shadowsParameterName = (functionNode, parameterName) => {
11099
+ var shadowsBindingName = (functionNode, bindingName) => {
11123
11100
  const parameters = functionNode.params;
11124
11101
  if (!isRecord(parameters)) return false;
11125
11102
  return Object.values(parameters).some(
11126
- (parameter) => isRecord(parameter) && parameter.type === "Identifier" && parameter.name === parameterName
11103
+ (parameter) => isRecord(parameter) && parameter.type === "Identifier" && parameter.name === bindingName
11127
11104
  );
11128
11105
  };
11129
- var referencesName = (value, parameterName) => {
11106
+ var referencesName = (value, bindingName) => {
11130
11107
  if (!isRecord(value)) return false;
11131
- if (value.type === "Identifier" && value.name === parameterName) return true;
11132
- if ((value.type === "ArrowFunctionExpression" || value.type === "FunctionExpression") && shadowsParameterName(value, parameterName)) {
11108
+ if (value.type === "Identifier" && value.name === bindingName) return true;
11109
+ if ((value.type === "ArrowFunctionExpression" || value.type === "FunctionExpression") && shadowsBindingName(value, bindingName)) {
11133
11110
  return false;
11134
11111
  }
11112
+ if (value.type === "MemberExpression" && value.computed !== true) {
11113
+ return referencesName(value.object, bindingName);
11114
+ }
11135
11115
  if (value.type === "Property") {
11136
- const computedKeyReferences = value.computed === true && referencesName(value.key, parameterName);
11137
- return computedKeyReferences || referencesName(value.value, parameterName);
11116
+ const computedKeyReferences = value.computed === true && referencesName(value.key, bindingName);
11117
+ return computedKeyReferences || referencesName(value.value, bindingName);
11138
11118
  }
11139
11119
  return Object.entries(value).some(
11140
- ([key, child]) => key !== "parent" && referencesName(child, parameterName)
11120
+ ([key, child]) => key !== "parent" && referencesName(child, bindingName)
11141
11121
  );
11142
11122
  };
11143
- var elementFactoryDiagnostic = (factory) => {
11144
- const [firstParameter] = factory.params;
11145
- if (firstParameter === void 0 || firstParameter.type !== "Identifier") {
11146
- return Option_exports.some(NO_ELEMENT_PARAMETER_MESSAGE);
11123
+ var inputUses = (value, inputName) => {
11124
+ if (!isRecord(value)) return [];
11125
+ if (value.type === "MemberExpression" && isRecord(value.object) && value.object.type === "Identifier" && value.object.name === inputName) {
11126
+ if (value.computed === true) return ["MaybeElement"];
11127
+ return isRecord(value.property) && value.property.type === "Identifier" && value.property.name === ELEMENT_FIELD ? ["Element"] : ["OtherField"];
11128
+ }
11129
+ if (value.type === "MemberExpression" && value.computed !== true) {
11130
+ return inputUses(value.object, inputName);
11131
+ }
11132
+ if ((value.type === "ArrowFunctionExpression" || value.type === "FunctionExpression") && shadowsBindingName(value, inputName)) {
11133
+ return [];
11134
+ }
11135
+ if (value.type === "Property") {
11136
+ const keyUses = value.computed === true ? inputUses(value.key, inputName) : [];
11137
+ return [...keyUses, ...inputUses(value.value, inputName)];
11147
11138
  }
11148
- if (firstParameter.name.startsWith("_")) {
11149
- return Option_exports.some(ignoredElementParameterMessage(firstParameter.name));
11139
+ if (value.type === "Identifier" && value.name === inputName) {
11140
+ return ["MaybeElement"];
11150
11141
  }
11151
- return referencesName(factory.body, firstParameter.name) ? Option_exports.none() : Option_exports.some(unusedElementParameterMessage(firstParameter.name));
11142
+ return Object.entries(value).flatMap(
11143
+ ([key, child]) => key === "parent" ? [] : inputUses(child, inputName)
11144
+ );
11152
11145
  };
11146
+ var elementProperty = (pattern) => pipe(
11147
+ pattern.properties,
11148
+ Array_exports.findFirst(
11149
+ (property) => property.type === "Property" && (property.key.type === "Literal" ? property.key.value === ELEMENT_FIELD : !property.computed && property.key.type === "Identifier" && property.key.name === ELEMENT_FIELD)
11150
+ )
11151
+ );
11152
+ var restBindingName = (pattern) => pipe(
11153
+ pattern.properties,
11154
+ Array_exports.findFirst(
11155
+ (property) => property.type === "RestElement" && property.argument.type === "Identifier" ? Option_exports.some(property.argument.name) : Option_exports.none()
11156
+ )
11157
+ );
11158
+ var withoutDefault = (value) => value.type === "AssignmentPattern" ? value.left : value;
11159
+ var bindingDiagnostic = (execute, bindingName) => {
11160
+ if (bindingName.startsWith("_")) {
11161
+ return Option_exports.some(ignoredElementBindingMessage(bindingName));
11162
+ }
11163
+ return referencesName(execute.body, bindingName) ? Option_exports.none() : Option_exports.some(unusedElementBindingMessage(bindingName));
11164
+ };
11165
+ var unpackedDiagnostic = (execute, bindingName) => {
11166
+ const uses = inputUses(execute.body, bindingName);
11167
+ if (Array_exports.isReadonlyArrayEmpty(uses)) {
11168
+ return Option_exports.some(unusedInputMessage(bindingName));
11169
+ }
11170
+ return uses.every((use) => use === "OtherField") ? Option_exports.some(unreadElementFieldMessage(bindingName)) : Option_exports.none();
11171
+ };
11172
+ var executeDiagnostic = (execute) => {
11173
+ const [firstParameter] = execute.params;
11174
+ if (firstParameter === void 0) {
11175
+ return Option_exports.some(NO_ELEMENT_BINDING_MESSAGE);
11176
+ }
11177
+ if (firstParameter.type === "Identifier") {
11178
+ return unpackedDiagnostic(execute, firstParameter.name);
11179
+ }
11180
+ if (firstParameter.type !== "ObjectPattern") {
11181
+ return Option_exports.some(NO_ELEMENT_BINDING_MESSAGE);
11182
+ }
11183
+ return Option_exports.match(elementProperty(firstParameter), {
11184
+ onNone: () => Option_exports.match(restBindingName(firstParameter), {
11185
+ onNone: () => Option_exports.some(NO_ELEMENT_BINDING_MESSAGE),
11186
+ onSome: (restName) => unpackedDiagnostic(execute, restName)
11187
+ }),
11188
+ onSome: (property) => {
11189
+ const pattern = withoutDefault(property.value);
11190
+ return pattern.type === "Identifier" ? bindingDiagnostic(execute, pattern.name) : Option_exports.none();
11191
+ }
11192
+ });
11193
+ };
11194
+ var executeFunction = (node) => pipe(
11195
+ Array_exports.get(node.arguments, 1),
11196
+ Option_exports.filter(isObjectExpression),
11197
+ Option_exports.flatMap((config) => AST_exports.objectGetValue(config, "execute")),
11198
+ Option_exports.filter(isExecuteFunction)
11199
+ );
11153
11200
  var mountFactoryMustUseElement = Rule_exports.define({
11154
11201
  name: "mount-factory-must-use-element",
11155
11202
  meta: Rule_exports.meta({
11156
11203
  type: "suggestion",
11157
- description: "Require Mount factories to use their live element."
11204
+ description: "Require a Mount's execute to use its live element."
11158
11205
  }),
11159
11206
  create: function* () {
11160
11207
  const ctx = yield* RuleContext;
11161
11208
  return {
11162
11209
  CallExpression: (node) => {
11163
- if (!isCallExpression(node)) return Effect_exports.void;
11164
- if (node.callee.type !== "CallExpression" || !isMountDefinitionChain(node.callee)) {
11165
- return Effect_exports.void;
11166
- }
11167
- const [factoryArgument] = node.arguments;
11168
- if (factoryArgument === void 0 || !isFactoryFunction(factoryArgument)) {
11210
+ if (!isCallExpression(node) || !AST_exports.isCallOf(node, "Mount", MOUNT_DEFINITION_METHODS)) {
11169
11211
  return Effect_exports.void;
11170
11212
  }
11171
- const elementFactory = descendToElementFactory(factoryArgument);
11172
- return Option_exports.match(elementFactoryDiagnostic(elementFactory), {
11213
+ return Option_exports.match(executeFunction(node), {
11173
11214
  onNone: () => Effect_exports.void,
11174
- onSome: (message) => ctx.report(Diagnostic_exports.make({ node: elementFactory, message }))
11215
+ onSome: (execute) => Option_exports.match(executeDiagnostic(execute), {
11216
+ onNone: () => Effect_exports.void,
11217
+ onSome: (message) => ctx.report(Diagnostic_exports.make({ node: execute, message }))
11218
+ })
11175
11219
  });
11176
11220
  }
11177
11221
  };
@@ -11456,7 +11500,7 @@ var noDisablingDevGuardrails = Rule_exports.define({
11456
11500
  });
11457
11501
 
11458
11502
  // src/rules/no-duplicate-onmount-per-element.ts
11459
- var DUPLICATE_ON_MOUNT_MESSAGE = "Only one OnMount attribute can attach to an element. Foldkit installs a single insert hook and tracks a single Mount fiber per element, so a later OnMount replaces the earlier one and its factory never runs. Combine the behaviors into one Mount definition.";
11503
+ var DUPLICATE_ON_MOUNT_MESSAGE = "Only one OnMount attribute can attach to an element. Foldkit installs a single insert hook and tracks a single Mount fiber per element, so a later OnMount replaces the earlier one and its `execute` never runs. Combine the behaviors into one Mount definition.";
11460
11504
  var isOnMountCallee = (callee) => {
11461
11505
  if (callee.type === "Identifier") {
11462
11506
  return callee.name === "OnMount";
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../src/message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAA;AAM3C,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAA;IACrB,MAAM,EAAE,MAAM,CAAC,gBAAgB,CAAA;CAChC,CAAC,CAAA;AAoBF,eAAO,MAAM,iCAAiC,GAC5C,UAAU,GAAG,CAAC,MAAM,CAAC,EACrB,MAAM,MAAM,CAAC,IAAI,KAChB,IA0BF,CAAA;AAED,eAAO,MAAM,YAAY,GACvB,MAAM,MAAM,CAAC,cAAc,EAC3B,UAAU,WAAW,CAAC,MAAM,CAAC,KAC5B,aAAa,CAAC,WAAW,CA4B3B,CAAA;AAED,eAAO,MAAM,yBAAyB,GACpC,QAAQ,MAAM,CAAC,gBAAgB,KAC9B,OAMA,CAAA"}
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../src/message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAA;AAM3C,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAA;IACrB,MAAM,EAAE,MAAM,CAAC,gBAAgB,CAAA;CAChC,CAAC,CAAA;AAoBF,eAAO,MAAM,iCAAiC,aAClC,GAAG,CAAC,MAAM,CAAC,QACf,MAAM,CAAC,IAAI,KAChB,IA0BF,CAAA;AAED,eAAO,MAAM,YAAY,SACjB,MAAM,CAAC,cAAc,YACjB,WAAW,CAAC,MAAM,CAAC,KAC5B,aAAa,CAAC,WAAW,CA4B3B,CAAA;AAED,eAAO,MAAM,yBAAyB,WAC5B,MAAM,CAAC,gBAAgB,KAC9B,OAMA,CAAA"}
@@ -1,3 +1,3 @@
1
- /** Flags applied Mount.define and Mount.defineStream factories that never use their element parameter. A Mount exists for element-caused, element-targeted work; a factory that ignores the element belongs in a Command, Subscription, or ManagedResource. */
1
+ /** Flags Mount.define and Mount.defineStream definitions whose `execute` never uses its element. A Mount exists for element-caused, element-targeted work; work that ignores the element belongs in a Command, Subscription, or ManagedResource. */
2
2
  export declare const mountFactoryMustUseElement: import("effect-oxlint").CreateRule;
3
3
  //# sourceMappingURL=mount-factory-must-use-element.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mount-factory-must-use-element.d.ts","sourceRoot":"","sources":["../../src/rules/mount-factory-must-use-element.ts"],"names":[],"mappings":"AA4GA,+PAA+P;AAC/P,eAAO,MAAM,0BAA0B,oCAiCrC,CAAA"}
1
+ {"version":3,"file":"mount-factory-must-use-element.d.ts","sourceRoot":"","sources":["../../src/rules/mount-factory-must-use-element.ts"],"names":[],"mappings":"AA0NA,oPAAoP;AACpP,eAAO,MAAM,0BAA0B,oCA4BrC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foldkit/oxlint-plugin",
3
- "version": "0.10.0",
3
+ "version": "0.11.0-canary.d902ee3d7d0b",
4
4
  "description": "Oxlint rules for Foldkit applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,15 +15,16 @@
15
15
  "./all.json": "./all.json"
16
16
  },
17
17
  "dependencies": {
18
- "effect-oxlint": "^0.3.2"
18
+ "effect-oxlint": "^0.3.4"
19
19
  },
20
20
  "devDependencies": {
21
- "@types/node": "^25.9.3",
21
+ "@types/node": "^26.4.0",
22
+ "@typescript/native": "npm:typescript@^7.0.2",
22
23
  "effect": "4.0.0-rc.112",
23
- "esbuild": "^0.28.1",
24
+ "esbuild": "^0.28.2",
24
25
  "rimraf": "^6.1.3",
25
- "typescript": "^6.0.3",
26
- "vitest": "^4.1.9"
26
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
27
+ "vitest": "^4.1.11"
27
28
  },
28
29
  "files": [
29
30
  "dist",