oxlint-plugin-arch 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +47 -1
- package/dist/index.js +122 -122
- package/dist/presets/index.js +28 -9
- package/dist/presets/tanstack-start-react-modules-preset.js +28 -9
- package/dist/rules/dillon-anti-slop/index.d.ts +2 -0
- package/dist/rules/dillon-anti-slop/index.js +2 -2
- package/dist/rules/dillon-anti-slop/rules/no-chained-type-assertions.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-conditional-empty-object-spread.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-known-value-widening.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-module-mocking.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-object-parameters.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-reflect-apply.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-reflect-get.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-runtime-typeof.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-shape-in-symbol-names.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-unknown-parameters.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-unknown-returns.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-unknown-type-aliases.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-unsafe-dictionary-type.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/no-widen-then-assert.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/rules/require-safety-comment-for-type-assertion.d.ts +1 -0
- package/dist/rules/dillon-anti-slop/shared/dictionary-types.d.ts +19 -0
- package/dist/rules/dillon-anti-slop/shared/lexical-type-parameters.d.ts +4 -0
- package/dist/rules/dillon-anti-slop/shared/reflect-method.d.ts +2 -0
- package/dist/rules/module-policy/domain-constants.d.ts +2 -0
- package/dist/rules/module-policy/import-boundaries.d.ts +2 -0
- package/dist/rules/module-policy/index.d.ts +2 -0
- package/dist/rules/module-policy/index.js +49 -49
- package/dist/rules/module-policy/memoization.d.ts +2 -0
- package/dist/rules/module-policy/reasoned-directives.d.ts +2 -0
- package/dist/rules/module-policy/service-functions.d.ts +2 -0
- package/dist/rules/module-policy/service-types.d.ts +2 -0
- package/dist/rules/module-policy/tanstack-runtime.d.ts +2 -0
- package/dist/rules/module-policy/test-assertions.d.ts +2 -0
- package/dist/rules/module-policy/test-modifiers.d.ts +2 -0
- package/dist/types/module-policy.types.d.ts +34 -0
- package/dist/types/test-analysis.types.d.ts +11 -0
- package/dist/utils/helpers/ast.d.ts +12 -0
- package/dist/utils/helpers/boundaries.d.ts +3 -0
- package/dist/utils/helpers/comments.d.ts +6 -0
- package/dist/utils/helpers/declarations.d.ts +35 -0
- package/dist/utils/helpers/exports.d.ts +18 -0
- package/dist/utils/helpers/factories.d.ts +9 -0
- package/dist/utils/helpers/guards.d.ts +11 -0
- package/dist/utils/helpers/index.d.ts +16 -0
- package/dist/utils/helpers/layout.d.ts +15 -0
- package/dist/utils/helpers/naming.d.ts +13 -0
- package/dist/utils/helpers/options.d.ts +22 -0
- package/dist/utils/helpers/orpc.d.ts +3 -0
- package/dist/utils/helpers/react-components.d.ts +13 -0
- package/dist/utils/helpers/routes.d.ts +5 -0
- package/dist/utils/helpers/sanitizers.d.ts +3 -0
- package/dist/utils/helpers/schemas.d.ts +10 -0
- package/dist/utils/helpers/syntax.d.ts +1 -0
- package/dist/utils/helpers/test-tables.d.ts +8 -0
- package/dist/utils/helpers/trivial.d.ts +6 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.2
|
|
4
|
+
|
|
5
|
+
- 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.
|
|
6
|
+
|
|
7
|
+
## 0.6.1
|
|
8
|
+
|
|
9
|
+
- 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.
|
|
10
|
+
- Allow safe-area padding values (`env(safe-area-inset-*)` and `max(--spacing(*),env(safe-area-inset-*))` on padding sides/axes) in `shadcn/no-arbitrary-values`. Literal floors such as `max(1rem,…)` stay rejected.
|
|
11
|
+
- Allow the stock Sonner hooks `toaster` and `toast` only in each web root's `components/ui/sonner.tsx`. No new preset options.
|
|
12
|
+
|
|
3
13
|
## 0.6.0
|
|
4
14
|
|
|
5
15
|
- Add `tests.profile` (`fixtures` by default, or `standard`), explicit custom test/assertion names, parameterized-test recognition and assertion-based narrowing guidance. Both profiles retain assertion, mock and type-safety checks; fixtures additionally require named fixture/support imports.
|
package/README.md
CHANGED
|
@@ -105,7 +105,19 @@ Available policies: `typePlacement`, `typeSafety`, `serviceStructure`, `fileLayo
|
|
|
105
105
|
|
|
106
106
|
`severity` defaults to `error` and accepts `warn`. File and function limits default to 400 and 32. React Compiler is assumed by default: manual memoization is banned and the four React performance rules against render-time function/object/array/JSX props are off. `react: { compiler: false }` allows manual memoization and enables those four rules. `react: { componentProps: false }` turns off only `arch/component-props` (props typed with `interface XProps` directly above each component); it is on by default. `shadcn: false` disables shadcn integration while retaining Tailwind checks. `tailwind` accepts `cssEntryPoint`, `cssEntryPointsByRoot` and `rootFontSize`; `shadcn` accepts `uiImportPath` and `componentImportSources`. UI-kit files remain linted, with architecture/appearance exceptions rather than a global ignore.
|
|
107
107
|
|
|
108
|
-
Shadcn allows caller-owned layout
|
|
108
|
+
Shadcn allows caller-owned layout, standard opacity utilities and exact `truncate` (including variant forms). Stock composition slots also allow these class groups:
|
|
109
|
+
|
|
110
|
+
| Components | Additional groups |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `CardContent`, `PopoverContent` | `p`, `px`, `py`, `ps`, `pe`, `pt`, `pr`, `pb`, `pl` |
|
|
113
|
+
| `TabsContent` | The padding groups above plus `gap`, `gap-x`, `gap-y` |
|
|
114
|
+
| `Tabs`, `HoverCardContent`, `SidebarHeader`, `BreadcrumbList` | `gap`, `gap-x`, `gap-y` |
|
|
115
|
+
|
|
116
|
+
These are exact component-name contracts, not blanket content/spacing exceptions. Each keeps `layout`, `opacity` and `truncate`; controls such as `Button` still reject padding and gap overrides. A contract's `allow` replaces the baseline, and the last matching contract wins. Native file-specific rule options replace contract arrays rather than merging them.
|
|
117
|
+
|
|
118
|
+
Arbitrary padding values may use `env(safe-area-inset-top)`, `env(safe-area-inset-right)`, `env(safe-area-inset-bottom)` or `env(safe-area-inset-left)` with any padding group above. Padding sides/axes (not `p`) also allow `max(--spacing(*),env(safe-area-inset-…))`, for example `pb-[max(--spacing(4),env(safe-area-inset-bottom))]`. Literal floors such as `max(1rem,env(…))` remain rejected. These are narrow class globs, **not CSS-expression validation**: the wildcard inside `--spacing(...)` can still match malformed arguments or extra arithmetic. The allowance does not bypass component restyling checks.
|
|
119
|
+
|
|
120
|
+
Only `<web root>/src/components/ui/sonner.tsx` allows the stock Sonner selector hooks `toaster` and `toast`; all other unknown classes remain checked, including in UI files. These defaults need no extra preset options or consumer overrides.
|
|
109
121
|
|
|
110
122
|
Module configuration, lookup tables, limits and defaults belong in domain `.constants.ts` files, including frontend services. All frontend constant declarations carry the domain prefix (for example `BOT_MODEL_PRIORITY`). Frontend service scopes enable `modules/domain-constants` with `includeData: true`: it detects module-level literal/object/array data, literal calculations and seeded Map/Set tables, plus the existing uppercase constants. Function-local calculations and call-created service instances remain in their owner; empty Map/Set state is not classified as configuration. This is syntactic enforcement, not semantic data-flow analysis: imported aliases and arbitrary call-created configuration still need review. Backend rule defaults are unchanged. Every scope follows the configured architecture roots; a web `.server.ts` file remains frontend-owned.
|
|
111
123
|
|
|
@@ -252,6 +264,40 @@ export default defineConfig({
|
|
|
252
264
|
})
|
|
253
265
|
```
|
|
254
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
|
+
|
|
255
301
|
## 🚀 Quick start
|
|
256
302
|
|
|
257
303
|
Rules are switched on per folder with `overrides`. Here are three small ones:
|