@ashstack/lint

中文文档
0.11.0发布于 2026/09/30MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 5105

ashStack shared oxlint configuration and custom rules. Entries: core, react, react-native, with per-library rule groups auto-detected from your dependencies. Consume from oxlint.config.mts.

原始使用文档
文档目录7 节
  1. Install
  2. Monorepos
  3. What each entry adds
  4. Library-specific rules, auto-detected
  5. Opt-in rules
  6. Rule reference
  7. License

@ashstack/lint

Strict shared oxlint config: 116 rules on plain TypeScript, 211 with React, 268 on React Native, 82 of them custom-built. Three entries, each containing the one before it: core(), react(), react-native().

Library-specific rules ship only when you depend on that library, so nothing fires about code you don't have.

The strictness is aimed at agents. One writes more code in an hour than anyone reviews line by line, and the linter is the only thing that reads all of it. Every message names the fix, so an agent can act on it without a second prompt.

Install

bun add -d oxlint oxlint-tsgolint @ashstack/lint
// oxlint.config.mts (JSON configs can't resolve npm packages, so TS config only)
import { core } from "@ashstack/lint/core"; // or: /react, /react-native
import { defineConfig } from "oxlint";

export default defineConfig({
  extends: [core()],
  rules: { "@ashstack/query/no-inline-keys": "off" }, // your overrides always win
});
oxlint --type-aware --deny-warnings .

Keep the defineConfig wrapper. It is what types the rules block, so a wrong rule option is a compile error and hovering a rule id shows what it does and links to its section here. A bare export default { ... } gets neither, silently — satisfies OxlintConfig works too if you would rather not wrap.

Type-aware rules need the oxlint-tsgolint peer. Node 22.18+.

Import the entry you use. There is no package root to import from, so nothing loads rule files you have no use for: @ashstack/lint/core loads 27 KB where a root re-export of all three would load 137 KB. react and react-native load most of it either way, since they configure most of the rules.

import { core } from "@ashstack/lint/core";
import { react } from "@ashstack/lint/react";
import { reactNative } from "@ashstack/lint/react-native";

Each entry also has a default export, and carries its own options type (CoreOptions, ReactOptions, ReactNativeOptions).

Monorepos

A nested config replaces the one above it rather than merging, so each workspace config extends an entry itself. Its own plugins array is unioned with the entry's, never swapped for it:

// apps/backend/oxlint.config.mts — a backend that also renders JSX templates
import { core } from "@ashstack/lint/core";
import { defineConfig } from "oxlint";

export default defineConfig({
  extends: [core()],
  plugins: ["react", "jsx-a11y"],
  rules: { "react/jsx-key": "error" },
});

Drop the extends and the workspace keeps only the rules it names, with no diagnostic that the rest are gone.

What each entry adds

core() is a strict eslint / typescript / unicorn / promise / import base plus the @ashstack/core/ convention rules. react() adds react, jsx-a11y, React Compiler and you-might-not-need-an-effect. react-native() adds the generic @ashstack/react-native/ rules: leaked renders, view nesting, iOS-only keyboard events, remote images.

Library-specific rules, auto-detected

One module per library: one rule namespace, one toggle. A module turns on when its library is in your package.json, searched up to the repo root.

@ashstack/zod · @ashstack/query · @ashstack/zustand · @ashstack/i18n · @ashstack/stylex · @ashstack/unistyles · @ashstack/legend-list · @ashstack/legend-state · @ashstack/reanimated · @ashstack/turbo-image · @ashstack/skia · @ashstack/keyboard

Detection only sets the default. Turn any module on or off yourself, whatever your dependencies say:

reactNative({ unistyles: false, i18n: true });

Import bans follow detection only; disable one by rule name.

Opt-in rules

Off by default, since they need a team decision first: `@ashstack/react/prefer-design-system` and `@ashstack/react/components-tsx-only`.

Rule reference

RULES.md covers every rule, with options and examples. It is generated from the rules and CI-checked.

License

MIT

版本与发布记录

@ashstack/lint 共发布 19 个版本,首次发布于 2026/09/02;过去 12 个月发布了 19 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.11.0latest2026/09/301 个月前
0.10.42026/09/291 个月前
0.10.32026/09/291 个月前
0.10.22026/09/281 个月前
0.10.12026/09/251 个月前
0.10.02026/09/241 个月前

关于 @ashstack/lint 的常见问题

@ashstack/lint 是什么?

ashStack shared oxlint configuration and custom rules. Entries: core, react, react-native, with per-library rule groups auto-detected from your dependencies. Consume from oxlint.config.mts.

如何安装 @ashstack/lint?

在项目目录运行 npm install @ashstack/lint,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:oxlint(>=1.79.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ashstack/lint 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ashstack/lint 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@ashstack/lint 可以商用吗?

@ashstack/lint 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ashstack/lint 的下载量有多少?

根据 npm 官方下载统计,@ashstack/lint 在 2026/10/07 – 2026/11/05 这 30 天内被下载 5,105 次,日均约 170 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ashstack/lint 还在维护吗?

最新版本 0.11.0 发布于 2026/09/30(1 个月前);至今共发布 19 个版本,其中过去 12 个月发布了 19 个;首次发布于 2026/09/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。