@imranbarbhuiya/oxc-config 0.3.0 → 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 CHANGED
@@ -152,10 +152,19 @@ 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
 
158
- The fragment also relaxes rules that fire on idiomatic Effect code: `func-names` ignores generators, `require-yield` and `unicorn/throw-new-error` are off, and `no-use-before-define` allows classes referenced from inner scopes, so errors can be declared after the services that use them.
159
+ The fragment also turns off or relaxes rules that fire on idiomatic Effect code. Oxlint has no way to scope a rule to files that use Effect, so these apply to every file the fragment covers:
160
+
161
+ - `no-redeclare` is off, so a schema and its type can share a name (`const UserId = Schema.String.pipe(Schema.brand('UserId'))` with `type UserId = typeof UserId.Type`). Oxlint has no TypeScript-aware variant that allows value and type pairs. Redeclared `let`, `const` and `class` bindings are still errors from the parser and TypeScript
162
+ - `promise/prefer-await-to-callbacks`, `promise/prefer-await-to-then` and `unicorn/prefer-top-level-await` are off, because they flag `Effect.catch`, `Effect.catchTag`, `Effect.tapError` and `Stream.catch` as Promise chains or Node-style callbacks
163
+ - `require-yield` and `unicorn/throw-new-error` are off
164
+ - `func-names` ignores generators
165
+ - `no-use-before-define` allows classes referenced from inner scopes, so errors can be declared after the services that use them
166
+
167
+ Extend `effect` after `common` and `typescript` so these settings win.
159
168
 
160
169
  Change the allowed run files:
161
170
 
@@ -168,7 +177,27 @@ export default defineConfig({
168
177
  });
