noBiomeFirstException
¥Summary
-
规则生效日期:
v2.2.0¥Rule available since:
v2.2.0 -
诊断类别:
lint/suspicious/noBiomeFirstException¥Diagnostic Category:
lint/suspicious/noBiomeFirstException -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则包含 safe 修复程序。
¥This rule has a safe fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
¥How to configure
{ "linter": { "rules": { "suspicious": { "noBiomeFirstException": "error" } } }}¥Description
防止在 files.includes 字段中误用 glob 模式。
¥Prevents the misuse of glob patterns inside the files.includes field.
否定模式的引导
Section titled “否定模式的引导”¥Leading of negated patterns
如果第一个 files.includes 模式以 ! 开头,则 Biome 将没有任何文件需要抓取。通常,最佳实践是先声明要包含的文件/文件夹,然后再声明要忽略的文件/文件夹。
¥If the first pattern of files.includes starts with the leading !, Biome won’t have any file to crawl. Generally,
it is a good practice to declare the files/folders to include first, and then the files/folder to ignore.
查看 官方文档 以了解更多示例。
¥Check the official documentation for more examples.
¥Examples
¥Invalid
{ "files": { "includes": ["!dist"] }}¥Valid
{ "files": { "includes": ["src/**", "!dist"] }}使用兜底 ** 引导
Section titled “使用兜底 ** 引导”¥Leading with catch-all **
如果用户配置文件继承自其他源(其他配置文件或库),并且这些源在 files.includes 中包含通配符 **,则当用户配置文件中也包含 ** 时,该规则将触发违规。
¥If the user configuration file extends from other sources (other configuration files or libraries), and those files contain the catch-all glob ** in files.includes,
the rule will trigger a violation if also the user configuration file has a **.
¥Invalid
{ "extends": ["./base.json"], "files": { "includes": ["**", "!**/test"] }}{ "files": { "includes": ["**", "!**/dist"] }}¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号