@imranbarbhuiya/oxc-config 0.3.1 → 0.3.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 -0
- package/dist/effect.js +1 -0
- package/dist/effect.js.map +1 -1
- package/dist/plugins/effect.js +53 -0
- package/dist/plugins/effect.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -152,6 +152,7 @@ The `effect-node` CLI preset extends `common`, `node`, `typescript`, `module` an
|
|
|
152
152
|
- `mahir-effect/no-pipe-on-fn` flags `.pipe` on `Effect.fn(...)(...)`; pass combinators as extra arguments instead
|
|
153
153
|
- `mahir-effect/no-throw-in-gen` flags `throw` directly inside `Effect.gen` / `Effect.fn` / `Effect.fnUntraced` generators
|
|
154
154
|
- `mahir-effect/no-run-outside-edge` flags `Effect.runPromise`, `runSync`, `runFork` and the other `run*` functions outside `**/main.ts`, `**/*.test.ts` and `**/scripts/**`
|
|
155
|
+
- `mahir-effect/no-unsafe-sql` flags `sql.unsafe(...)` and `sql.literal(...)` whose first argument is not a constant string (a string literal or a template literal without `${}`). Interpolate values in the tagged template (`` sql`... ${value}` ``) and use `sql(identifier)` or a whitelist for identifiers and `ORDER BY`. `sql.unsafe('SELECT $1', [value])` is allowed. The `clientNames` option (default `['sql']`) lists the client names it checks, matched against `name.unsafe` and `this.name.unsafe`
|
|
155
156
|
- `no-restricted-imports` rejects v3-era paths: `effect/Either`, `effect/unstable/*`, `@effect/platform`, `@effect/schema`, `@effect/rpc`, `@effect/cluster`, `@effect/sql` and their subpaths
|
|
156
157
|
- `node-js/no-process-env` rejects `process.env`; use `Config`. It is off under `**/scripts/**`
|
|
157
158
|
|
|
@@ -176,6 +177,17 @@ export default defineConfig({
|
|
|
176
177
|
});
|
|
177
178
|
```
|
|
178
179
|
|
|
180
|
+
Check SQL clients bound to other names:
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
export default defineConfig({
|
|
184
|
+
extends: [common, node, typescript, module, effect],
|
|
185
|
+
rules: {
|
|
186
|
+
'mahir-effect/no-unsafe-sql': [2, { clientNames: ['sql', 'db'] }],
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
179
191
|
`effect-types-only` is for UI packages that share types with an Effect backend but should not ship the Effect runtime. `mahir-effect/types-only-imports` flags value imports, value re-exports and dynamic imports of `effect`, `effect/*` and `@effect/*`. `import type`, `export type` and inline `type` specifiers are allowed. It does not use `no-restricted-imports`, so you can add your own entries:
|
|
180
192
|
|
|
181
193
|
```ts
|
package/dist/effect.js
CHANGED
package/dist/effect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effect.js","names":[],"sources":["../src/effect.ts"],"sourcesContent":["import { defineConfig } from 'oxlint';\n\nimport { localPlugin, nativePlugins, packagePlugin } from './config.js';\n\nimport type { OxlintConfig } from 'oxlint';\n\nconst V3_MESSAGE = 'This is an Effect v3 import path that does not exist in Effect v4.';\n\nconst rules: NonNullable<OxlintConfig['rules']> = {\n\t'mahir-effect/fn-name-matches': 2,\n\t'mahir-effect/no-gen-wrapper': 2,\n\t'mahir-effect/no-pipe-on-fn': 2,\n\t'mahir-effect/no-run-outside-edge': 2,\n\t'mahir-effect/no-throw-in-gen': 2,\n\t'mahir-effect/return-yield-error': 2,\n\t'no-restricted-imports': [\n\t\t2,\n\t\t{\n\t\t\tpaths: [\n\t\t\t\t{ name: 'effect/Either', message: 'Effect v4 replaced `effect/Either` with `effect/Result`.' },\n\t\t\t\t{ name: '@effect/platform', message: `${V3_MESSAGE} Import from \\`effect\\` or \\`effect/<module>\\`.` },\n\t\t\t\t{ name: '@effect/schema', message: `${V3_MESSAGE} Import \\`Schema\\` from \\`effect\\`.` },\n\t\t\t\t{ name: '@effect/rpc', message: `${V3_MESSAGE} Import from \\`effect/rpc\\`.` },\n\t\t\t\t{ name: '@effect/cluster', message: `${V3_MESSAGE} Import from \\`effect/cluster\\`.` },\n\t\t\t\t{ name: '@effect/sql', message: `${V3_MESSAGE} Import from \\`effect/sql\\`.` },\n\t\t\t],\n\t\t\tpatterns: [\n\t\t\t\t{\n\t\t\t\t\tgroup: ['effect/unstable/*'],\n\t\t\t\t\tmessage: 'Effect v4 dropped the `unstable` segment. Import from `effect/<module>`.',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroup: ['@effect/platform/*', '@effect/schema/*', '@effect/rpc/*', '@effect/cluster/*', '@effect/sql/*'],\n\t\t\t\t\tmessage: `${V3_MESSAGE} Import from \\`effect\\` or \\`effect/<module>\\`.`,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n\t'node-js/no-process-env': 2,\n\t'func-names': [2, 'as-needed', { generators: 'never' }],\n\t'no-use-before-define': [\n\t\t2,\n\t\t{\n\t\t\tclasses: false,\n\t\t\tfunctions: false,\n\t\t\tvariables: true,\n\t\t},\n\t],\n\t'no-redeclare': 0,\n\t'promise/prefer-await-to-callbacks': 0,\n\t'promise/prefer-await-to-then': 0,\n\t'require-yield': 0,\n\t'unicorn/prefer-top-level-await': 0,\n\t'unicorn/throw-new-error': 0,\n};\n\nconst config = defineConfig({\n\tplugins: nativePlugins,\n\tjsPlugins: [localPlugin('mahir-effect', './plugins/effect.js'), packagePlugin('node-js', 'eslint-plugin-n')],\n\trules,\n\toverrides: [\n\t\t{\n\t\t\tfiles: ['**/scripts/**'],\n\t\t\trules: {\n\t\t\t\t'node-js/no-process-env': 0,\n\t\t\t},\n\t\t},\n\t],\n});\n\nexport default config;\n"],"mappings":";;;;AAMA,MAAM,aAAa;AAEnB,MAAM,QAA4C;CACjD,gCAAgC;CAChC,+BAA+B;CAC/B,8BAA8B;CAC9B,oCAAoC;CACpC,gCAAgC;CAChC,mCAAmC;CACnC,yBAAyB,CACxB,GACA;EACC,OAAO;GACN;IAAE,MAAM;IAAiB,SAAS;GAA2D;GAC7F;IAAE,MAAM;IAAoB,SAAS,GAAG,WAAW;GAAiD;GACpG;IAAE,MAAM;IAAkB,SAAS,GAAG,WAAW;GAAqC;GACtF;IAAE,MAAM;IAAe,SAAS,GAAG,WAAW;GAA8B;GAC5E;IAAE,MAAM;IAAmB,SAAS,GAAG,WAAW;GAAkC;GACpF;IAAE,MAAM;IAAe,SAAS,GAAG,WAAW;GAA8B;EAC7E;EACA,UAAU,CACT;GACC,OAAO,CAAC,mBAAmB;GAC3B,SAAS;EACV,GACA;GACC,OAAO;IAAC;IAAsB;IAAoB;IAAiB;IAAqB;GAAe;GACvG,SAAS,GAAG,WAAW;EACxB,CACD;CACD,CACD;CACA,0BAA0B;CAC1B,cAAc;EAAC;EAAG;EAAa,EAAE,YAAY,QAAQ;CAAC;CACtD,wBAAwB,CACvB,GACA;EACC,SAAS;EACT,WAAW;EACX,WAAW;CACZ,CACD;CACA,gBAAgB;CAChB,qCAAqC;CACrC,gCAAgC;CAChC,iBAAiB;CACjB,kCAAkC;CAClC,2BAA2B;AAC5B;AAEA,MAAM,SAAS,aAAa;CAC3B,SAAS;CACT,WAAW,CAAC,YAAY,gBAAgB,qBAAqB,GAAG,cAAc,WAAW,iBAAiB,CAAC;CAC3G;CACA,WAAW,CACV;EACC,OAAO,CAAC,eAAe;EACvB,OAAO,EACN,0BAA0B,EAC3B;CACD,CACD;AACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"effect.js","names":[],"sources":["../src/effect.ts"],"sourcesContent":["import { defineConfig } from 'oxlint';\n\nimport { localPlugin, nativePlugins, packagePlugin } from './config.js';\n\nimport type { OxlintConfig } from 'oxlint';\n\nconst V3_MESSAGE = 'This is an Effect v3 import path that does not exist in Effect v4.';\n\nconst rules: NonNullable<OxlintConfig['rules']> = {\n\t'mahir-effect/fn-name-matches': 2,\n\t'mahir-effect/no-gen-wrapper': 2,\n\t'mahir-effect/no-pipe-on-fn': 2,\n\t'mahir-effect/no-run-outside-edge': 2,\n\t'mahir-effect/no-throw-in-gen': 2,\n\t'mahir-effect/no-unsafe-sql': 2,\n\t'mahir-effect/return-yield-error': 2,\n\t'no-restricted-imports': [\n\t\t2,\n\t\t{\n\t\t\tpaths: [\n\t\t\t\t{ name: 'effect/Either', message: 'Effect v4 replaced `effect/Either` with `effect/Result`.' },\n\t\t\t\t{ name: '@effect/platform', message: `${V3_MESSAGE} Import from \\`effect\\` or \\`effect/<module>\\`.` },\n\t\t\t\t{ name: '@effect/schema', message: `${V3_MESSAGE} Import \\`Schema\\` from \\`effect\\`.` },\n\t\t\t\t{ name: '@effect/rpc', message: `${V3_MESSAGE} Import from \\`effect/rpc\\`.` },\n\t\t\t\t{ name: '@effect/cluster', message: `${V3_MESSAGE} Import from \\`effect/cluster\\`.` },\n\t\t\t\t{ name: '@effect/sql', message: `${V3_MESSAGE} Import from \\`effect/sql\\`.` },\n\t\t\t],\n\t\t\tpatterns: [\n\t\t\t\t{\n\t\t\t\t\tgroup: ['effect/unstable/*'],\n\t\t\t\t\tmessage: 'Effect v4 dropped the `unstable` segment. Import from `effect/<module>`.',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroup: ['@effect/platform/*', '@effect/schema/*', '@effect/rpc/*', '@effect/cluster/*', '@effect/sql/*'],\n\t\t\t\t\tmessage: `${V3_MESSAGE} Import from \\`effect\\` or \\`effect/<module>\\`.`,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n\t'node-js/no-process-env': 2,\n\t'func-names': [2, 'as-needed', { generators: 'never' }],\n\t'no-use-before-define': [\n\t\t2,\n\t\t{\n\t\t\tclasses: false,\n\t\t\tfunctions: false,\n\t\t\tvariables: true,\n\t\t},\n\t],\n\t'no-redeclare': 0,\n\t'promise/prefer-await-to-callbacks': 0,\n\t'promise/prefer-await-to-then': 0,\n\t'require-yield': 0,\n\t'unicorn/prefer-top-level-await': 0,\n\t'unicorn/throw-new-error': 0,\n};\n\nconst config = defineConfig({\n\tplugins: nativePlugins,\n\tjsPlugins: [localPlugin('mahir-effect', './plugins/effect.js'), packagePlugin('node-js', 'eslint-plugin-n')],\n\trules,\n\toverrides: [\n\t\t{\n\t\t\tfiles: ['**/scripts/**'],\n\t\t\trules: {\n\t\t\t\t'node-js/no-process-env': 0,\n\t\t\t},\n\t\t},\n\t],\n});\n\nexport default config;\n"],"mappings":";;;;AAMA,MAAM,aAAa;AAEnB,MAAM,QAA4C;CACjD,gCAAgC;CAChC,+BAA+B;CAC/B,8BAA8B;CAC9B,oCAAoC;CACpC,gCAAgC;CAChC,8BAA8B;CAC9B,mCAAmC;CACnC,yBAAyB,CACxB,GACA;EACC,OAAO;GACN;IAAE,MAAM;IAAiB,SAAS;GAA2D;GAC7F;IAAE,MAAM;IAAoB,SAAS,GAAG,WAAW;GAAiD;GACpG;IAAE,MAAM;IAAkB,SAAS,GAAG,WAAW;GAAqC;GACtF;IAAE,MAAM;IAAe,SAAS,GAAG,WAAW;GAA8B;GAC5E;IAAE,MAAM;IAAmB,SAAS,GAAG,WAAW;GAAkC;GACpF;IAAE,MAAM;IAAe,SAAS,GAAG,WAAW;GAA8B;EAC7E;EACA,UAAU,CACT;GACC,OAAO,CAAC,mBAAmB;GAC3B,SAAS;EACV,GACA;GACC,OAAO;IAAC;IAAsB;IAAoB;IAAiB;IAAqB;GAAe;GACvG,SAAS,GAAG,WAAW;EACxB,CACD;CACD,CACD;CACA,0BAA0B;CAC1B,cAAc;EAAC;EAAG;EAAa,EAAE,YAAY,QAAQ;CAAC;CACtD,wBAAwB,CACvB,GACA;EACC,SAAS;EACT,WAAW;EACX,WAAW;CACZ,CACD;CACA,gBAAgB;CAChB,qCAAqC;CACrC,gCAAgC;CAChC,iBAAiB;CACjB,kCAAkC;CAClC,2BAA2B;AAC5B;AAEA,MAAM,SAAS,aAAa;CAC3B,SAAS;CACT,WAAW,CAAC,YAAY,gBAAgB,qBAAqB,GAAG,cAAc,WAAW,iBAAiB,CAAC;CAC3G;CACA,WAAW,CACV;EACC,OAAO,CAAC,eAAe;EACvB,OAAO,EACN,0BAA0B,EAC3B;CACD,CACD;AACD,CAAC"}
|
package/dist/plugins/effect.js
CHANGED
|
@@ -28,6 +28,8 @@ const FN_METHODS = /* @__PURE__ */ new Set(["fn", "fnUntraced"]);
|
|
|
28
28
|
const FN_NAMED = /* @__PURE__ */ new Set(["fn"]);
|
|
29
29
|
const GEN = /* @__PURE__ */ new Set(["gen"]);
|
|
30
30
|
const GEN_OR_FN = /* @__PURE__ */ new Set(["gen", ...FN_METHODS]);
|
|
31
|
+
const DEFAULT_SQL_CLIENTS = ["sql"];
|
|
32
|
+
const UNSAFE_SQL_METHODS = /* @__PURE__ */ new Set(["literal", "unsafe"]);
|
|
31
33
|
function isEffectMember(node, methods) {
|
|
32
34
|
return node.type === "MemberExpression" && !node.computed && node.object.type === "Identifier" && node.object.name === "Effect" && node.property.type === "Identifier" && methods.has(node.property.name);
|
|
33
35
|
}
|
|
@@ -230,6 +232,56 @@ const noRunOutsideEdge = defineRule({
|
|
|
230
232
|
};
|
|
231
233
|
}
|
|
232
234
|
});
|
|
235
|
+
function sqlClientName(node) {
|
|
236
|
+
if (node.type === "Identifier") return node.name;
|
|
237
|
+
if (node.type === "MemberExpression" && !node.computed && node.property.type === "Identifier") return node.property.name;
|
|
238
|
+
}
|
|
239
|
+
const noUnsafeSql = defineRule({
|
|
240
|
+
meta: {
|
|
241
|
+
type: "problem",
|
|
242
|
+
docs: { description: "Disallow non-constant SQL text in `sql.unsafe` and `sql.literal`" },
|
|
243
|
+
schema: [{
|
|
244
|
+
type: "object",
|
|
245
|
+
additionalProperties: false,
|
|
246
|
+
properties: { clientNames: {
|
|
247
|
+
type: "array",
|
|
248
|
+
items: {
|
|
249
|
+
type: "string",
|
|
250
|
+
minLength: 1
|
|
251
|
+
},
|
|
252
|
+
uniqueItems: true
|
|
253
|
+
} }
|
|
254
|
+
}],
|
|
255
|
+
messages: { dynamicSql: "`{{client}}.{{method}}` with non-constant text can lead to SQL injection. Interpolate values in the `sql` tagged template and use `sql(identifier)` or a whitelist for identifiers and ORDER BY." },
|
|
256
|
+
defaultOptions: [{ clientNames: [...DEFAULT_SQL_CLIENTS] }]
|
|
257
|
+
},
|
|
258
|
+
createOnce(context) {
|
|
259
|
+
let clients = new Set(DEFAULT_SQL_CLIENTS);
|
|
260
|
+
return {
|
|
261
|
+
before() {
|
|
262
|
+
const options = context.options[0];
|
|
263
|
+
clients = new Set(options?.clientNames ?? DEFAULT_SQL_CLIENTS);
|
|
264
|
+
},
|
|
265
|
+
CallExpression(node) {
|
|
266
|
+
const { callee } = node;
|
|
267
|
+
if (callee.type !== "MemberExpression" || callee.computed || callee.property.type !== "Identifier") return;
|
|
268
|
+
const method = callee.property.name;
|
|
269
|
+
if (!UNSAFE_SQL_METHODS.has(method)) return;
|
|
270
|
+
const client = sqlClientName(callee.object);
|
|
271
|
+
if (client === void 0 || !clients.has(client)) return;
|
|
272
|
+
if (node.arguments.length === 0 || staticString(node.arguments[0]) !== void 0) return;
|
|
273
|
+
context.report({
|
|
274
|
+
node: node.arguments[0],
|
|
275
|
+
messageId: "dynamicSql",
|
|
276
|
+
data: {
|
|
277
|
+
client,
|
|
278
|
+
method
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
});
|
|
233
285
|
function isEffectModule(source) {
|
|
234
286
|
return source === "effect" || source.startsWith("effect/") || source.startsWith("@effect/");
|
|
235
287
|
}
|
|
@@ -276,6 +328,7 @@ var effect_default = definePlugin({
|
|
|
276
328
|
"no-pipe-on-fn": noPipeOnFn,
|
|
277
329
|
"no-run-outside-edge": noRunOutsideEdge,
|
|
278
330
|
"no-throw-in-gen": noThrowInGen,
|
|
331
|
+
"no-unsafe-sql": noUnsafeSql,
|
|
279
332
|
"return-yield-error": returnYieldError,
|
|
280
333
|
"types-only-imports": typesOnlyImports
|
|
281
334
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effect.js","names":[],"sources":["../../src/plugins/effect.ts"],"sourcesContent":["import { definePlugin, defineRule } from '@oxlint/plugins';\n\nimport { matchesFileGlob } from '../config.js';\n\nimport type { ESTree } from '@oxlint/plugins';\n\nconst DEFAULT_EDGE_FILES = ['**/main.ts', '**/*.test.ts', '**/scripts/**'];\nconst RUN_METHODS = new Set(['runCallback', 'runFork', 'runPromise', 'runPromiseExit', 'runSync', 'runSyncExit']);\nconst FAIL_METHODS = new Set(['die', 'dieMessage', 'dieSync', 'fail', 'failCause', 'failCauseSync', 'failSync']);\nconst FN_METHODS = new Set(['fn', 'fnUntraced']);\nconst FN_NAMED = new Set(['fn']);\nconst GEN = new Set(['gen']);\nconst GEN_OR_FN = new Set(['gen', ...FN_METHODS]);\n\nfunction isEffectMember(node: ESTree.Node, methods: Set<string>): node is ESTree.MemberExpression {\n\treturn (\n\t\tnode.type === 'MemberExpression' &&\n\t\t!node.computed &&\n\t\tnode.object.type === 'Identifier' &&\n\t\tnode.object.name === 'Effect' &&\n\t\tnode.property.type === 'Identifier' &&\n\t\tmethods.has(node.property.name)\n\t);\n}\n\nfunction isEffectCall(node: ESTree.Node | null | undefined, methods: Set<string>): node is ESTree.CallExpression {\n\treturn node?.type === 'CallExpression' && isEffectMember(node.callee, methods);\n}\n\nfunction staticString(node: ESTree.Node | undefined) {\n\tif (node?.type === 'Literal' && typeof node.value === 'string') return node.value;\n\tif (node?.type !== 'TemplateLiteral' || node.expressions.length > 0) return undefined;\n\treturn node.quasis[0]?.value.cooked ?? undefined;\n}\n\nfunction isNamedFnFactory(node: ESTree.Node): node is ESTree.CallExpression {\n\treturn isEffectCall(node, FN_NAMED) && staticString(node.arguments[0]) !== undefined;\n}\n\nfunction isEffectGeneratorBody(fn: ESTree.Node) {\n\tif (fn.type !== 'FunctionExpression' || !fn.generator) return false;\n\tconst call = fn.parent;\n\tif (call.type !== 'CallExpression' || !call.arguments.includes(fn)) return false;\n\tif (isEffectMember(call.callee, GEN_OR_FN)) return true;\n\treturn isNamedFnFactory(call.callee);\n}\n\nfunction isEffectFnCall(node: ESTree.Node) {\n\tif (node.type !== 'CallExpression') return false;\n\tif (isNamedFnFactory(node.callee)) return true;\n\treturn isEffectCall(node, FN_METHODS) && node.arguments[0]?.type === 'FunctionExpression';\n}\n\nfunction isGenOrPipedGen(node: ESTree.Node | null | undefined) {\n\tif (node?.type !== 'CallExpression') return false;\n\tconst { callee } = node;\n\tif (\n\t\tcallee.type === 'MemberExpression' &&\n\t\t!callee.computed &&\n\t\tcallee.property.type === 'Identifier' &&\n\t\tcallee.property.name === 'pipe'\n\t) {\n\t\treturn isEffectCall(callee.object, GEN);\n\t}\n\treturn isEffectMember(callee, GEN);\n}\n\nfunction returnedExpression(fn: ESTree.Function | ESTree.ArrowFunctionExpression) {\n\tconst { body } = fn;\n\tif (!body) return undefined;\n\tif (body.type !== 'BlockStatement') return body;\n\tif (body.body.length !== 1) return undefined;\n\tconst [statement] = body.body;\n\treturn statement.type === 'ReturnStatement' ? statement.argument : undefined;\n}\n\nfunction isReusableFunction(fn: ESTree.Function | ESTree.ArrowFunctionExpression) {\n\tif (fn.type === 'FunctionDeclaration') return true;\n\tconst { parent } = fn;\n\tif (parent.type === 'VariableDeclarator') return parent.init === fn;\n\tif (parent.type === 'Property' || parent.type === 'PropertyDefinition') return parent.value === fn;\n\treturn parent.type === 'MethodDefinition' || parent.type === 'ExportDefaultDeclaration';\n}\n\nfunction bindingName(node: ESTree.Node) {\n\tconst { parent } = node;\n\tif (!parent) return undefined;\n\tif (parent.type === 'VariableDeclarator' && parent.init === node && parent.id.type === 'Identifier') {\n\t\treturn parent.id.name;\n\t}\n\tif (\n\t\t(parent.type === 'Property' || parent.type === 'PropertyDefinition') &&\n\t\tparent.value === node &&\n\t\t!parent.computed\n\t) {\n\t\tif (parent.key.type === 'Identifier') return parent.key.name;\n\t\treturn staticString(parent.key);\n\t}\n\treturn undefined;\n}\n\nconst noGenWrapper = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow functions that only wrap and return `Effect.gen`',\n\t\t},\n\t\tmessages: {\n\t\t\tnoGenWrapper:\n\t\t\t\t'Avoid functions that only wrap and return `Effect.gen`. Use `Effect.fn(\"name\")(function* (...) {...})` or `Effect.fnUntraced` instead.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\tfunction check(fn: ESTree.Function | ESTree.ArrowFunctionExpression) {\n\t\t\tif (fn.generator || !isReusableFunction(fn)) return;\n\t\t\tif (isGenOrPipedGen(returnedExpression(fn))) context.report({ node: fn, messageId: 'noGenWrapper' });\n\t\t}\n\t\treturn {\n\t\t\tArrowFunctionExpression: check,\n\t\t\tFunctionDeclaration: check,\n\t\t\tFunctionExpression: check,\n\t\t};\n\t},\n});\n\nconst fnNameMatches = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Require the `Effect.fn` span name to match the binding it is assigned to',\n\t\t},\n\t\tfixable: 'code',\n\t\tmessages: {\n\t\t\tmismatch: '`Effect.fn(\"{{name}}\")` is assigned to `{{binding}}`. Use \"{{binding}}\" or \"<Service>.{{binding}}\".',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tif (!isNamedFnFactory(node.callee)) return;\n\t\t\t\tconst binding = bindingName(node);\n\t\t\t\tconst nameNode = node.callee.arguments[0];\n\t\t\t\tconst name = staticString(nameNode);\n\t\t\t\tif (!binding || name === undefined) return;\n\t\t\t\tif (name === binding || name.endsWith(`.${binding}`)) return;\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: nameNode,\n\t\t\t\t\tmessageId: 'mismatch',\n\t\t\t\t\tdata: { name, binding },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\tconst quote = context.sourceCode.getText(nameNode).at(0) ?? \"'\";\n\t\t\t\t\t\tconst prefix = name.includes('.') ? name.slice(0, name.lastIndexOf('.') + 1) : '';\n\t\t\t\t\t\treturn fixer.replaceText(nameNode, `${quote}${prefix}${binding}${quote}`);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n});\n\nconst returnYieldError = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Require `return yield*` when yielding an error so TypeScript knows execution stops',\n\t\t},\n\t\tfixable: 'code',\n\t\tmessages: {\n\t\t\tmissingReturn: 'Use `return yield* ...` when raising an error so TypeScript knows the generator stops here.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tYieldExpression(node) {\n\t\t\t\tif (!node.delegate || !node.argument || node.parent.type !== 'ExpressionStatement') return;\n\t\t\t\tif (node.argument.type !== 'NewExpression' && !isEffectCall(node.argument, FAIL_METHODS)) return;\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'missingReturn',\n\t\t\t\t\tfix: (fixer) => fixer.insertTextBefore(node, 'return '),\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n});\n\nconst noPipeOnFn = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow `.pipe` on `Effect.fn` / `Effect.fnUntraced`; pass combinators as extra arguments',\n\t\t},\n\t\tmessages: {\n\t\t\tnoPipe:\n\t\t\t\t'Do not use `.pipe` with `Effect.fn`. Pass the combinators as extra arguments: `Effect.fn(\"name\")(function* () {...}, Effect.withSpan(...))`.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tMemberExpression(node) {\n\t\t\t\tif (node.computed || node.property.type !== 'Identifier' || node.property.name !== 'pipe') return;\n\t\t\t\tif (!isEffectFnCall(node.object)) return;\n\t\t\t\tcontext.report({ node: node.property, messageId: 'noPipe' });\n\t\t\t},\n\t\t};\n\t},\n});\n\nconst noThrowInGen = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow `throw` inside `Effect.gen` / `Effect.fn` generators',\n\t\t},\n\t\tmessages: {\n\t\t\tnoThrow:\n\t\t\t\t'Do not throw inside an Effect generator; a throw becomes a defect. Use `return yield* new SomeError(...)` instead.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tThrowStatement(node) {\n\t\t\t\tlet current: ESTree.Node = node.parent;\n\t\t\t\twhile (\n\t\t\t\t\tcurrent.type !== 'FunctionExpression' &&\n\t\t\t\t\tcurrent.type !== 'FunctionDeclaration' &&\n\t\t\t\t\tcurrent.type !== 'ArrowFunctionExpression' &&\n\t\t\t\t\tcurrent.type !== 'Program'\n\t\t\t\t) {\n\t\t\t\t\tcurrent = current.parent;\n\t\t\t\t}\n\t\t\t\tif (isEffectGeneratorBody(current)) context.report({ node, messageId: 'noThrow' });\n\t\t\t},\n\t\t};\n\t},\n});\n\nconst noRunOutsideEdge = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Restrict `Effect.run*` to entrypoints, tests and scripts',\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: 'object',\n\t\t\t\tadditionalProperties: false,\n\t\t\t\tproperties: {\n\t\t\t\t\tallow: {\n\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\titems: { type: 'string', minLength: 1 },\n\t\t\t\t\t\tuniqueItems: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tmessages: {\n\t\t\tnoRun:\n\t\t\t\t'`Effect.{{method}}` belongs at the edge (`NodeRuntime.runMain`, `ManagedRuntime`). Allowed files: {{allow}}.',\n\t\t},\n\t\tdefaultOptions: [{ allow: [...DEFAULT_EDGE_FILES] }],\n\t},\n\tcreateOnce(context) {\n\t\tlet allow = DEFAULT_EDGE_FILES;\n\t\treturn {\n\t\t\tbefore() {\n\t\t\t\tconst options = context.options[0] as { allow?: string[] } | undefined;\n\t\t\t\tallow = options?.allow ?? DEFAULT_EDGE_FILES;\n\t\t\t\treturn !matchesFileGlob(context, allow);\n\t\t\t},\n\t\t\tCallExpression(node) {\n\t\t\t\tif (!isEffectMember(node.callee, RUN_METHODS)) return;\n\t\t\t\tconst method = node.callee.property.type === 'Identifier' ? node.callee.property.name : '';\n\t\t\t\tcontext.report({ node, messageId: 'noRun', data: { method, allow: allow.join(', ') } });\n\t\t\t},\n\t\t};\n\t},\n});\n\nfunction isEffectModule(source: string) {\n\treturn source === 'effect' || source.startsWith('effect/') || source.startsWith('@effect/');\n}\n\nfunction isTypeOnly(\n\tkind: string | undefined,\n\tspecifiers: readonly { type: string; importKind?: string; exportKind?: string }[],\n) {\n\tif (kind === 'type') return true;\n\treturn (\n\t\tspecifiers.length > 0 &&\n\t\tspecifiers.every((specifier) => specifier.importKind === 'type' || specifier.exportKind === 'type')\n\t);\n}\n\nconst typesOnlyImports = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Allow only type imports from `effect`, `effect/*` and `@effect/*`',\n\t\t},\n\t\tmessages: {\n\t\t\tvalueImport:\n\t\t\t\t'`{{source}}` is a runtime import. This package must not ship the Effect runtime; use `import type` or inline `type` specifiers.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\tfunction check(node: ESTree.Node, source: ESTree.Node | null) {\n\t\t\tconst name = staticString(source ?? undefined);\n\t\t\tif (name !== undefined && isEffectModule(name)) {\n\t\t\t\tcontext.report({ node, messageId: 'valueImport', data: { source: name } });\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tImportDeclaration(node) {\n\t\t\t\tif (!isTypeOnly(node.importKind, node.specifiers)) check(node, node.source);\n\t\t\t},\n\t\t\tExportNamedDeclaration(node) {\n\t\t\t\tif (node.source && !isTypeOnly(node.exportKind, node.specifiers)) check(node, node.source);\n\t\t\t},\n\t\t\tExportAllDeclaration(node) {\n\t\t\t\tif (node.exportKind !== 'type') check(node, node.source);\n\t\t\t},\n\t\t\tImportExpression(node) {\n\t\t\t\tcheck(node, node.source);\n\t\t\t},\n\t\t};\n\t},\n});\n\nexport default definePlugin({\n\tmeta: {\n\t\tname: 'eslint-plugin-mahir-effect',\n\t},\n\trules: {\n\t\t'fn-name-matches': fnNameMatches,\n\t\t'no-gen-wrapper': noGenWrapper,\n\t\t'no-pipe-on-fn': noPipeOnFn,\n\t\t'no-run-outside-edge': noRunOutsideEdge,\n\t\t'no-throw-in-gen': noThrowInGen,\n\t\t'return-yield-error': returnYieldError,\n\t\t'types-only-imports': typesOnlyImports,\n\t},\n});\n"],"mappings":";;;;AAMA,MAAM,qBAAqB;CAAC;CAAc;CAAgB;AAAe;AACzE,MAAM,8BAAc,IAAI,IAAI;CAAC;CAAe;CAAW;CAAc;CAAkB;CAAW;AAAa,CAAC;AAChH,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAO;CAAc;CAAW;CAAQ;CAAa;CAAiB;AAAU,CAAC;AAC/G,MAAM,6BAAa,IAAI,IAAI,CAAC,MAAM,YAAY,CAAC;AAC/C,MAAM,2BAAW,IAAI,IAAI,CAAC,IAAI,CAAC;AAC/B,MAAM,sBAAM,IAAI,IAAI,CAAC,KAAK,CAAC;AAC3B,MAAM,4BAAY,IAAI,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;AAEhD,SAAS,eAAe,MAAmB,SAAuD;CACjG,OACC,KAAK,SAAS,sBACd,CAAC,KAAK,YACN,KAAK,OAAO,SAAS,gBACrB,KAAK,OAAO,SAAS,YACrB,KAAK,SAAS,SAAS,gBACvB,QAAQ,IAAI,KAAK,SAAS,IAAI;AAEhC;AAEA,SAAS,aAAa,MAAsC,SAAqD;CAChH,OAAO,MAAM,SAAS,oBAAoB,eAAe,KAAK,QAAQ,OAAO;AAC9E;AAEA,SAAS,aAAa,MAA+B;CACpD,IAAI,MAAM,SAAS,aAAa,OAAO,KAAK,UAAU,UAAU,OAAO,KAAK;CAC5E,IAAI,MAAM,SAAS,qBAAqB,KAAK,YAAY,SAAS,GAAG,OAAO;CAC5E,OAAO,KAAK,OAAO,EAAE,EAAE,MAAM,UAAU;AACxC;AA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AW,OAAO,cAAc,UAAU,eAAe,UAAU,UAAU,eAAe,MAAM;AAEpG;AAEA,MAAM,mBAAmB,WAAW;CACnC,MAAM;EACL,MAAM;EACN,MAAM,EACL,aAAa,oEACd;EACA,UAAU,EACT,aACC,kIACF;CACD;CACA,WAAW,SAAS;EACnB,SAAS,MAAM,MAAmB,QAA4B;GAC7D,MAAM,OAAO,aAAa,UAAU,MAAS;GAC7C,IAAI,SAAS,UAAa,eAAe,IAAI,GAC5C,QAAQ,OAAO;IAAE;IAAM,WAAW;IAAe,MAAM,EAAE,QAAQ,KAAK;GAAE,CAAC;EAE3E;EACA,OAAO;GACN,kBAAkB,MAAM;IACvB,IAAI,CAAC,WAAW,KAAK,YAAY,KAAK,UAAU,GAAG,MAAM,MAAM,KAAK,MAAM;GAC3E;GACA,uBAAuB,MAAM;IAC5B,IAAI,KAAK,UAAU,CAAC,WAAW,KAAK,YAAY,KAAK,UAAU,GAAG,MAAM,MAAM,KAAK,MAAM;GAC1F;GACA,qBAAqB,MAAM;IAC1B,IAAI,KAAK,eAAe,QAAQ,MAAM,MAAM,KAAK,MAAM;GACxD;GACA,iBAAiB,MAAM;IACtB,MAAM,MAAM,KAAK,MAAM;GACxB;EACD;CACD;AACD,CAAC;AAED,qBAAe,aAAa;CAC3B,MAAM,EACL,MAAM,6BACP;CACA,OAAO;EACN,mBAAmB;EACnB,kBAAkB;EAClB,iBAAiB;EACjB,uBAAuB;EACvB,mBAAmB;EACnB,sBAAsB;EACtB,sBAAsB;CACvB;AACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"effect.js","names":[],"sources":["../../src/plugins/effect.ts"],"sourcesContent":["import { definePlugin, defineRule } from '@oxlint/plugins';\n\nimport { matchesFileGlob } from '../config.js';\n\nimport type { ESTree } from '@oxlint/plugins';\n\nconst DEFAULT_EDGE_FILES = ['**/main.ts', '**/*.test.ts', '**/scripts/**'];\nconst RUN_METHODS = new Set(['runCallback', 'runFork', 'runPromise', 'runPromiseExit', 'runSync', 'runSyncExit']);\nconst FAIL_METHODS = new Set(['die', 'dieMessage', 'dieSync', 'fail', 'failCause', 'failCauseSync', 'failSync']);\nconst FN_METHODS = new Set(['fn', 'fnUntraced']);\nconst FN_NAMED = new Set(['fn']);\nconst GEN = new Set(['gen']);\nconst GEN_OR_FN = new Set(['gen', ...FN_METHODS]);\nconst DEFAULT_SQL_CLIENTS = ['sql'];\nconst UNSAFE_SQL_METHODS = new Set(['literal', 'unsafe']);\n\nfunction isEffectMember(node: ESTree.Node, methods: Set<string>): node is ESTree.MemberExpression {\n\treturn (\n\t\tnode.type === 'MemberExpression' &&\n\t\t!node.computed &&\n\t\tnode.object.type === 'Identifier' &&\n\t\tnode.object.name === 'Effect' &&\n\t\tnode.property.type === 'Identifier' &&\n\t\tmethods.has(node.property.name)\n\t);\n}\n\nfunction isEffectCall(node: ESTree.Node | null | undefined, methods: Set<string>): node is ESTree.CallExpression {\n\treturn node?.type === 'CallExpression' && isEffectMember(node.callee, methods);\n}\n\nfunction staticString(node: ESTree.Node | undefined) {\n\tif (node?.type === 'Literal' && typeof node.value === 'string') return node.value;\n\tif (node?.type !== 'TemplateLiteral' || node.expressions.length > 0) return undefined;\n\treturn node.quasis[0]?.value.cooked ?? undefined;\n}\n\nfunction isNamedFnFactory(node: ESTree.Node): node is ESTree.CallExpression {\n\treturn isEffectCall(node, FN_NAMED) && staticString(node.arguments[0]) !== undefined;\n}\n\nfunction isEffectGeneratorBody(fn: ESTree.Node) {\n\tif (fn.type !== 'FunctionExpression' || !fn.generator) return false;\n\tconst call = fn.parent;\n\tif (call.type !== 'CallExpression' || !call.arguments.includes(fn)) return false;\n\tif (isEffectMember(call.callee, GEN_OR_FN)) return true;\n\treturn isNamedFnFactory(call.callee);\n}\n\nfunction isEffectFnCall(node: ESTree.Node) {\n\tif (node.type !== 'CallExpression') return false;\n\tif (isNamedFnFactory(node.callee)) return true;\n\treturn isEffectCall(node, FN_METHODS) && node.arguments[0]?.type === 'FunctionExpression';\n}\n\nfunction isGenOrPipedGen(node: ESTree.Node | null | undefined) {\n\tif (node?.type !== 'CallExpression') return false;\n\tconst { callee } = node;\n\tif (\n\t\tcallee.type === 'MemberExpression' &&\n\t\t!callee.computed &&\n\t\tcallee.property.type === 'Identifier' &&\n\t\tcallee.property.name === 'pipe'\n\t) {\n\t\treturn isEffectCall(callee.object, GEN);\n\t}\n\treturn isEffectMember(callee, GEN);\n}\n\nfunction returnedExpression(fn: ESTree.Function | ESTree.ArrowFunctionExpression) {\n\tconst { body } = fn;\n\tif (!body) return undefined;\n\tif (body.type !== 'BlockStatement') return body;\n\tif (body.body.length !== 1) return undefined;\n\tconst [statement] = body.body;\n\treturn statement.type === 'ReturnStatement' ? statement.argument : undefined;\n}\n\nfunction isReusableFunction(fn: ESTree.Function | ESTree.ArrowFunctionExpression) {\n\tif (fn.type === 'FunctionDeclaration') return true;\n\tconst { parent } = fn;\n\tif (parent.type === 'VariableDeclarator') return parent.init === fn;\n\tif (parent.type === 'Property' || parent.type === 'PropertyDefinition') return parent.value === fn;\n\treturn parent.type === 'MethodDefinition' || parent.type === 'ExportDefaultDeclaration';\n}\n\nfunction bindingName(node: ESTree.Node) {\n\tconst { parent } = node;\n\tif (!parent) return undefined;\n\tif (parent.type === 'VariableDeclarator' && parent.init === node && parent.id.type === 'Identifier') {\n\t\treturn parent.id.name;\n\t}\n\tif (\n\t\t(parent.type === 'Property' || parent.type === 'PropertyDefinition') &&\n\t\tparent.value === node &&\n\t\t!parent.computed\n\t) {\n\t\tif (parent.key.type === 'Identifier') return parent.key.name;\n\t\treturn staticString(parent.key);\n\t}\n\treturn undefined;\n}\n\nconst noGenWrapper = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow functions that only wrap and return `Effect.gen`',\n\t\t},\n\t\tmessages: {\n\t\t\tnoGenWrapper:\n\t\t\t\t'Avoid functions that only wrap and return `Effect.gen`. Use `Effect.fn(\"name\")(function* (...) {...})` or `Effect.fnUntraced` instead.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\tfunction check(fn: ESTree.Function | ESTree.ArrowFunctionExpression) {\n\t\t\tif (fn.generator || !isReusableFunction(fn)) return;\n\t\t\tif (isGenOrPipedGen(returnedExpression(fn))) context.report({ node: fn, messageId: 'noGenWrapper' });\n\t\t}\n\t\treturn {\n\t\t\tArrowFunctionExpression: check,\n\t\t\tFunctionDeclaration: check,\n\t\t\tFunctionExpression: check,\n\t\t};\n\t},\n});\n\nconst fnNameMatches = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Require the `Effect.fn` span name to match the binding it is assigned to',\n\t\t},\n\t\tfixable: 'code',\n\t\tmessages: {\n\t\t\tmismatch: '`Effect.fn(\"{{name}}\")` is assigned to `{{binding}}`. Use \"{{binding}}\" or \"<Service>.{{binding}}\".',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tif (!isNamedFnFactory(node.callee)) return;\n\t\t\t\tconst binding = bindingName(node);\n\t\t\t\tconst nameNode = node.callee.arguments[0];\n\t\t\t\tconst name = staticString(nameNode);\n\t\t\t\tif (!binding || name === undefined) return;\n\t\t\t\tif (name === binding || name.endsWith(`.${binding}`)) return;\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: nameNode,\n\t\t\t\t\tmessageId: 'mismatch',\n\t\t\t\t\tdata: { name, binding },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\tconst quote = context.sourceCode.getText(nameNode).at(0) ?? \"'\";\n\t\t\t\t\t\tconst prefix = name.includes('.') ? name.slice(0, name.lastIndexOf('.') + 1) : '';\n\t\t\t\t\t\treturn fixer.replaceText(nameNode, `${quote}${prefix}${binding}${quote}`);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n});\n\nconst returnYieldError = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Require `return yield*` when yielding an error so TypeScript knows execution stops',\n\t\t},\n\t\tfixable: 'code',\n\t\tmessages: {\n\t\t\tmissingReturn: 'Use `return yield* ...` when raising an error so TypeScript knows the generator stops here.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tYieldExpression(node) {\n\t\t\t\tif (!node.delegate || !node.argument || node.parent.type !== 'ExpressionStatement') return;\n\t\t\t\tif (node.argument.type !== 'NewExpression' && !isEffectCall(node.argument, FAIL_METHODS)) return;\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'missingReturn',\n\t\t\t\t\tfix: (fixer) => fixer.insertTextBefore(node, 'return '),\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n});\n\nconst noPipeOnFn = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow `.pipe` on `Effect.fn` / `Effect.fnUntraced`; pass combinators as extra arguments',\n\t\t},\n\t\tmessages: {\n\t\t\tnoPipe:\n\t\t\t\t'Do not use `.pipe` with `Effect.fn`. Pass the combinators as extra arguments: `Effect.fn(\"name\")(function* () {...}, Effect.withSpan(...))`.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tMemberExpression(node) {\n\t\t\t\tif (node.computed || node.property.type !== 'Identifier' || node.property.name !== 'pipe') return;\n\t\t\t\tif (!isEffectFnCall(node.object)) return;\n\t\t\t\tcontext.report({ node: node.property, messageId: 'noPipe' });\n\t\t\t},\n\t\t};\n\t},\n});\n\nconst noThrowInGen = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow `throw` inside `Effect.gen` / `Effect.fn` generators',\n\t\t},\n\t\tmessages: {\n\t\t\tnoThrow:\n\t\t\t\t'Do not throw inside an Effect generator; a throw becomes a defect. Use `return yield* new SomeError(...)` instead.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tThrowStatement(node) {\n\t\t\t\tlet current: ESTree.Node = node.parent;\n\t\t\t\twhile (\n\t\t\t\t\tcurrent.type !== 'FunctionExpression' &&\n\t\t\t\t\tcurrent.type !== 'FunctionDeclaration' &&\n\t\t\t\t\tcurrent.type !== 'ArrowFunctionExpression' &&\n\t\t\t\t\tcurrent.type !== 'Program'\n\t\t\t\t) {\n\t\t\t\t\tcurrent = current.parent;\n\t\t\t\t}\n\t\t\t\tif (isEffectGeneratorBody(current)) context.report({ node, messageId: 'noThrow' });\n\t\t\t},\n\t\t};\n\t},\n});\n\nconst noRunOutsideEdge = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Restrict `Effect.run*` to entrypoints, tests and scripts',\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: 'object',\n\t\t\t\tadditionalProperties: false,\n\t\t\t\tproperties: {\n\t\t\t\t\tallow: {\n\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\titems: { type: 'string', minLength: 1 },\n\t\t\t\t\t\tuniqueItems: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tmessages: {\n\t\t\tnoRun:\n\t\t\t\t'`Effect.{{method}}` belongs at the edge (`NodeRuntime.runMain`, `ManagedRuntime`). Allowed files: {{allow}}.',\n\t\t},\n\t\tdefaultOptions: [{ allow: [...DEFAULT_EDGE_FILES] }],\n\t},\n\tcreateOnce(context) {\n\t\tlet allow = DEFAULT_EDGE_FILES;\n\t\treturn {\n\t\t\tbefore() {\n\t\t\t\tconst options = context.options[0] as { allow?: string[] } | undefined;\n\t\t\t\tallow = options?.allow ?? DEFAULT_EDGE_FILES;\n\t\t\t\treturn !matchesFileGlob(context, allow);\n\t\t\t},\n\t\t\tCallExpression(node) {\n\t\t\t\tif (!isEffectMember(node.callee, RUN_METHODS)) return;\n\t\t\t\tconst method = node.callee.property.type === 'Identifier' ? node.callee.property.name : '';\n\t\t\t\tcontext.report({ node, messageId: 'noRun', data: { method, allow: allow.join(', ') } });\n\t\t\t},\n\t\t};\n\t},\n});\n\nfunction sqlClientName(node: ESTree.Node) {\n\tif (node.type === 'Identifier') return node.name;\n\tif (node.type === 'MemberExpression' && !node.computed && node.property.type === 'Identifier') {\n\t\treturn node.property.name;\n\t}\n\treturn undefined;\n}\n\nconst noUnsafeSql = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Disallow non-constant SQL text in `sql.unsafe` and `sql.literal`',\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: 'object',\n\t\t\t\tadditionalProperties: false,\n\t\t\t\tproperties: {\n\t\t\t\t\tclientNames: {\n\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\titems: { type: 'string', minLength: 1 },\n\t\t\t\t\t\tuniqueItems: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tmessages: {\n\t\t\tdynamicSql:\n\t\t\t\t'`{{client}}.{{method}}` with non-constant text can lead to SQL injection. Interpolate values in the `sql` tagged template and use `sql(identifier)` or a whitelist for identifiers and ORDER BY.',\n\t\t},\n\t\tdefaultOptions: [{ clientNames: [...DEFAULT_SQL_CLIENTS] }],\n\t},\n\tcreateOnce(context) {\n\t\tlet clients = new Set(DEFAULT_SQL_CLIENTS);\n\t\treturn {\n\t\t\tbefore() {\n\t\t\t\tconst options = context.options[0] as { clientNames?: string[] } | undefined;\n\t\t\t\tclients = new Set(options?.clientNames ?? DEFAULT_SQL_CLIENTS);\n\t\t\t},\n\t\t\tCallExpression(node) {\n\t\t\t\tconst { callee } = node;\n\t\t\t\tif (callee.type !== 'MemberExpression' || callee.computed || callee.property.type !== 'Identifier') return;\n\t\t\t\tconst method = callee.property.name;\n\t\t\t\tif (!UNSAFE_SQL_METHODS.has(method)) return;\n\t\t\t\tconst client = sqlClientName(callee.object);\n\t\t\t\tif (client === undefined || !clients.has(client)) return;\n\t\t\t\tif (node.arguments.length === 0 || staticString(node.arguments[0]) !== undefined) return;\n\t\t\t\tcontext.report({ node: node.arguments[0], messageId: 'dynamicSql', data: { client, method } });\n\t\t\t},\n\t\t};\n\t},\n});\n\nfunction isEffectModule(source: string) {\n\treturn source === 'effect' || source.startsWith('effect/') || source.startsWith('@effect/');\n}\n\nfunction isTypeOnly(\n\tkind: string | undefined,\n\tspecifiers: readonly { type: string; importKind?: string; exportKind?: string }[],\n) {\n\tif (kind === 'type') return true;\n\treturn (\n\t\tspecifiers.length > 0 &&\n\t\tspecifiers.every((specifier) => specifier.importKind === 'type' || specifier.exportKind === 'type')\n\t);\n}\n\nconst typesOnlyImports = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Allow only type imports from `effect`, `effect/*` and `@effect/*`',\n\t\t},\n\t\tmessages: {\n\t\t\tvalueImport:\n\t\t\t\t'`{{source}}` is a runtime import. This package must not ship the Effect runtime; use `import type` or inline `type` specifiers.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\tfunction check(node: ESTree.Node, source: ESTree.Node | null) {\n\t\t\tconst name = staticString(source ?? undefined);\n\t\t\tif (name !== undefined && isEffectModule(name)) {\n\t\t\t\tcontext.report({ node, messageId: 'valueImport', data: { source: name } });\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tImportDeclaration(node) {\n\t\t\t\tif (!isTypeOnly(node.importKind, node.specifiers)) check(node, node.source);\n\t\t\t},\n\t\t\tExportNamedDeclaration(node) {\n\t\t\t\tif (node.source && !isTypeOnly(node.exportKind, node.specifiers)) check(node, node.source);\n\t\t\t},\n\t\t\tExportAllDeclaration(node) {\n\t\t\t\tif (node.exportKind !== 'type') check(node, node.source);\n\t\t\t},\n\t\t\tImportExpression(node) {\n\t\t\t\tcheck(node, node.source);\n\t\t\t},\n\t\t};\n\t},\n});\n\nexport default definePlugin({\n\tmeta: {\n\t\tname: 'eslint-plugin-mahir-effect',\n\t},\n\trules: {\n\t\t'fn-name-matches': fnNameMatches,\n\t\t'no-gen-wrapper': noGenWrapper,\n\t\t'no-pipe-on-fn': noPipeOnFn,\n\t\t'no-run-outside-edge': noRunOutsideEdge,\n\t\t'no-throw-in-gen': noThrowInGen,\n\t\t'no-unsafe-sql': noUnsafeSql,\n\t\t'return-yield-error': returnYieldError,\n\t\t'types-only-imports': typesOnlyImports,\n\t},\n});\n"],"mappings":";;;;AAMA,MAAM,qBAAqB;CAAC;CAAc;CAAgB;AAAe;AACzE,MAAM,8BAAc,IAAI,IAAI;CAAC;CAAe;CAAW;CAAc;CAAkB;CAAW;AAAa,CAAC;AAChH,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAO;CAAc;CAAW;CAAQ;CAAa;CAAiB;AAAU,CAAC;AAC/G,MAAM,6BAAa,IAAI,IAAI,CAAC,MAAM,YAAY,CAAC;AAC/C,MAAM,2BAAW,IAAI,IAAI,CAAC,IAAI,CAAC;AAC/B,MAAM,sBAAM,IAAI,IAAI,CAAC,KAAK,CAAC;AAC3B,MAAM,4BAAY,IAAI,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;AAChD,MAAM,sBAAsB,CAAC,KAAK;AAClC,MAAM,qCAAqB,IAAI,IAAI,CAAC,WAAW,QAAQ,CAAC;AAExD,SAAS,eAAe,MAAmB,SAAuD;CACjG,OACC,KAAK,SAAS,sBACd,CAAC,KAAK,YACN,KAAK,OAAO,SAAS,gBACrB,KAAK,OAAO,SAAS,YACrB,KAAK,SAAS,SAAS,gBACvB,QAAQ,IAAI,KAAK,SAAS,IAAI;AAEhC;AAEA,SAAS,aAAa,MAAsC,SAAqD;CAChH,OAAO,MAAM,SAAS,oBAAoB,eAAe,KAAK,QAAQ,OAAO;AAC9E;AAEA,SAAS,aAAa,MAA+B;CACpD,IAAI,MAAM,SAAS,aAAa,OAAO,KAAK,UAAU,UAAU,OAAO,KAAK;CAC5E,IAAI,MAAM,SAAS,qBAAqB,KAAK,YAA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