ESLint平面配置 (v9+),用于美商中心定制.
所需资源
- ESLint 9.x 或更高
- 节点.js ^22.23.4,^24.22.1,或 ^26.12.1
移徙
见 移徙/ 特定版本升级指南的目录。 每个文件的结构都是针对人类和人工智能辅助的迁移.
安装
pnpm add -D eslint @commercetools-frontend/eslint-config-mc-app
使用量
创建一个 eslint.config.js 在工程根中的文件 :
// eslint.config.js
const mcAppConfig = require('@commercetools-frontend/eslint-config-mc-app');
module.exports = [
...mcAppConfig,
// Add your custom config overrides here
];
说明:本套件使用ESLint9中引入的平面配置格式. 如果你从ESLint 8号移民,你需要替换你的 .eslintrc.js 文件为 eslint.config.js。 。 。 .
关于 @commercetools-frontend/eslint-config-mc-app 的常见问题
@commercetools-frontend/eslint-config-mc-app 是什么?
由Merchant Center定制使用的ESLint配置.
如何安装 @commercetools-frontend/eslint-config-mc-app?
在项目目录运行 npm install @commercetools-frontend/eslint-config-mc-app,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:eslint(^9.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。
@commercetools-frontend/eslint-config-mc-app 支持 TypeScript 吗?
该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/commercetools-frontend__eslint-config-mc-app 是否存在。
@commercetools-frontend/eslint-config-mc-app 需要什么版本的 Node.js?
package.json 的 engines 字段要求 Node.js ^22.23.4 || ^24.22.1 || >=26.12.1。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。
@commercetools-frontend/eslint-config-mc-app 可以商用吗?
@commercetools-frontend/eslint-config-mc-app 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。
@commercetools-frontend/eslint-config-mc-app 的下载量有多少?
根据 npm 官方下载统计,@commercetools-frontend/eslint-config-mc-app 在 2026/10/11 – 2026/11/09 这 30 天内被下载 24,310 次,日均约 810 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。
@commercetools-frontend/eslint-config-mc-app 还在维护吗?
最新版本 27.17.1 发布于 2026/11/11(今天);至今共发布 1499 个版本,其中过去 12 个月发布了 204 个;首次发布于 2018/06/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。