@cosyte/eslint-config

中文文档
0.1.4发布于 2026/11/09MITES Module构建来源已验证近 30 天下载 6092

Shared ESLint flat config (ESLint 10 + typescript-eslint) for @cosyte/* packages.

原始使用文档
文档目录11 节
  1. Why this exists
  2. Status
  3. Install
  4. Usage
  5. Entry points
  6. Overrides
  7. PHI and safety
  8. API
  9. Compatibility
  10. Contributing
  11. License
The Cosyte logo on its own white ground: the icon beside the word Cosyte.

@cosyte/eslint-config

The Cosyte lint bar in one factory call: no any, no undocumented public export, no drift.

npm version CI License: MIT Node

Shared ESLint flat config (ESLint 10 + typescript-eslint) for @cosyte/* packages.

Why this exists

A healthcare parser's lint rules are not style preferences. no-explicit-any and the cast rules are what keep a claim about a field's type from being a guess, and a JSDoc gate on public exports is what keeps a published API from shipping undocumented. Copied per repository, those rules get relaxed locally to unblock a release and stay relaxed.

The nearest alternative is eslint-config-airbnb or a hand-rolled flat config per repo. Neither encodes the Cosyte rules, and neither closes the drift: this is a published package, so a rule added here reaches every consumer as a version bump.

Status

@cosyte/eslint-config is on the Cosyte 0.1.x line: the public API is settled and bump types follow ordinary semver.

The factory signature cosyte(tsconfigRootDir, opts?) is settling, but the RULE SET behind it is not: rules are added as the parsers find gaps, and a version bump can therefore red a consumer that was passing. Pin an exact version if you need a lint run to stay green across an install.

Install

pnpm add -D @cosyte/eslint-config eslint typescript

eslint (^9 or ^10) and typescript are peer dependencies. Node >=22.22.2, which eslint-plugin-jsdoc 65 requires. ESM only.

Usage

eslint.config.js exports the array the factory returns:

import cosyte from "@cosyte/eslint-config";

const config = cosyte(import.meta.dirname);
Array.isArray(config); // => true

The argument is tsconfigRootDir: the directory holding the tsconfig.json the type-checked rules resolve against, which is why import.meta.dirname is the normal value. Lint at --max-warnings=0, which is what every @cosyte/* repo's lint script passes.

Entry points

entry pointwhat it is
@cosyte/eslint-configthe default export cosyte(tsconfigRootDir, opts?), a flat-config array factory

One entry point, so @cosyte/eslint-config is the only specifier a consumer ever writes.

Overrides

The second argument is the whole override surface: opts.ignores appends ignore globs, opts.files replaces which globs the type-checked rules apply to, and opts.library drops the JSDoc, @example and no-console gates for an application. The API below states each one's default.

Every type-safety rule (no any, no unjustified casts, exhaustiveness, strict imports) stays on either way. An application has no published API surface to document and legitimately logs; it has no license to be less type-safe, so that half is not reachable through opts at all. Appending your own config object after the factory's array is ESLint's own escape hatch and nothing here can stop it, but a rule switched off that way is switched off in one repo while every sibling still enforces it. Change it here and take a version bump instead.

PHI and safety

This package is lint configuration. It reads source files to check them and never executes them, and it sees no patient data: nothing here logs, retains or transmits anything.

The rules do carry a safety intent worth naming. no-console in library code is not tidiness, it is what keeps a parser from printing a field it was handed, and the type-safety rules are what keep a PHI-bearing field from being cast into something the compiler stops checking. The gate that actually scans for patient data is @cosyte/script-utils/phi-scan, not this package.

API

The factory is cosyte(tsconfigRootDir, opts?):

  • opts.ignores: extra ignore globs.
  • opts.files: override which globs the type-checked rules apply to (defaults to src / test / scripts / *.config.ts).
  • opts.library: defaults to true. Set false for an application (for example a service or engine) to drop the JSDoc and @example gate and no-console. Every type-safety rule (no any, no unjustified casts, exhaustiveness, strict imports) stays on either way: apps just have no published API surface to document and legitimately log.
// An application: same type safety, no doc/console gate.
export default cosyte(import.meta.dirname, { library: false });

Compatibility

ESLint 10 flat config, built on the unified typescript-eslint package at recommendedTypeChecked, so type-aware linting needs a real tsconfig and the tsconfigRootDir the factory takes. Tests and build scripts relax the JSDoc and console rules. eslint-config-prettier is applied last, so formatting stays Prettier's job and no rule here fights it.

Contributing

Questions, bug reports and proposals go to the issue tracker. Pull requests are welcome, in cosyte/config, where this package lives.

A change has to clear the required verify job, and a new rule needs a changeset saying what it refuses: adding one reds every consumer that was passing without it.

License

MIT, copyright Cosyte LLC. See LICENSE.

版本与发布记录

@cosyte/eslint-config 共发布 10 个版本,首次发布于 2026/06/25;过去 12 个月发布了 10 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.4latest2026/11/092 天前
0.1.32026/11/082 天前
0.1.22026/11/082 天前
0.1.12026/11/083 天前
0.1.02026/09/211 个月前
0.0.62026/08/053 个月前

关于 @cosyte/eslint-config 的常见问题

@cosyte/eslint-config 是什么?

Shared ESLint flat config (ESLint 10 + typescript-eslint) for @cosyte/* packages.

如何安装 @cosyte/eslint-config?

在项目目录运行 npm install @cosyte/eslint-config,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:eslint(^9.0.0 || ^10.0.0)、typescript(>=5.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@cosyte/eslint-config 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/cosyte__eslint-config 是否存在。

@cosyte/eslint-config 支持 ESM 还是 CommonJS?

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

@cosyte/eslint-config 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.22.2。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cosyte/eslint-config 可以商用吗?

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

@cosyte/eslint-config 的下载量有多少?

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

@cosyte/eslint-config 还在维护吗?

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