diff --git a/biome b/biome index 81c7a8551..7ea5dffd6 160000 --- a/biome +++ b/biome @@ -1 +1 @@ -Subproject commit 81c7a8551ddaf953fa875c9cd8da85f9a8ceb4ff +Subproject commit 7ea5dffd64d145d59867aacb7555a1ff5e927bd9 diff --git a/src/components/generated/NumberOfRules.astro b/src/components/generated/NumberOfRules.astro index ecb795faa..f8c255014 100644 --- a/src/components/generated/NumberOfRules.astro +++ b/src/components/generated/NumberOfRules.astro @@ -1,2 +1,2 @@ -

Biome's linter has a total of 220 rules

\ No newline at end of file +

Biome's linter has a total of 221 rules

\ No newline at end of file diff --git a/src/content/docs/linter/rules/index.mdx b/src/content/docs/linter/rules/index.mdx index 3e61673d7..55e68f4d7 100644 --- a/src/content/docs/linter/rules/index.mdx +++ b/src/content/docs/linter/rules/index.mdx @@ -280,5 +280,6 @@ Rules that belong to this group are not subject to semantic version🔧 | | [noRestrictedImports](/linter/rules/no-restricted-imports) | Disallow specified modules when loaded by import or require. | | | [noUndeclaredDependencies](/linter/rules/no-undeclared-dependencies) | Disallow the use of dependencies that aren't specified in the package.json. | | +| [noUnknownUnit](/linter/rules/no-unknown-unit) | Disallow unknown CSS units. | | | [useImportRestrictions](/linter/rules/use-import-restrictions) | Disallows package private imports. | | | [useSortedClasses](/linter/rules/use-sorted-classes) | Enforce the sorting of CSS utility classes. | ⚠️ | diff --git a/src/content/docs/linter/rules/no-unknown-unit.md b/src/content/docs/linter/rules/no-unknown-unit.md new file mode 100644 index 000000000..e310bec0a --- /dev/null +++ b/src/content/docs/linter/rules/no-unknown-unit.md @@ -0,0 +1,109 @@ +--- +title: noUnknownUnit (not released) +--- + +**Diagnostic Category: `lint/nursery/noUnknownUnit`** + +:::danger +This rule hasn't been released yet. +::: + +:::caution +This rule is part of the [nursery](/linter/rules/#nursery) group. +::: + +Sources: +- Same as: stylelint/unit-no-unknown + +Disallow unknown CSS units. + +For details on known CSS units, see the [MDN web docs](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#lengths). + +## Examples + +### Invalid + +```css +a { + width: 10pixels; +} +``` + +

nursery/noUnknownUnit.js:2:12 lint/nursery/noUnknownUnit ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+   Unexpected unknown unit: pixels
+  
+    1 │ a {
+  > 2 │   width: 10pixels;
+              ^^^^^^
+    3 │ }
+    4 │ 
+  
+   See MDN web docs for more details.
+  
+   Use a known unit instead, such as:
+  
+  - px
+  - em
+  - rem
+  - etc.
+  
+
+ +```css +a { + width: calc(10px + 10pixels); +} +``` + +
nursery/noUnknownUnit.js:2:24 lint/nursery/noUnknownUnit ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+   Unexpected unknown unit: pixels
+  
+    1 │ a {
+  > 2 │   width: calc(10px + 10pixels);
+                          ^^^^^^
+    3 │ }
+    4 │ 
+  
+   See MDN web docs for more details.
+  
+   Use a known unit instead, such as:
+  
+  - px
+  - em
+  - rem
+  - etc.
+  
+
+ +### Valid + +```css +a { + width: 10px; +} +``` + +```css +a { + width: 10Px; +} +``` + +```css +a { + width: 10pX; +} +``` + +```css +a { + width: calc(10px + 10px); +} +``` + +## Related links + +- [Disable a rule](/linter/#disable-a-lint-rule) +- [Rule options](/linter/#rule-options)