Skip to content

About

πŸ›οΈ Configurable architecture rules for Oxlint, vendored as readable raw TypeScript.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

154 Commits

Folders and files

Repository files navigation

πŸ›οΈ oxlint-plugin-arch

Architecture rules for Oxlint: files in the right folders, exports named after their file, types where they belong.

Linters catch bugs; this catches drift. Describe your folders once, and the preset wires the right rules into each one: apps, backends, libraries, UI kits and scripts. Relax a folder by changing one key, not by writing overrides.

✨ Features

  • πŸ—‚οΈ Folders, not flags. Each folder says what it holds (react, tanstack, backend, kit); nested folders inherit and refine.
  • 🏷️ Filename-aware. Rules derive names from the file they run on: user-action.create.ts must export userActionCreate.
  • πŸŽ›οΈ Configurable. No app names or paths baked in. Every rule works on its own too.
  • πŸ›Ÿ Safe autofix. πŸ”§ rules only touch whitespace or comments.
  • ⚑ Fast. Oxlint's JS plugin API, no extra parser.

🧰 Built with

Oxlint Β· oxlint-tsgolint Β· Bun Β· TypeScript

πŸš€ Install in 3 steps

You need: Oxlint 1.85 or newer.

1. Install

bun add -d oxlint oxlint-tsgolint oxlint-plugin-arch
# React, Tailwind and shadcn groups (the tanstack, next, expo, react and ui recipes):
bun add -d eslint-plugin-react eslint-plugin-react-you-might-not-need-an-effect eslint-plugin-svg-jsx oxlint-tailwindcss @shadcn/lint

2. Add the preset

// oxlint.config.ts
import { preset } from 'oxlint-plugin-arch/preset'

export default preset({
  root: import.meta.dirname,
  folders: {
    'packages/ui': { react: { a11y: false } },
  },
})

The preset detects each workspace from its package.json (TanStack, Next, Expo, backend, UI kit, library) along with its stylesheet, # import aliases, service registry and migrations. List only the folders you want to change. To share config across projects, split it into fragments and pick them with extends: [server, tests]. Detection, inheritance, groups, recipes and templates: docs/folders.md. Locking down what one kind of file may contain: docs/files.md. Rules without the preset: docs/plugin-only.md.

3. Lint

bunx oxlint

πŸ“š Groups and rules

On by default: layout, limits, style, basics, naming, comments, types, imports, tests, deny, top, externals.

Opt-in: react, tanstack, next, expo, tailwind, shadcn, kit, backend, orpc, schemas, forms, sql, effect, console.

95 rules, IDs arch/<rule>. πŸ”§ = autofix.

Family Covers Rules
backend Service and RPC structure backend-orpc-output, backend-registry, backend-service-functions, backend-sql-like
boundaries Import and runtime boundaries boundaries-deny, boundaries-imports, boundaries-next, boundaries-rpc-database, boundaries-tanstack, boundaries-token-owner
code Code shapes to avoid code-branch-once, code-constructor, code-delegate, code-double-negation, code-function-nesting, code-inline, code-inside, code-justified-call, code-literal-in, code-mutable-state, code-object-params, code-paired-call, code-promise-mutation, code-switch, code-traced, code-trivial-functions, code-yield-argument
comments Comments and directives comments-code πŸ”§, comments-directives
copy User-facing text copy-dashes
files What a file may contain or export files-components-only, files-constants-only, files-domain-constants, files-exports, files-externals, files-factory-keys, files-helpers, files-no-functions, files-restricted, files-route, files-siblings, files-top-level, files-types-only
layout Layout a formatter leaves alone layout-arrow-body πŸ”§, layout-call-arguments πŸ”§, layout-call-array πŸ”§, layout-call-depth, layout-chain πŸ”§, layout-items πŸ”§, layout-jsx-attributes πŸ”§, layout-key-value πŸ”§, layout-object πŸ”§, layout-padding πŸ”§, layout-pipe, layout-ternary πŸ”§, layout-type-arguments πŸ”§
naming File, folder and export names naming-declarations, naming-exports, naming-file, naming-folder, naming-imports, naming-keys, naming-labels, naming-pairs, naming-types
react Components, effects, class names react-dynamic-classes, react-empty-effect, react-memo, react-props, react-query-props
schemas Schema placement schemas-inline, schemas-local, schemas-rederive, schemas-single-use
tests Test structure tests-assertions, tests-concurrent-db, tests-modifiers, tests-titles
types Type placement and shape types-declarations, types-duplicate, types-imported-alias, types-inline, types-local-alias, types-namespace-import, types-service, types-unknown

Also bundled: Dillon Mulroy's anti-slop rules as oxlint-plugin-arch/dillon-anti-slop.

Warning

Upgrading from 0.11 or earlier: the preset API, rule IDs and entry points changed. See the changelog.

πŸ“„ License

MIT. The dillon-anti-slop rules are by Dillon Mulroy, MIT, with faster versions adapted from Christoph Nakazawa's @nkzw/oxlint-config, MIT, vendored with attribution.

About

πŸ›οΈ Configurable architecture rules for Oxlint, vendored as readable raw TypeScript.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages