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