useValidLang
¥Summary
-
规则生效日期:
v1.0.0¥Rule available since:
v1.0.0 -
¥Diagnostic Category:
lint/a11y/useValidLang -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
-
来源:
¥Sources:
-
与
jsx-a11y/lang相同¥Same as
jsx-a11y/lang
-
¥How to configure
{ "linter": { "rules": { "a11y": { "useValidLang": "error" } } }}¥Description
确保传递给 lang 属性的属性是正确的 ISO 语言和/或国家/地区。
¥Ensure that the attribute passed to the lang attribute is a correct ISO language and/or country.
¥Examples
¥Invalid
<html lang="lorem" />code-block.jsx:1:12 lint/a11y/useValidLang ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a valid value for the lang attribute.
> 1 │ <html lang=“lorem” />
│ ^^^^^^^
2 │
ℹ Some of valid languages:
- ab
- aa
- af
- sq
- am
- ar
- an
- hy
- as
- ay
- az
- ba
- eu
- bn
- dz
<html lang="en-babab" />code-block.jsx:1:12 lint/a11y/useValidLang ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a valid value for the lang attribute.
> 1 │ <html lang=“en-babab” />
│ ^^^^^^^^^^
2 │
<html lang="en-GB-typo" />code-block.jsx:1:12 lint/a11y/useValidLang ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Provide a valid value for the lang attribute.
> 1 │ <html lang=“en-GB-typo” />
│ ^^^^^^^^^^^^
2 │
ℹ Some of valid scripts:
- Arab
- Armn
- Beng
- Cyrl
- Deva
- Ethi
- Grek
- Gujr
- Guru
- Hang
- Hani
- Hans
- Hant
- Hebr
- Hira
¥Valid
<Html lang="en-babab" />¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号