oxlint-plugin-arch 0.6.1 → 0.6.3

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +50 -2
  3. package/dist/index.js +393 -213
  4. package/dist/presets/index.js +6 -7
  5. package/dist/presets/tanstack-start-react-modules-preset.js +6 -7
  6. package/dist/rules/dillon-anti-slop/index.d.ts +2 -0
  7. package/dist/rules/dillon-anti-slop/index.js +2 -2
  8. package/dist/rules/dillon-anti-slop/rules/no-chained-type-assertions.d.ts +1 -0
  9. package/dist/rules/dillon-anti-slop/rules/no-conditional-empty-object-spread.d.ts +1 -0
  10. package/dist/rules/dillon-anti-slop/rules/no-known-value-widening.d.ts +1 -0
  11. package/dist/rules/dillon-anti-slop/rules/no-module-mocking.d.ts +1 -0
  12. package/dist/rules/dillon-anti-slop/rules/no-object-parameters.d.ts +1 -0
  13. package/dist/rules/dillon-anti-slop/rules/no-reflect-apply.d.ts +1 -0
  14. package/dist/rules/dillon-anti-slop/rules/no-reflect-get.d.ts +1 -0
  15. package/dist/rules/dillon-anti-slop/rules/no-runtime-typeof.d.ts +1 -0
  16. package/dist/rules/dillon-anti-slop/rules/no-shape-in-symbol-names.d.ts +1 -0
  17. package/dist/rules/dillon-anti-slop/rules/no-unknown-parameters.d.ts +1 -0
  18. package/dist/rules/dillon-anti-slop/rules/no-unknown-returns.d.ts +1 -0
  19. package/dist/rules/dillon-anti-slop/rules/no-unknown-type-aliases.d.ts +1 -0
  20. package/dist/rules/dillon-anti-slop/rules/no-unsafe-dictionary-type.d.ts +1 -0
  21. package/dist/rules/dillon-anti-slop/rules/no-widen-then-assert.d.ts +1 -0
  22. package/dist/rules/dillon-anti-slop/rules/require-safety-comment-for-type-assertion.d.ts +1 -0
  23. package/dist/rules/dillon-anti-slop/shared/dictionary-types.d.ts +19 -0
  24. package/dist/rules/dillon-anti-slop/shared/lexical-type-parameters.d.ts +4 -0
  25. package/dist/rules/dillon-anti-slop/shared/reflect-method.d.ts +2 -0
  26. package/dist/rules/module-policy/domain-constants.d.ts +2 -0
  27. package/dist/rules/module-policy/import-boundaries.d.ts +2 -0
  28. package/dist/rules/module-policy/index.d.ts +2 -0
  29. package/dist/rules/module-policy/index.js +49 -49
  30. package/dist/rules/module-policy/memoization.d.ts +2 -0
  31. package/dist/rules/module-policy/reasoned-directives.d.ts +2 -0
  32. package/dist/rules/module-policy/service-functions.d.ts +2 -0
  33. package/dist/rules/module-policy/service-types.d.ts +2 -0
  34. package/dist/rules/module-policy/tanstack-runtime.d.ts +2 -0
  35. package/dist/rules/module-policy/test-assertions.d.ts +2 -0
  36. package/dist/rules/module-policy/test-modifiers.d.ts +2 -0
  37. package/dist/types/module-policy.types.d.ts +34 -0
  38. package/dist/types/test-analysis.types.d.ts +11 -0
  39. package/dist/utils/helpers/ast.d.ts +12 -0
  40. package/dist/utils/helpers/boundaries.d.ts +3 -0
  41. package/dist/utils/helpers/comments.d.ts +6 -0
  42. package/dist/utils/helpers/declarations.d.ts +35 -0
  43. package/dist/utils/helpers/exports.d.ts +18 -0
  44. package/dist/utils/helpers/factories.d.ts +9 -0
  45. package/dist/utils/helpers/guards.d.ts +11 -0
  46. package/dist/utils/helpers/index.d.ts +16 -0
  47. package/dist/utils/helpers/layout.d.ts +15 -0
  48. package/dist/utils/helpers/naming.d.ts +13 -0
  49. package/dist/utils/helpers/options.d.ts +22 -0
  50. package/dist/utils/helpers/orpc.d.ts +3 -0
  51. package/dist/utils/helpers/react-components.d.ts +13 -0
  52. package/dist/utils/helpers/routes.d.ts +5 -0
  53. package/dist/utils/helpers/sanitizers.d.ts +3 -0
  54. package/dist/utils/helpers/schemas.d.ts +10 -0
  55. package/dist/utils/helpers/syntax.d.ts +1 -0
  56. package/dist/utils/helpers/test-tables.d.ts +8 -0
  57. package/dist/utils/helpers/trivial.d.ts +6 -0
  58. package/dist/utils/index.d.ts +1 -0
  59. package/package.json +9 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.3
