@box/frontend

中文文档
12.1.0发布于 2026/10/09SEE LICENSE IN LICENSEESM + CJS近 30 天下载 3400

Common config and tools for frontend projects

原始使用文档
文档目录5 节
  1. ESLint
  2. Stylelint
  3. Prettier
  4. Commit Linter
  5. VSCode

npm version

This project is used by other Box frontend projects for development dependencies only. Unless you are a part of another Box project, you should not be consuming any code from here. It is completely unsupported and can be highly unstable for non-box consumption.

Dependencies

See package.json for dependencies and peer dependencies.

Node.js 24 is the supported runtime for development, CI, and tooling. Node.js 22 still works but is deprecated and will be removed in a future major release; consumers are expected to migrate to Node.js 24 as soon as possible. .nvmrc, .node-version, and mise.toml pin Node 24 for development.

Migration

See MIGRATION.md for the index and migrations/v<N>-to-v<N+1>.md for the per-version upgrade guide.

Configs

ESLint

Stylelint

Prettier

Commit Linter

Lint Staged Files

To automatically format changed files on commit, add lint-staged and husky configuration to package.json:

{
  "devDependencies": {
    "husky": "^1.1.2",
    "lint-staged": "^8.0.4"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "linters": {
      "*.js": [
        "eslint --max-warnings=0 --report-unused-disable-directives --fix",
        "git add"
      ],
      "*.md": ["prettier --write --parser=markdown", "git add"],
      "*.json": ["prettier --write --parser=json", "git add"]
    }
  }
}

i18n

Webpack Plugins

Editor Integration

VSCode

See ./.vscode recommended extensions and settings.

PluginEnabledAutofix
ESLint✔𐄂
Prettier✔✔

Some ESLint rules can interfere with debugging in development, so autofixing ESLint is not recommended. ESLint rules can be highlighted in your editor and enforced on commit and in CI instead.

Contributing

See CONTRIBUTING and the dev container setup.

Copyright and License

Copyright 2016-present Box, Inc. All Rights Reserved.

Licensed under the Box Software License Agreement v.20170516. You may not use this file except in compliance with the License. You may obtain a copy of the License at

https://developer.box.com/docs/box-sdk-license

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

版本与发布记录

@box/frontend 共发布 54 个版本,首次发布于 2018/11/03;过去 12 个月发布了 5 个版本。

版本发布日期距今
12.1.0latest2026/10/0929 天前
12.0.32026/08/202 个月前
12.0.22026/07/173 个月前
12.0.12026/07/173 个月前
12.0.02026/07/153 个月前
11.1.12025/11/051 年前

其他发布通道:release-9.x → 9.0.1。

关于 @box/frontend 的常见问题

@box/frontend 是什么?

Common config and tools for frontend projects

如何安装 @box/frontend?

在项目目录运行 npm install @box/frontend,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:husky(^3.1.0)、eslint(^8.57.0)、lodash(^4.17.15)、postcss(^8.4.49)、prettier(^3.8.3)、stylelint(^16.18.0)、typescript(^5.9.3)、lint-staged(^9.5.0)、@box/cldr-data(^34.2.0)、@box/languages(^1.0.0)、@commitlint/cli(^19.8.0)、stylelint-order(^7.0.0)、intl-messageformat(^2.2.0)、eslint-plugin-react(^7.34.1)、@babel/eslint-parser(^7.24.1)、eslint-config-airbnb(^19.0.4)、eslint-plugin-import(^2.29.1)、eslint-plugin-lodash(^7.4.0)、eslint-plugin-ft-flow(^3.0.7)、eslint-config-prettier(^9.1.0)、eslint-plugin-formatjs(^4.12.2)、eslint-plugin-jsx-a11y(^6.8.0)、@typescript-eslint/parser(^8.59.4)、eslint-plugin-react-hooks(^4.6.0)、stylelint-config-standard(^38.0.0)、conventional-changelog-cli(^2.0.28)、stylelint-config-clean-order(^7.0.0)、stylelint-config-standard-scss(^15.0.1)、@commitlint/config-conventional(^19.8.0)、@typescript-eslint/eslint-plugin(^8.59.4)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 props2es、buildBundles,可以用 npx props2es 直接运行。

@box/frontend 支持 TypeScript 吗?

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

@box/frontend 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@box/frontend 需要什么版本的 Node.js?

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

@box/frontend 可以商用吗?

@box/frontend 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@box/frontend 的下载量有多少?

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

@box/frontend 还在维护吗?

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