169
178
  ```
170
179
 
171
- `effect-types-only` is for UI packages that share types with an Effect backend but should not ship the Effect runtime. It sets `no-restricted-imports` for `effect`, `effect/*` and `@effect/*` with `allowTypeImports: true`. Do not combine it with `effect`, because both configure `no-restricted-imports` and the last one wins.
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
+
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:
192
+
193
+ ```ts
194
+ export default defineConfig({
195
+ extends: [common, typescript, module, native, effectTypesOnly],
196
+ rules: {
197
+ 'no-restricted-imports': [2, { paths: [{ name: 'react-native', importNames: ['Image'] }] }],
198
+ },
199
+ });
200
+ ```
172
201
 
173
202
  ## Unistyles
174
203
 
@@ -1,19 +1,9 @@
1
1
  //#region src/effect-types-only.d.ts
2
2
  declare const config: {
3
3
  plugins: ("eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "jsdoc" | "jest" | "vitest" | "jsx-a11y" | "nextjs" | "react-perf" | "promise" | "node" | "vue")[];
4
+ jsPlugins: import("oxlint").ExternalPluginEntry[];
4
5
  rules: {
5
- 'no-restricted-imports': [number, {
6
- paths: {
7
- name: string;
8
- message: string;
9
- allowTypeImports: true;
10
- }[];
11
- patterns: {
12
- group: string[];
13
- message: string;
14
- allowTypeImports: true;
15
- }[];
16
- }];
6
+ 'mahir-effect/types-only-imports': number;
17
7
  };
18
8
  };
19
9
  //#endregion
@@ -1,22 +1,11 @@
1
- import { nativePlugins } from "./config.js";
1
+ import { localPlugin, nativePlugins } from "./config.js";
2
2
  import { defineConfig } from "oxlint";
3
3
 
4
4
  //#region src/effect-types-only.ts
5
- const message = "UI uses generated OpenAPI types and openapi-fetch; import Effect types only.";
6
5
  const config = defineConfig({
7
6
  plugins: nativePlugins,
8
- rules: { "no-restricted-imports": [2, {
9
- paths: [{
10
- name: "effect",
11
- message,
12
- allowTypeImports: true
13
- }],
14
- patterns: [{
15
- group: ["effect/*", "@effect/*"],
16
- message,
17
- allowTypeImports: true
18
- }]
19
- }] }
7
+ jsPlugins: [localPlugin("mahir-effect", "./plugins/effect.js")],
8
+ rules: { "mahir-effect/types-only-imports": 2 }
20
9
  });
21
10
 
22
11
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"effect-types-only.js","names":[],"sources":["../src/effect-types-only.ts"],"sourcesContent":["import { defineConfig } from 'oxlint';\n\nimport { nativePlugins } from './config.js';\n\nconst message = 'UI uses generated OpenAPI types and openapi-fetch; import Effect types only.';\n\nconst config = defineConfig({\n\tplugins: nativePlugins,\n\trules: {\n\t\t'no-restricted-imports': [\n\t\t\t2,\n\t\t\t{\n\t\t\t\tpaths: [{ name: 'effect', message, allowTypeImports: true }],\n\t\t\t\tpatterns: [{ group: ['effect/*', '@effect/*'], message, allowTypeImports: true }],\n\t\t\t},\n\t\t],\n\t},\n});\n\nexport default config;\n"],"mappings":";;;;AAIA,MAAM,UAAU;AAEhB,MAAM,SAAS,aAAa;CAC3B,SAAS;CACT,OAAO,EACN,yBAAyB,CACxB,GACA;EACC,OAAO,CAAC;GAAE,MAAM;GAAU;GAAS,kBAAkB;EAAK,CAAC;EAC3D,UAAU,CAAC;GAAE,OAAO,CAAC,YAAY,WAAW;GAAG;GAAS,kBAAkB;EAAK,CAAC;CACjF,CACD,EACD;AACD,CAAC"}
1
+ {"version":3,"file":"effect-types-only.js","names":[],"sources":["../src/effect-types-only.ts"],"sourcesContent":["import { defineConfig } from 'oxlint';\n\nimport { localPlugin, nativePlugins } from './config.js';\n\nconst config = defineConfig({\n\tplugins: nativePlugins,\n\tjsPlugins: [localPlugin('mahir-effect', './plugins/effect.js')],\n\trules: {\n\t\t'mahir-effect/types-only-imports': 2,\n\t},\n});\n\nexport default config;\n"],"mappings":";;;;AAIA,MAAM,SAAS,aAAa;CAC3B,SAAS;CACT,WAAW,CAAC,YAAY,gBAAgB,qBAAqB,CAAC;CAC9D,OAAO,EACN,mCAAmC,EACpC;AACD,CAAC"}
package/dist/effect.js CHANGED
@@ -9,6 +9,7 @@ const rules = {
9
9
  "mahir-effect/no-pipe-on-fn": 2,
10
10
  "mahir-effect/no-run-outside-edge": 2,
11
11
  "mahir-effect/no-throw-in-gen": 2,
12
+ "mahir-effect/no-unsafe-sql": 2,
12
13
  "mahir-effect/return-yield-error": 2,
13
14
  "no-restricted-imports": [2, {
14
15
  paths: [
@@ -62,7 +63,11 @@ const rules = {
62
63
  functions: false,
63
64
  variables: true
64
65
  }],
66
+ "no-redeclare": 0,
67
+ "promise/prefer-await-to-callbacks": 0,
68
+ "promise/prefer-await-to-then": 0,
65
69
  "require-yield": 0,
70
+ "unicorn/prefer-top-level-await": 0,
66
71
  "unicorn/throw-new-error": 0
67
72
  };
68
73
  const config = defineConfig({
@@ -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'require-yield': 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,iBAAiB;CACjB,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"}
@@ -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,94 @@ 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
+ });
285
+ function isEffectModule(source) {
286
+ return source === "effect" || source.startsWith("effect/") || source.startsWith("@effect/");
287
+ }
288
+ function isTypeOnly(kind, specifiers) {
289
+ if (kind === "type") return true;
290
+ return specifiers.length > 0 && specifiers.every((specifier) => specifier.importKind === "type" || specifier.exportKind === "type");
291
+ }
292
+ const typesOnlyImports = defineRule({
293
+ meta: {
294
+ type: "problem",
295
+ docs: { description: "Allow only type imports from `effect`, `effect/*` and `@effect/*`" },
296
+ messages: { valueImport: "`{{source}}` is a runtime import. This package must not ship the Effect runtime; use `import type` or inline `type` specifiers." }
297
+ },
298
+ createOnce(context) {
299
+ function check(node, source) {
300
+ const name = staticString(source ?? void 0);
301
+ if (name !== void 0 && isEffectModule(name)) context.report({
302
+ node,
303
+ messageId: "valueImport",
304
+ data: { source: name }
305
+ });
306
+ }
307
+ return {
308
+ ImportDeclaration(node) {
309
+ if (!isTypeOnly(node.importKind, node.specifiers)) check(node, node.source);
310
+ },
311
+ ExportNamedDeclaration(node) {
312
+ if (node.source && !isTypeOnly(node.exportKind, node.specifiers)) check(node, node.source);
313
+ },
314
+ ExportAllDeclaration(node) {
315
+ if (node.exportKind !== "type") check(node, node.source);
316
+ },
317
+ ImportExpression(node) {
318
+ check(node, node.source);
319
+ }
320
+ };
321
+ }
322
+ });
233
323
  var effect_default = definePlugin({
234
324
  meta: { name: "eslint-plugin-mahir-effect" },
235
325
  rules: {
@@ -238,7 +328,9 @@ var effect_default = definePlugin({
238
328
  "no-pipe-on-fn": noPipeOnFn,
239
329
  "no-run-outside-edge": noRunOutsideEdge,
240
330
  "no-throw-in-gen": noThrowInGen,
241
- "return-yield-error": returnYieldError
331
+ "no-unsafe-sql": noUnsafeSql,
332
+ "return-yield-error": returnYieldError,
333
+ "types-only-imports": typesOnlyImports
242
334
  }
243
335
  });
244
336
 
@@ -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\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},\n});\n"],"mapp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EACD;CACD;AACD,CAAC;AAED,MAAM,mBAAmB,WAAW;CACnC,MAAM;EACL,MAAM;EACN,MAAM,EACL,aAAa,2DACd;EACA,QAAQ,CACP;GACC,MAAM;GACN,sBAAsB;GACtB,YAAY,EACX,OAAO;IACN,MAAM;IACN,OAAO;KAAE,MAAM;KAAU,WAAW;IAAE;IACtC,aAAa;GACd,EACD;EACD,CACD;EACA,UAAU,EACT,OACC,+GACF;EACA,gBAAgB,CAAC,EAAE,OAAO,CAAC,GAAG,kBAAkB,EAAE,CAAC;CACpD;CACA,WAAW,SAAS;EACnB,IAAI,QAAQ;EACZ,OAAO;GACN,SAAS;IAER,QADgB,QAAQ,QAAQ,EACjB,EAAE,SAAS;IAC1B,OAAO,CAAC,gBAAgB,SAAS,KAAK;GACvC;GACA,eAAe,MAAM;IACpB,IAAI,CAAC,eAAe,KAAK,QAAQ,WAAW,GAAG;IAC/C,MAAM,SAAS,KAAK,OAAO,SAAS,SAAS,eAAe,KAAK,OAAO,SAAS,OAAO;IACxF,QAAQ,OAAO;KAAE;KAAM,WAAW;KAAS,MAAM;MAAE;MAAQ,OAAO,MAAM,KAAK,IAAI;KAAE;IAAE,CAAC;GACvF;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;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,YAAY,SAAS,GAAG,OAAO;CAC5E,OAAO,K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A,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,iBAAiB;EACjB,sBAAsB;EACtB,sBAAsB;CACvB;AACD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imranbarbhuiya/oxc-config",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Shared Oxlint and Oxfmt configs for JavaScript and TypeScript projects",
5
5
  "keywords": [
6
6
  "config",