4
+
5
+ - Add a trailing comma when `object-multiline` splits an object, so the fix agrees with multiline comma rules.
6
+
7
+ - Add opt-in `ternary-layout` and `call-arguments-multiline` layout rules with configurable thresholds and indentation. Presets remain unchanged.
8
+
9
+ ## 0.6.2
10
+
11
+ - Export `oxlint-plugin-arch/rules/dillon-anti-slop` and `oxlint-plugin-arch/rules/module-policy` with TypeScript declarations. Resolve the preset's three first-party plugins through public package entry points, without changing rules or policy. Document standalone registration and third-party dependency ownership; verify built exports expose every supporting rule.
12
+
3
13
  ## 0.6.1
4
14
 
5
15
  - Relax the preset's shadcn defaults for stock composition, so strict consumers need no overrides: exact padding groups on `CardContent`/`PopoverContent`, gap and padding on `TabsContent`, and gap on `Tabs`/`HoverCardContent`/`SidebarHeader`/`BreadcrumbList`; exact `truncate` everywhere. Controls such as `Button` stay protected.
package/README.md CHANGED
@@ -6,7 +6,7 @@ Keep a codebase shaped the way you designed it: files in the right folders, expo
6
6
 
7
7
  - 🗂️ **Filename-aware.** Rules derive expected names from the file they run on (`user-action.create.ts` → `makeUserActionCreate`).
8
8
  - 🎛️ **Configurable.** No app names, folders, or libraries are baked in. Globs and policy live in your config.
9
- - 🛟 **Safe autofix.** Layout and comment rules only touch whitespace or comments. Type-import fixes qualify scope-resolved references and skip unsafe rewrites.
9
+ - 🛟 **Safe autofix.** Layout and comment rules touch whitespace or comments; `object-multiline` and `call-arguments-multiline` can also add trailing commas. Type-import fixes qualify scope-resolved references and skip unsafe rewrites.
10
10
  - ⚡ **Fast.** Built on Oxlint's JS plugin API and ESTree, with no extra parser.
11
11
 
12
12
  ---
@@ -264,6 +264,40 @@ export default defineConfig({
264
264
  })
265
265
  ```
266
266
 
267
+ ### Use the supporting plugins without the preset
268
+
269
+ All three first-party rule sets have public package entry points. Register only the plugins and rules you need; this does not enable the preset or its policies.
270
+
271
+ ```ts
272
+ import { defineConfig } from 'oxlint'
273
+
274
+ export default defineConfig({
275
+ jsPlugins: [
276
+ { name: 'arch', specifier: 'oxlint-plugin-arch' },
277
+ { name: 'dillon-anti-slop', specifier: 'oxlint-plugin-arch/rules/dillon-anti-slop' },
278
+ { name: 'modules', specifier: 'oxlint-plugin-arch/rules/module-policy' },
279
+ ],
280
+ rules: {
281
+ 'arch/no-literal-in': 'error',
282
+ 'dillon-anti-slop/no-chained-type-assertions': 'error',
283
+ 'modules/no-unknown': 'error',
284
+ },
285
+ })
286
+ ```
287
+
288
+ Both `/rules/` entry points also provide a default plugin export and TypeScript declarations. Do not import `dist/` paths. The preset resolves these same public entry points, including the existing package root for `arch`; it needs no other first-party plugin entry points. Individual rule implementations and helpers are bundled into those plugins.
289
+
290
+ If you copy the preset's third-party plugin registrations into your own config, install those packages directly with `bun add -d` rather than relying on transitive dependency hoisting:
291
+
292
+ | Scope | Packages |
293
+ | --- | --- |
294
+ | Always | `oxlint-plugin-eslint`, `eslint-plugin-import`, `@regru/eslint-plugin-prefer-early-return`, `eslint-plugin-unused-imports`, `eslint-plugin-perfectionist`, `eslint-plugin-tsdoc`, `@eslint-community/eslint-plugin-eslint-comments` |
295
+ | Web roots | `eslint-plugin-react`, `eslint-plugin-react-you-might-not-need-an-effect`, `eslint-plugin-svg-jsx` |
296
+ | CSS entry points with Tailwind enabled | `oxlint-tailwindcss` |
297
+ | Same CSS scope with shadcn enabled | `@shadcn/lint` |
298
+
299
+ These plugins remain **dependencies** of `oxlint-plugin-arch`, not peer dependencies: the preset loads its own installed copies. In an application-owned config, list directly used plugins as **devDependencies**. A reusable config package should use dependencies for plugins it resolves itself, or peerDependencies if it intentionally requires consumers to supply them. `@oxlint/plugins` is the bundled plugins' runtime dependency, not another preset rule set. `oxlint` remains a peer dependency; `oxlint-tsgolint` is an optional peer required when using the preset's type-aware checks. Native Oxlint plugin groups need no separate npm plugin packages.
300
+
267
301
  ## 🚀 Quick start
268
302
 
269
303
  Rules are switched on per folder with `overrides`. Here are three small ones:
@@ -393,7 +427,9 @@ Options that take one regex string (`pattern`, `allowPattern`, `forbid`, `requir
393
427
  | Rule | What it enforces |
