woocommerce/packages/js/eslint-plugin/docs/rules/zh-cn/dependency-group.md
2026-04-15 10:18:01 +08:00

625 B

强制依赖项文档块格式 (dependency-group)

确保所有顶级包汇入遵循依赖项分组约定。

具体来说,这确保:

  • 根据汇入来源,在汇入前添加适当的“外部依赖项”或“内部依赖项”注释。

规则详情

此规则的错误代码示例:

import { get } from 'lodash';
import { Component } from '@wordpress/element';
import edit from './edit';

此规则的正确代码示例:

/*
 * 外部依赖项
 */
import { get } from 'lodash';
import { Component } from '@wordpress/element';

/*
 * 内部依赖项
 */
import edit from './edit';