@2digits/oxlint-plugin 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,9 @@ Custom [Oxlint JavaScript plugin](https://oxc.rs/docs/guide/usage/linter/writing
5
5
 
6
6
  The recommended set is enabled by default by `@2digits/oxlint-config`. The opt-in `prefer-effect-filesystem` and
7
7
  `prefer-effect-path` rules are excluded because the configured `@effect/tsgo/nodeBuiltinImport` diagnostic already
8
- enforces those imports more broadly. To register the plugin directly:
8
+ enforces those imports more broadly. `prefer-effect-http-status` is recommended at `warn`, because it only names
9
+ well-known numbers (see [Effect HTTP modules](#effect-http-modules)); every other recommended rule is an error. To
10
+ register the plugin directly:
9
11
 
10
12
  ```ts
11
13
  import { defineConfig } from 'oxlint';
@@ -20,7 +22,7 @@ export default defineConfig({
20
22
 
21
23
  ## Rules
22
24
 
23
- The package exports all rules as `rules`, their names as `RuleName`, and the default error-level configuration as
25
+ The package exports all rules as `rules`, their names as `RuleName`, and the default configuration as
24
26
  `recommendedRules`.
25
27
 
26
28
  - Copied and adapted Effect practices: `avoid-data-tagged-error`, `ban-error-string`,
@@ -29,8 +31,13 @@ The package exports all rules as `rules`, their names as `RuleName`, and the def
29
31
  `prefer-equal`, and `prefer-struct-assign`. See [Effect modules over native logic](#effect-modules-over-native-logic).
30
32
  - Syntax-safe Effect diagnostics proposed in open `Effect-TS/tsgo` issues: the remaining `cors-*`, `dual-*`,
31
33
  `no-*`, `prefer-*`, `preserve-*`, and `require-*` Effect rules.
32
- - Effect v4 API guidance for Array, DateTime, Duration, Encoding, FileSystem, Filter, Headers, Match, Path, and Url,
33
- plus interruptible `Effect.tryPromise` thunks.
34
+ - Effect v4 API guidance for Array, DateTime, Duration, binary encodings, FileSystem, Filter, Headers, Match, Path, and Url,
35
+ plus interruptible `Effect.tryPromise` thunks. Cookies, HttpMethod, HttpStatus, UrlParams and status range checks are covered
36
+ in [Effect HTTP modules](#effect-http-modules).
37
+ - Structured text formats: `prefer-effect-ndjson`, `prefer-effect-csv`, and `prefer-effect-format-parser`. See
38
+ [Effect encoding formats](#effect-encoding-formats).
39
+ - Effect encoding streams and archives: `prefer-effect-sse`, `no-manual-sse`, and `prefer-effect-archive`. See
40
+ [Server-Sent Events and archives](#server-sent-events-and-archives).
34
41
  - Effect and Alchemy import policy: namespace imports from PascalCase submodule entrypoints, canonical Effect aliases,
35
42
  and no root-barrel module imports. `@effect/vitest` and lowercase unstable barrels are intentionally exempt.
36
43
  - Alchemy v2 practices: every other `alchemy-*` rule.
@@ -218,16 +225,44 @@ Imported, mutable, or otherwise composed configs remain unknown and retain the d
218
225
  general inference of `Config<A>`. Parameterized function defaults remain excluded. There is no autofix: eagerly evaluating
219
226
  or unwrapping a thunk could change side effects or an intentional function value.
220
227
 
228
+ ## Effect encoding formats
229
+
230
+ These rules only run in files that import Effect and report without autofixes. They point at the `effect/encoding`
231
+ modules for structured text. Plain `JSON.parse` and `JSON.stringify` are left to the `globalJson` and
232
+ `globalJsonInEffect` diagnostics from `@effect/tsgo`, which suggest Schema.
233
+
234
+ - `prefer-effect-ndjson` reports `JSON.parse` on each line of text split on line breaks (`text.split('\n').map(JSON.parse)`,
235
+ a per-line callback, or `for (const line of lines)`), and `JSON.stringify` results joined with line breaks. Use
236
+ `Ndjson.decodeString`/`decodeSchemaString` and `Ndjson.encodeString`/`encodeSchemaString`.
237
+ - `prefer-effect-csv` reports each line of split text split again on `,`, `;` or a tab, and rows whose cells are joined
238
+ with one of those and then joined with line breaks. Use `Csv.decodeString`/`decodeSchemaString` and
239
+ `Csv.encodeString`/`encodeSchemaString`, which quote cells that contain the delimiter, quotes, or line breaks. A single
240
+ comma list (`scopes.split(',')`), a multi-character separator such as `', '` or `'||'`, and line splits without a
241
+ second split are not CSV and are allowed.
242
+ - `prefer-effect-format-parser` reports parsers from third-party packages: `yaml` and `js-yaml` (use `Yaml`),
243
+ `smol-toml`, `@iarna/toml` and `toml` (`Toml`), `ini` (`Ini`), `json5` (`Json5`), `jsonc-parser`, `comment-json` and
244
+ `strip-json-comments` (`Jsonc`), `papaparse`, `csv-parse`, `csv-stringify`, `csv-parser` and `fast-csv` (`Csv`),
245
+ `fast-xml-parser`'s `XMLParser`, `xml2js`, `sax` and `@xmldom/xmldom`'s `DOMParser` (`Xml`), `ndjson` (`Ndjson`), and
246
+ `stream-json` and `@streamparser/json` (`JsonArray`). Effect's Yaml, Toml, Ini, Json5, and Jsonc only parse, so
247
+ serializers such as `YAML.stringify`, `js-yaml`'s `dump` and `smol-toml`'s `stringify` stay allowed.
248
+
221
249
  ## Effect modules over native logic
222
250
 
223
- These rules only run in files that import Effect, report without autofixes, and complement the `preferEffectArray`,
224
- `preferEffectRecord`, and `preferEffectString` diagnostics from `@effect/tsgo`.
251
+ These rules only run in files that import Effect and complement the `preferEffectArray`, `preferEffectRecord`, and
252
+ `preferEffectString` diagnostics from `@effect/tsgo`. `prefer-effect-predicate` autofixes and `prefer-struct-assign`
253
+ offers a suggestion; the others report only.
225
254
 
226
255
  - `prefer-effect-predicate` reports `typeof x === '…'`, comparisons with `undefined` or `null`, and `instanceof` on
227
- built-ins such as `String`, `Date`, or `Array`, and names the guard to use: `P.isString`, `P.not(P.isNumber)`,
228
- `P.isNotUndefined`, `P.isNotNullish`, `P.isDate`, or `Arr.isArray`. Two suggestions are not one-to-one rewrites, and
229
- their messages say so: `instanceof String` (and `Number`, `Boolean`, `BigInt`, `Symbol`) only matches boxed objects
230
- while `P.isString` matches primitives, and `P.isObjectOrArray` rejects `null`, which `typeof x === 'object'` accepts.
256
+ built-ins such as `String`, `Date`, or `Array`, and names the guard to use: `P.isString`, `!P.isNumber`,
257
+ `P.isNotUndefined`, `P.isNotNullish`, `P.isDate`, or `Arr.isArray`. Negated `typeof` checks become `!P.isNumber(x)`,
258
+ because `P.not(P.isNumber)` does not narrow. Checks that Effect implements the same way are autofixed, adding the
259
+ `effect/Predicate` import when the file lacks one: `typeof` (except `'object'`), `null`/`undefined` comparisons, and
260
+ `instanceof` `Date`, `Error`, `RegExp` and `Uint8Array`. Checks with a different result or type get a suggestion
261
+ instead: `P.isObjectOrArray` rejects `null`, which `typeof x === 'object'` accepts; `Arr.isArray`, `P.isMap` and
262
+ `P.isSet` narrow to `unknown[]`, `Map<unknown, unknown>` and `Set<unknown>` where `instanceof` gives `any`;
263
+ `P.isFunction` and `P.isPromise` check `typeof` and the shape, not the class.
264
+ `instanceof String` (and `Number`, `Boolean`, `BigInt`, `Symbol`) only matches boxed objects while `P.isString`
265
+ matches primitives, so it is reported without a fix. Checks with comments inside are reported without a fix.
231
266
  Checks inside type guards (`(u): u is Foo =>`) and `typeof` on undeclared globals such as `typeof window` are allowed.
232
267
  `Array.isArray` is left to `preferEffectArray`.
233
268
  - `prefer-effect-array-ops` reports `[...new Set(xs)]` and `Array.from(new Set(xs))` (use `Arr.dedupe`), `xs[0]` (use
@@ -246,7 +281,125 @@ These rules only run in files that import Effect, report without autofixes, and
246
281
  overrides with literal values (`{ ...meta, fixable: 'code' }` would widen `'code'` to `string`) and overrides that
247
282
  are callbacks with untyped parameters (`{ ...server, addTool: Effect.fn(function* (registration) {}) }`), which
248
283
  lose their contextual type. `Struct.assign` also drops a class instance's prototype, so rebuild Schema and Data class
249
- instances with their constructor.
284
+ instances with their constructor. Two-object merges and copies get a `Struct.assign` suggestion rather than an
285
+ autofix, because `Struct.assign` types its result from its generic parameters.
286
+
287
+ ## Effect HTTP modules
288
+
289
+ These rules point hand-written HTTP logic at the `effect/http` modules. They only run in files that import Effect and
290
+ have no autofixes.
291
+
292
+ - `prefer-effect-match-status` reports a hand-written 2xx range check on a response, such as
293
+ `response.status < 200 || response.status >= 300` or `res.status >= 200 && res.status <= 299` (also on
294
+ `statusCode`). Use `HttpClientResponse.filterStatusOk`, or `HttpClientResponse.matchStatus` with a `'2xx'` case; on a
295
+ native fetch `Response`, read `response.ok`. A bare `status` variable is skipped, because it is usually a fixture or
296
+ protocol field, and other ranges such as retryable `>= 500` checks are left alone: `HttpStatus` has no range
297
+ predicates.
298
+ - `prefer-effect-url-params` reports query strings built by hand, where a value is interpolated or concatenated
299
+ straight after `?key=` or `&key=` (`` `${base}/tags?search=${encodeURIComponent(q)}` ``, `'/users?page=' + page`), and
300
+ `new URLSearchParams()` built from nothing or from an object or array literal. Use `HttpClientRequest.setUrlParam(s)`,
301
+ the `urlParams` request option, or `UrlParams.fromInput` with `UrlParams.toString`. `new URLSearchParams(text)` parses
302
+ a string, which `UrlParams` cannot, so it is allowed, as are tagged templates such as `` sql`…` ``. `.test` and `.spec`
303
+ files are skipped, because tests write raw wire URLs and form bodies on purpose.
304
+ - `prefer-effect-http-method` reports an array literal or union type of six or more different HTTP method strings,
305
+ such as `Schema.Literals(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'])`. Use the
306
+ `HttpMethod.HttpMethod` type, `HttpMethod.all` or `HttpMethod.isHttpMethod`, which also include `TRACE` and `QUERY`.
307
+ Shorter lists are usually deliberate subsets, such as the safe methods or the methods of one route, and method
308
+ comparisons are left alone: `HttpMethod` has no constants to compare with, and `HttpMethod.hasBody` treats
309
+ `OPTIONS` and `TRACE` as bodyless, so it is not a drop-in for `method === 'GET' || method === 'HEAD'`.
310
+ - `prefer-effect-http-status` (warning) reports known status code numbers passed to Effect HTTP APIs:
311
+ `HttpApiSchema.status(404)`, which accepts `'NotFound'` directly, plus `HttpApiSchema.Empty(204)`,
312
+ `{ httpApiStatus: 401 }` annotations, `HttpServerResponse.setStatus(429)` and the `status` option of
313
+ `HttpServerResponse` constructors, which take `HttpStatus.fromLiteral('Unauthorized')`. Plain objects, comparisons and
314
+ test fakes are not checked. It is recommended at `warn` rather than `error`, because it only names numbers every
315
+ reader knows.
316
+ - `prefer-effect-cookies` reports cookie logic written by hand: reading or writing `document.cookie`; splitting or
317
+ matching raw cookie text (`request.headers.cookie.split('; ')`, `headers.get('cookie')?.split(';')`,
318
+ `/token=([^;]*)/.exec(cookieHeader)`); building a cookie with interpolated attributes
319
+ (`` `${name}=${value}; Path=/; HttpOnly` `` or `token + '; Max-Age=3600'`); and searching a Set-Cookie string for an
320
+ attribute (`cookie.includes('; Secure')`, `Str.includes('HttpOnly')`). Use `HttpServerRequest` cookies or
321
+ `schemaCookies`, `Cookies.parseHeader`, `Cookies.fromSetCookie` with `Cookies.get(…).options`, `Cookies.makeCookie`
322
+ with `Cookies.serializeCookie`, or `HttpServerResponse.setCookie`. Raw text counts as cookie text when it comes from
323
+ a `get('cookie')` or `get('set-cookie')` header read or a binding or member whose name contains `cookie`. Plain
324
+ Set-Cookie strings are fixtures or expected wire values and are allowed, as are header names in lists and sets and
325
+ Set-Cookie values forwarded unchanged, which `Cookies` would normalize.
326
+
327
+ ## Effect binary encodings
328
+
329
+ These rules push Base64, Base64Url, and hexadecimal conversions to the Effect v4
330
+ [`effect/encoding`](https://effect.website/docs/v4/api/effect/encoding/Base64) modules. Their encoders accept bytes or
331
+ UTF-8 text and run the same in Node.js, browsers, and Workers, and their decoders return a `Result` with an
332
+ `EncodingError` instead of throwing.
333
+
334
+ - `prefer-effect-encoding` reports, in files that import Effect, `atob` and `btoa` (also through `globalThis`),
335
+ `Buffer.from(x, 'base64' | 'base64url' | 'hex')`, `.toString('base64' | 'base64url' | 'hex')` on any value (such as
336
+ `Buffer.from(bytes).toString('base64')`), and `Uint8Array.fromBase64`/`fromHex`, and names the `Base64`,
337
+ `Base64Url`, or `Hex` function to use. `atob` and `btoa` work on binary strings, not UTF-8 text, so they point to
338
+ `Base64.decode` and `Base64.encode` on bytes; `Uint8Array.fromBase64(x, { alphabet: 'base64url' })` points to
339
+ `Base64Url.decode`. `Uint8Array#toBase64` and `#toHex` are allowed: they do not throw and Effect's `Base64.encode`
340
+ uses them itself.
341
+ - `no-manual-encoding` reports, in files that import Effect, hand-written conversions: a `replace`/`replaceAll` chain
342
+ or a `pipe` of `Str.replace`/`Str.replaceAll` steps that swaps both `+`/`-` and `/`/`_` (use `Base64Url.encode` or
343
+ `Base64Url.decode`), and `byte.toString(16)` padded to two digits with `'0'` through `.padStart`, `Str.padStart`,
344
+ or `pipe` (use `Hex.encode`). A single swap, such as `.replace(/\+/g, ' ')`, is allowed.
345
+ - `no-encoding-get-or-throw` reports `Result.getOrThrow` and `Result.getOrThrowWith` on a `Base64`, `Base64Url`, or
346
+ `Hex` decoder, directly or as a `pipe` step with only `Result.map` steps before it, because it turns the typed
347
+ `EncodingError` back into an exception. Use `yield* Effect.fromResult(Base64.decode(x))`, `Result.match`, or
348
+ `Result.getOrElse`. Effect v4 `Result` values cannot be yielded in `Effect.gen` directly.
349
+
350
+ `SchemaBinary` has no native counterpart that is worth a syntax rule, so no rule targets it.
351
+
352
+ ## Server-Sent Events and archives
353
+
354
+ These rules only run in files that import Effect and report without autofixes. They point at the `Sse`, `Tar` and `Zip`
355
+ modules of `effect/encoding`.
356
+
357
+ - `prefer-effect-sse` reports runtime imports of Server-Sent Events libraries (`eventsource-parser`, `eventsource`,
358
+ `eventsource-client`, `@microsoft/fetch-event-source`, `fetch-event-stream`, `better-sse`, `sse.js` and similar) and
359
+ `new EventSource(…)` on the global. Read event streams with `HttpClient` and `Sse.decode`, `Sse.decodeSchema` or
360
+ `Sse.makeParser`, and write them with `Sse.encode` or `HttpApiSchema.StreamSse`. `Sse.decode` reports `retry:` as a
361
+ `Retry` failure, so reconnecting is up to the caller, as with `Stream.retry`.
362
+ - `no-manual-sse` reports string literals, template literals and `+` concatenations that build an event frame: a
363
+ `data:`, `event:`, `id:` or `retry:` field line in text that ends with the blank line that dispatches it. A
364
+ hand-written frame splits on a line break inside `data`, and an `id` or `event` that contains one injects fields;
365
+ `Sse.encoder.write` handles both. It also reports `startsWith('data: ')` (and `event: `, `id: `, `retry: `, as a
366
+ method or `Str.startsWith`), the usual hand-written parser. Comment frames such as `': ping\n\n'` are allowed
367
+ because `Sse.encoder` cannot write them, and `startsWith('data:')` without a space is allowed because it also matches
368
+ data URLs.
369
+ - `prefer-effect-archive` reports runtime imports of tar and zip codecs: `tar-stream`, `nanotar`, `modern-tar`,
370
+ `tar-js` and `js-untar` (use `Tar`); `jszip`, `adm-zip`, `yauzl`, `yazl`, `unzipper`, `node-stream-zip`,
371
+ `client-zip`, `zip-stream` and `@zip.js/zip.js` (use `Zip`); `archiver` (either); and the zip exports of `fflate`,
372
+ whose gzip, zlib and deflate exports have no `Zip` counterpart. `tar`, `tar-fs` and `extract-zip` are left alone:
373
+ they extract to disk with path-traversal and symlink guards that `Tar` and `Zip` leave to the caller. `Zip` reads and
374
+ writes only stored and deflated entries, without encryption, and is marked experimental.
375
+
376
+ ## Auth, network and system modules
377
+
378
+ These rules only run in files that import Effect and report without autofixes.
379
+
380
+ - `prefer-effect-jwt` reports imports of `jose`, `jsonwebtoken`, `jwt-decode`, `jwt-simple`, `fast-jwt`, `hono/jwt` and
381
+ `@tsndr/cloudflare-worker-jwt`, and a token split on `'.'` by hand: `token.split('.')` or `Str.split(token, '.')`
382
+ where the string's name contains `token` or `jwt`, or whose result is destructured into `header`, `payload` or
383
+ `signature`. Use `Jwt.verify` or `Jwt.verifyWithKeySet` from `effect/jose`, which check the signature, `exp` and
384
+ `nbf` before decoding the claims with a Schema, and `Jwt.decodeUnverified` only to choose a key. Encrypted tokens
385
+ in `effect/jose` are `dir`/`A256GCM` only, so keep `jose` for other JWE algorithms with a disable comment. Other
386
+ dotted strings, such as `version.split('.')`, are not reported.
387
+ - `prefer-effect-net-address` reports IP addresses parsed or classified by hand: `isIP`, `isIPv4` and `isIPv6` from
388
+ `node:net`; imports of `ipaddr.js`, `ip`, `ip-address`, `is-ip` and similar packages; regular expressions that match a
389
+ dotted quad (`(\d{1,3}\.){3}`, or `25[0-5]` with a `\.`), an anchored special-purpose IPv4 prefix (`^10\.`, `^192\.168\.`), or an
390
+ IPv6 link-local, unique-local or IPv4-mapped prefix; comparisons with `'127.0.0.1'`, `'0.0.0.0'`, `'::1'` or `'::'`;
391
+ and `startsWith` with such a prefix. Parse with `NetAddress.ipFromString` and classify with `NetAddress.isLoopback`,
392
+ `isPrivate`, `isLinkLocal`, `isUniqueLocal`, `isUnspecified`, `isIpv4Mapped` or `IpNetwork.contains`. Patterns
393
+ and comparisons are reported once per top-level statement, so a table of blocked ranges is one finding. Host names
394
+ such as `'localhost'`, config defaults such as `Config.withDefault('127.0.0.1')` and other `:` splits are not
395
+ reported.
396
+ - `prefer-effect-user-directories` reports `homedir()` from `node:os`, reads of `HOME`, `USERPROFILE`, `APPDATA`,
397
+ `LOCALAPPDATA` and `XDG_{CONFIG,DATA,CACHE,STATE}_HOME` through `process.env` or `Config.String`,
398
+ `Config.NonEmptyString` and `Config.Redacted`, and imports of
399
+ `env-paths`, `xdg-basedir` and similar packages. Use the `UserDirectories` service from `effect/persistence`:
400
+ `dirs.config`, `dirs.data`, `dirs.cache` and `dirs.state` follow the XDG, macOS and Windows conventions, and
401
+ `dirs.home` returns the home directory. `tmpdir()`, other `node:os` functions and environment records passed to a
402
+ `ConfigProvider` are not reported.
250
403
 
251
404
  ## anti-slop Effect rules
252
405
 
@@ -255,7 +408,9 @@ Adapted from [`dmmulroy/anti-slop`](https://github.com/dmmulroy/anti-slop/tree/m
255
408
  - `no-manual-effect-error-tag`: prefer tagged handlers for `_tag` comparisons/switches in broad Effect catches.
256
409
  - `no-manual-tag-comparison`: prefer Match/Predicate for literal `_tag` comparisons and switches outside those catches,
257
410
  plus `kind`, `status` or the discriminants configured with the `discriminants` option. See
258
- [Effect Match](#effect-match).
411
+ [Effect Match](#effect-match). A `_tag` comparison gets a `P.isTagged(x, 'A')` suggestion, which narrows like the
412
+ comparison; it is not an autofix, because it returns `false` instead of throwing for `null` and would rewrite the
413
+ `else if` chains `prefer-effect-match` reports.
259
414
  - `no-manual-tagged-construction`: prefer existing constructors over literal string `_tag` objects; direct
260
415
  `Match.when`/`Match.not` pattern objects are exempt.
261
416
  - `no-service-constructor-imports`: reject relative named `make[A-Z]` imports outside `.test`/`.spec` files.
@@ -282,6 +437,11 @@ These rules report functions that only add an indirection, so the underlying cal
282
437
  - `no-forwarding-lambda`: a callback of an Effect API that only forwards its parameters, such as
283
438
  `Effect.map((user) => toDto(user))`. APIs whose callbacks receive more than one argument, such as the index of `Array`, `Record`,
284
439
  `Effect.forEach` and `Stream.map` or the `Exit` of `Effect.acquireRelease`, are exempt, and so are factory calls other than Effect APIs.
440
+ Passing the callee reads it when the callback is created rather than when it runs, so the rule only offers a rewrite
441
+ when every binding the callee reads is a `const`, function, parameter or import that is already initialized there
442
+ and never reassigned.
443
+ A local function with one signature is autofixed; other callees, such as Effect APIs, get a suggestion, because
444
+ TypeScript infers a passed function from its last overload and Effect's dual APIs then stop type-checking.
285
445
  - `no-single-use-private-function`: a non-exported top-level function, or `Effect.fn` constant, that is referenced
286
446
  exactly once and is at most `maxLines` lines long (default `3`). Inline it at its call site. Components, hooks,
287
447
  type predicates and recursive functions are exempt.
@@ -359,9 +519,12 @@ The exported `PaddingLineOption` type describes each configuration entry. No opt
359
519
  ### Other fixes
360
520
 
361
521
  Run `vpr lint:oxlint:fix` from the repository root to apply fixes from `consistent-schema-pipe`, `prefer-effect-duration`, `no-empty-effect-callback`,
362
- `no-effect-alchemy-barrel-imports`, `prefer-effect-alchemy-namespace-imports`,
363
- `alchemy-no-v1-worker-properties`, and `alchemy-no-deprecated-docker-constraints`.
364
- Fixes skip ambiguous bindings, conflicting properties, and unsupported import references.
522
+ `no-effect-alchemy-barrel-imports`, `prefer-effect-alchemy-namespace-imports`, `prefer-effect-predicate`,
523
+ `no-forwarding-lambda`, `alchemy-no-v1-worker-properties`, and `alchemy-no-deprecated-docker-constraints`.
524
+ Fixes skip ambiguous bindings, conflicting properties, and unsupported import references. Oxlint applies one
525
+ import-adding fix per file per run, so run it again until nothing changes. `oxlint --fix-suggestions` also applies the
526
+ suggestions from `prefer-effect-predicate`, `no-forwarding-lambda`, `no-manual-tag-comparison` and
527
+ `prefer-struct-assign`; review those changes.
365
528
 
366
529
  ## Adding a rule
367
530
 
package/dist/index.d.mts CHANGED
@@ -1,93 +1,108 @@
1
- import { Plugin } from "@oxlint/plugins";
1
+ import { Plugin } from "effect-oxlint";
2
2
  import * as Arr from "effect/Array";
3
+ import * as Schema from "effect/Schema";
3
4
  export declare const rules: {
4
- readonly 'alchemy-domain-block-file-name': import("effect-oxlint").OxlintRule;
5
- readonly 'alchemy-domain-pure-decide': import("effect-oxlint").OxlintRule;
6
- readonly 'alchemy-domain-pure-imports': import("effect-oxlint").OxlintRule;
7
- readonly 'alchemy-domain-require-view-version': import("effect-oxlint").OxlintRule;
8
- readonly 'alchemy-domain-total-handlers': import("effect-oxlint").OxlintRule;
9
- readonly 'alchemy-no-cloudflare-init-finalizer': import("effect-oxlint").OxlintRule;
10
- readonly 'alchemy-no-deprecated-docker-constraints': import("effect-oxlint").OxlintRule;
11
- readonly 'alchemy-no-deprecated-resource': import("effect-oxlint").OxlintRule;
12
- readonly 'alchemy-no-plaintext-github-secret': import("effect-oxlint").OxlintRule;
13
- readonly 'alchemy-no-removed-config-api': import("effect-oxlint").OxlintRule;
14
- readonly 'alchemy-no-reserved-eventbridge-default-name': import("effect-oxlint").OxlintRule;
15
- readonly 'alchemy-no-runtime-config': import("effect-oxlint").OxlintRule;
16
- readonly 'alchemy-no-v1-import': import("effect-oxlint").OxlintRule;
17
- readonly 'alchemy-no-v1-worker-properties': import("effect-oxlint").OxlintRule;
18
- readonly 'avoid-data-tagged-error': import("effect-oxlint").OxlintRule;
19
- readonly 'ban-error-string': import("effect-oxlint").OxlintRule;
20
- readonly 'consistent-schema-pipe': import("effect-oxlint").OxlintRule;
21
- readonly 'cors-credentials-with-wildcard': import("effect-oxlint").OxlintRule;
22
- readonly 'dual-numeric-arity-with-optional-parameter': import("effect-oxlint").OxlintRule;
23
- readonly 'effect-promise-vs-trypromise': import("effect-oxlint").OxlintRule;
24
- readonly 'no-already-started-promise': import("effect-oxlint").OxlintRule;
25
- readonly 'no-async-effect-try': import("effect-oxlint").OxlintRule;
26
- readonly 'no-browser-api-in-render': import("effect-oxlint").OxlintRule;
27
- readonly 'no-constant-thunk': import("effect-oxlint").OxlintRule;
28
- readonly 'no-discarded-run-promise': import("effect-oxlint").OxlintRule;
29
- readonly 'no-discarded-schema-checks': import("effect-oxlint").OxlintRule;
30
- readonly 'no-effect-as-on-log': import("effect-oxlint").OxlintRule;
31
- readonly 'no-empty-effect-callback': import("effect-oxlint").OxlintRule;
32
- readonly 'no-empty-schema-struct': import("effect-oxlint").OxlintRule;
33
- readonly 'no-export-all-in-client': import("effect-oxlint").OxlintRule;
34
- readonly 'no-effect-alchemy-barrel-imports': import("effect-oxlint").OxlintRule;
35
- readonly 'no-forwarding-lambda': import("effect-oxlint").OxlintRule;
36
- readonly 'no-function-config-default': import("effect-oxlint").OxlintRule;
37
- readonly 'no-hash-as-identity': import("effect-oxlint").OxlintRule;
38
- readonly 'no-inline-schema-compile': import("effect-oxlint").OxlintRule;
39
- readonly 'no-logging-in-catch': import("effect-oxlint").OxlintRule;
40
- readonly 'no-manual-effect-error-tag': import("effect-oxlint").OxlintRule;
41
- readonly 'no-manual-tag-comparison': import("effect-oxlint").OxlintRule;
42
- readonly 'no-manual-tagged-construction': import("effect-oxlint").OxlintRule;
43
- readonly 'no-millis-arithmetic': import("effect-oxlint").OxlintRule;
44
- readonly 'no-multi-shot-effect-callback': import("effect-oxlint").OxlintRule;
45
- readonly 'no-non-json-schema-annotation': import("effect-oxlint").OxlintRule;
46
- readonly 'no-option-of-service': import("effect-oxlint").OxlintRule;
47
- readonly 'no-overwritten-discriminant': import("effect-oxlint").OxlintRule;
48
- readonly 'no-service-option-get-or-throw': import("effect-oxlint").OxlintRule;
49
- readonly 'no-single-use-private-function': import("effect-oxlint").OxlintRule;
50
- readonly 'no-service-constructor-imports': import("effect-oxlint").OxlintRule;
51
- readonly 'no-throw-in-effect-callback': import("effect-oxlint").OxlintRule;
52
- readonly 'no-trivial-wrapper': import("effect-oxlint").OxlintRule;
53
- readonly 'no-uppercase-http-api-header': import("effect-oxlint").OxlintRule;
54
- readonly 'no-utc-iso-slicing': import("effect-oxlint").OxlintRule;
55
- readonly 'no-zero-retry-times': import("effect-oxlint").OxlintRule;
5
+ readonly 'alchemy-domain-block-file-name': import("effect-oxlint").CreateRule;
6
+ readonly 'alchemy-domain-pure-decide': import("effect-oxlint").CreateRule;
7
+ readonly 'alchemy-domain-pure-imports': import("effect-oxlint").CreateRule;
8
+ readonly 'alchemy-domain-require-view-version': import("effect-oxlint").CreateRule;
9
+ readonly 'alchemy-domain-total-handlers': import("effect-oxlint").CreateRule;
10
+ readonly 'alchemy-no-cloudflare-init-finalizer': import("effect-oxlint").CreateRule;
11
+ readonly 'alchemy-no-deprecated-docker-constraints': import("effect-oxlint").CreateRule;
12
+ readonly 'alchemy-no-deprecated-resource': import("effect-oxlint").CreateRule;
13
+ readonly 'alchemy-no-plaintext-github-secret': import("effect-oxlint").CreateRule;
14
+ readonly 'alchemy-no-removed-config-api': import("effect-oxlint").CreateRule;
15
+ readonly 'alchemy-no-reserved-eventbridge-default-name': import("effect-oxlint").CreateRule;
16
+ readonly 'alchemy-no-runtime-config': import("effect-oxlint").CreateRule;
17
+ readonly 'alchemy-no-v1-import': import("effect-oxlint").CreateRule;
18
+ readonly 'alchemy-no-v1-worker-properties': import("effect-oxlint").CreateRule;
19
+ readonly 'avoid-data-tagged-error': import("effect-oxlint").CreateRule;
20
+ readonly 'ban-error-string': import("effect-oxlint").CreateRule;
21
+ readonly 'consistent-schema-pipe': import("effect-oxlint").CreateRule;
22
+ readonly 'cors-credentials-with-wildcard': import("effect-oxlint").CreateRule;
23
+ readonly 'dual-numeric-arity-with-optional-parameter': import("effect-oxlint").CreateRule;
24
+ readonly 'effect-promise-vs-trypromise': import("effect-oxlint").CreateRule;
25
+ readonly 'no-already-started-promise': import("effect-oxlint").CreateRule;
26
+ readonly 'no-async-effect-try': import("effect-oxlint").CreateRule;
27
+ readonly 'no-browser-api-in-render': import("effect-oxlint").CreateRule;
28
+ readonly 'no-constant-thunk': import("effect-oxlint").CreateRule;
29
+ readonly 'no-discarded-run-promise': import("effect-oxlint").CreateRule;
30
+ readonly 'no-discarded-schema-checks': import("effect-oxlint").CreateRule;
31
+ readonly 'no-effect-as-on-log': import("effect-oxlint").CreateRule;
32
+ readonly 'no-empty-effect-callback': import("effect-oxlint").CreateRule;
33
+ readonly 'no-empty-schema-struct': import("effect-oxlint").CreateRule;
34
+ readonly 'no-encoding-get-or-throw': import("effect-oxlint").CreateRule;
35
+ readonly 'no-export-all-in-client': import("effect-oxlint").CreateRule;
36
+ readonly 'no-effect-alchemy-barrel-imports': import("effect-oxlint").CreateRule;
37
+ readonly 'no-forwarding-lambda': import("effect-oxlint").CreateRule;
38
+ readonly 'no-function-config-default': import("effect-oxlint").CreateRule;
39
+ readonly 'no-hash-as-identity': import("effect-oxlint").CreateRule;
40
+ readonly 'no-inline-schema-compile': import("effect-oxlint").CreateRule;
41
+ readonly 'no-logging-in-catch': import("effect-oxlint").CreateRule;
42
+ readonly 'no-manual-effect-error-tag': import("effect-oxlint").CreateRule;
43
+ readonly 'no-manual-encoding': import("effect-oxlint").CreateRule;
44
+ readonly 'no-manual-sse': import("effect-oxlint").CreateRule;
45
+ readonly 'no-manual-tag-comparison': import("effect-oxlint").CreateRule;
46
+ readonly 'no-manual-tagged-construction': import("effect-oxlint").CreateRule;
47
+ readonly 'no-millis-arithmetic': import("effect-oxlint").CreateRule;
48
+ readonly 'no-multi-shot-effect-callback': import("effect-oxlint").CreateRule;
49
+ readonly 'no-non-json-schema-annotation': import("effect-oxlint").CreateRule;
50
+ readonly 'no-option-of-service': import("effect-oxlint").CreateRule;
51
+ readonly 'no-overwritten-discriminant': import("effect-oxlint").CreateRule;
52
+ readonly 'no-service-option-get-or-throw': import("effect-oxlint").CreateRule;
53
+ readonly 'no-single-use-private-function': import("effect-oxlint").CreateRule;
54
+ readonly 'no-service-constructor-imports': import("effect-oxlint").CreateRule;
55
+ readonly 'no-throw-in-effect-callback': import("effect-oxlint").CreateRule;
56
+ readonly 'no-trivial-wrapper': import("effect-oxlint").CreateRule;
57
+ readonly 'no-uppercase-http-api-header': import("effect-oxlint").CreateRule;
58
+ readonly 'no-utc-iso-slicing': import("effect-oxlint").CreateRule;
59
+ readonly 'no-zero-retry-times': import("effect-oxlint").CreateRule;
56
60
  readonly 'padding-line-between-statements': import("effect-oxlint").CreateRule;
57
- readonly 'prefer-data-match': import("effect-oxlint").OxlintRule;
58
- readonly 'prefer-effect-alchemy-namespace-imports': import("effect-oxlint").OxlintRule;
59
- readonly 'prefer-effect-array-ops': import("effect-oxlint").OxlintRule;
60
- readonly 'prefer-effect-array-sort': import("effect-oxlint").OxlintRule;
61
- readonly 'prefer-effect-datetime': import("effect-oxlint").OxlintRule;
62
- readonly 'prefer-effect-duration': import("effect-oxlint").OxlintRule;
63
- readonly 'prefer-effect-duration-constants': import("effect-oxlint").OxlintRule;
64
- readonly 'prefer-effect-duration-types': import("effect-oxlint").OxlintRule;
65
- readonly 'prefer-effect-encoding': import("effect-oxlint").OxlintRule;
66
- readonly 'prefer-effect-filesystem': import("effect-oxlint").OxlintRule;
67
- readonly 'prefer-effect-filter': import("effect-oxlint").OxlintRule;
68
- readonly 'prefer-effect-headers': import("effect-oxlint").OxlintRule;
69
- readonly 'prefer-effect-match': import("effect-oxlint").OxlintRule;
70
- readonly 'prefer-effect-path': import("effect-oxlint").OxlintRule;
71
- readonly 'prefer-effect-predicate': import("effect-oxlint").OxlintRule;
72
- readonly 'prefer-effect-url': import("effect-oxlint").OxlintRule;
73
- readonly 'prefer-hoisted-match': import("effect-oxlint").OxlintRule;
74
- readonly 'prefer-equal': import("effect-oxlint").OxlintRule;
75
- readonly 'prefer-struct-assign': import("effect-oxlint").OxlintRule;
76
- readonly 'prefer-uninterruptible': import("effect-oxlint").OxlintRule;
77
- readonly 'prefer-with-span': import("effect-oxlint").OxlintRule;
78
- readonly 'prefer-yield-now': import("effect-oxlint").OxlintRule;
79
- readonly 'preserve-caught-error': import("effect-oxlint").OxlintRule;
80
- readonly 'require-schema-class-brand': import("effect-oxlint").OxlintRule;
81
- readonly 'require-try-promise-abort-signal': import("effect-oxlint").OxlintRule;
82
- readonly 'throw-in-effect-gen': import("effect-oxlint").OxlintRule;
83
- readonly 'valid-directive': import("effect-oxlint").OxlintRule;
61
+ readonly 'prefer-data-match': import("effect-oxlint").CreateRule;
62
+ readonly 'prefer-effect-alchemy-namespace-imports': import("effect-oxlint").CreateRule;
63
+ readonly 'prefer-effect-archive': import("effect-oxlint").CreateRule;
64
+ readonly 'prefer-effect-array-ops': import("effect-oxlint").CreateRule;
65
+ readonly 'prefer-effect-array-sort': import("effect-oxlint").CreateRule;
66
+ readonly 'prefer-effect-cookies': import("effect-oxlint").CreateRule;
67
+ readonly 'prefer-effect-csv': import("effect-oxlint").CreateRule;
68
+ readonly 'prefer-effect-datetime': import("effect-oxlint").CreateRule;
69
+ readonly 'prefer-effect-duration': import("effect-oxlint").CreateRule;
70
+ readonly 'prefer-effect-duration-constants': import("effect-oxlint").CreateRule;
71
+ readonly 'prefer-effect-duration-types': import("effect-oxlint").CreateRule;
72
+ readonly 'prefer-effect-encoding': import("effect-oxlint").CreateRule;
73
+ readonly 'prefer-effect-filesystem': import("effect-oxlint").CreateRule;
74
+ readonly 'prefer-effect-filter': import("effect-oxlint").CreateRule;
75
+ readonly 'prefer-effect-format-parser': import("effect-oxlint").CreateRule;
76
+ readonly 'prefer-effect-headers': import("effect-oxlint").CreateRule;
77
+ readonly 'prefer-effect-http-method': import("effect-oxlint").CreateRule;
78
+ readonly 'prefer-effect-http-status': import("effect-oxlint").CreateRule;
79
+ readonly 'prefer-effect-jwt': import("effect-oxlint").CreateRule;
80
+ readonly 'prefer-effect-match': import("effect-oxlint").CreateRule;
81
+ readonly 'prefer-effect-match-status': import("effect-oxlint").CreateRule;
82
+ readonly 'prefer-effect-ndjson': import("effect-oxlint").CreateRule;
83
+ readonly 'prefer-effect-net-address': import("effect-oxlint").CreateRule;
84
+ readonly 'prefer-effect-path': import("effect-oxlint").CreateRule;
85
+ readonly 'prefer-effect-predicate': import("effect-oxlint").CreateRule;
86
+ readonly 'prefer-effect-sse': import("effect-oxlint").CreateRule;
87
+ readonly 'prefer-effect-url': import("effect-oxlint").CreateRule;
88
+ readonly 'prefer-effect-url-params': import("effect-oxlint").CreateRule;
89
+ readonly 'prefer-effect-user-directories': import("effect-oxlint").CreateRule;
90
+ readonly 'prefer-hoisted-match': import("effect-oxlint").CreateRule;
91
+ readonly 'prefer-equal': import("effect-oxlint").CreateRule;
92
+ readonly 'prefer-struct-assign': import("effect-oxlint").CreateRule;
93
+ readonly 'prefer-uninterruptible': import("effect-oxlint").CreateRule;
94
+ readonly 'prefer-with-span': import("effect-oxlint").CreateRule;
95
+ readonly 'prefer-yield-now': import("effect-oxlint").CreateRule;
96
+ readonly 'preserve-caught-error': import("effect-oxlint").CreateRule;
97
+ readonly 'require-schema-class-brand': import("effect-oxlint").CreateRule;
98
+ readonly 'require-try-promise-abort-signal': import("effect-oxlint").CreateRule;
99
+ readonly 'throw-in-effect-gen': import("effect-oxlint").CreateRule;
100
+ readonly 'valid-directive': import("effect-oxlint").CreateRule;
84
101
  };
85
- interface NoManualTagComparisonOptions {
86
- /**
87
- * Discriminant properties checked in addition to `_tag`. Replaces the default `['kind', 'status']`.
88
- */
89
- readonly discriminants?: ReadonlyArray<string>;
90
- }
102
+ declare const Options: Schema.Struct<{
103
+ readonly discriminants: Schema.optionalKey<Schema.$Array<Schema.String>>;
104
+ }>;
105
+ type NoManualTagComparisonOptions = typeof Options.Type;
91
106
  type PaddingType = 'any' | 'never' | 'always';
92
107
  type LineMode = 'any' | 'singleline' | 'multiline';
93
108
  interface SelectorOption {
@@ -108,6 +123,9 @@ interface PaddingLineOption {
108
123
  readonly next: StatementOption;
109
124
  }
110
125
  export type RuleName = keyof typeof rules;
111
- export declare const recommendedRules: Record<`2digits/${string}`, "error">;
112
- declare const plugin: Plugin;
126
+ export declare const recommendedRules: Record<`2digits/${string}`, 'error' | 'warn'>;
127
+ /**
128
+ * The plugin, with `configs.recommended` and `configs.all` for loading it by its package name.
129
+ */
130
+ declare const plugin: Plugin.DefinedPlugin<typeof rules>;
113
131
  export { type NoManualTagComparisonOptions, type PaddingLineOption, plugin as default };