394
428
  | --- | --- |
395
429
  | `padding-between-statements` 🔧 | Blank lines around functions and classes, around control flow, and before `return` in longer blocks; `multilineVariables: true` also separates multiline declarations, including exports (default `false`). |
396
- | `object-multiline` 🔧 | Objects with 3+ properties passed to a call go one property per line (`scope: 'all'` for every object). |
430
+ | `object-multiline` 🔧 | Objects with 3+ properties passed to a call go one property per line with a trailing comma (`scope: 'all'` for every object). |
431
+ | `ternary-layout` 🔧 | Join short conditionals or split long ones before `?` and `:`. [Details ↓](#ternary-layout) |
432
+ | `call-arguments-multiline` 🔧 | Calls and constructors with 3+ arguments go one argument per line. [Details ↓](#call-arguments-multiline) |
397
433
  | `key-value-same-line` 🔧 | An object key and the start of its value stay on the same line. |
398
434
  | `chain-newline` 🔧 | Long method chains go one call per line. You pick which chains with `groups`. |
399
435
  | `call-array-multiline` 🔧 | Arrays passed to `Promise.all` (or callees you list) go one element per line. |
@@ -406,6 +442,18 @@ Options that take one regex string (`pattern`, `allowPattern`, `forbid`, `requir
406
442
 
407
443
  ## 🔍 Rule details
408
444
 
445
+ ### ternary-layout
446
+
447
+ Options: `maxLength` (integer ≥ 1, default `160`) and `indent` (integer ≥ 1, default `2` spaces). The full resulting line, including its prefix and suffix, determines whether a conditional fits. Short multiline conditionals join; long single-line conditionals split before `?` and `:`, one indent deeper than their starting line. Direct template interpolations stay on one line regardless of length.
448
+
449
+ Conditionals with a conditional parent or operand, comments inside, or multiline operands are skipped. Existing long multiline conditionals are left unchanged.
450
+
451
+ ### call-arguments-multiline
452
+
453
+ Options: `minArguments` (integer ≥ 2, default `3`) and `indent` (integer ≥ 1, default `2` spaces). Calls and `new` expressions at the threshold put each argument and the closing `)` on separate lines. Arguments use one indent deeper than the line containing `(`. Fixes add a trailing comma, including after spread arguments.
454
+
455
+ Calls already using separate lines for every argument and `)` are left unchanged, including their indentation and optional trailing comma. Calls containing comments, parenthesized arguments, or multiline arrow/function arguments are skipped. These are code fixes because they can add punctuation. Both new rules are opt-in and absent from presets.
456
+
409
457
  ### File size
410
458
 
411
459
  `limits.maxFileLines?: number` sets the existing ESLint `max-lines` ceiling on checked safety scopes; default `400`. Blank lines and comments remain skipped. Use native Oxlint overrides or the existing `ruleExclusions` configuration for deliberate per-file exceptions. File size is a ceiling, not a cohesion proof.