@defra/lis-infra-eslint-config

中文文档
0.12.7发布于 2026/11/10OGL-UK-3.0ES Module近 30 天下载 7269

Shared ESLint flat config for the LIS ecosystem

原始使用文档
文档目录4 节
  1. Usage
  2. Running locally
  3. Project structure
  4. Patterns

lis-infra-eslint-config

Shared ESLint flat config for JavaScript/Node.js repos in the LIS ecosystem.

Using Defra's preferred neostandard as a base, this config adds sonarjs rules based on those enforced by the Defra JavaScript Standard from SonarQube. It also adds requirements for jsdoc, focussed on exported interfaces, to improve maintainability as well as to provide better experience for developers using IDEs and AI coding agents.

Stack: ESM · ESLint flat config (neostandard + sonarjs + jsdoc)


Usage

Install:

npm install --save-dev @defra/lis-infra-eslint-config

In your repo's eslint.config.js:

import lisEslintConfig from '@defra/lis-infra-eslint-config'

export default [
  ...lisEslintConfig
  // repo-specific overrides go here
]

Running locally

npm install
npm run lint       # eslint (lints this repo's own source using its own config)

Project structure

src/
├── index.js         # the exported ESLint flat config array
├── sonarjs.js        # sonarjs-derived rules, sourced from the Defra JS Sonar profile
└── jsdoc.js           # jsdoc rules, requiring docs on exported functions/methods

Patterns

  • Config changes here affect every consuming repo — treat this as a shared contract and version deliberately.
  • These files are flat config data, not logic, so they aren't unit tested — correctness is checked by this repo's own npm run lint dogfooding the config.

版本与发布记录

@defra/lis-infra-eslint-config 共发布 43 个版本,首次发布于 2026/07/30;过去 12 个月发布了 43 个版本。

版本发布日期距今
0.12.7latest2026/11/101 天前
0.12.62026/11/092 天前
0.12.6-lreg-000.alpha.1alpha2026/11/092 天前
0.12.52026/11/092 天前
0.12.42026/11/092 天前
0.12.32026/11/092 天前

关于 @defra/lis-infra-eslint-config 的常见问题

@defra/lis-infra-eslint-config 是什么?

Shared ESLint flat config for the LIS ecosystem

如何安装 @defra/lis-infra-eslint-config?

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

@defra/lis-infra-eslint-config 支持 TypeScript 吗?

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

@defra/lis-infra-eslint-config 支持 ESM 还是 CommonJS?

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

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

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

@defra/lis-infra-eslint-config 可以商用吗?

@defra/lis-infra-eslint-config 使用 OGL-UK-3.0 许可。声明的许可为 OGL-UK-3.0,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@defra/lis-infra-eslint-config 的下载量有多少?

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

@defra/lis-infra-eslint-config 还在维护吗?

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