no-space-between-number-unit

no-space-between-number-unit

🛠️ This rule require configuration.

🔧 This rule is automatically fixable.

📖 Rule Details

The option allows configuring which unit symbols will have spaces removed between the unit and a number. This can be used to control spacing for things like currency symbols, percent signs, temperature units, etc.

<!-- "noSpaceBetweenNumberUnit": ["%", "°"] -->
 
<!-- ✅ Correct -->
 
角度為 90° 的角,就是直角。
 
新 MacBook Pro 有 15% 的 CPU 性能提升。
 
<!-- ❌ Incorrect -->
 
角度為 90 ° 的角,就是直角。
 
新 MacBook Pro 有 15 % 的 CPU 性能提升。
 
 <!-- 🔧 Fixed -->
 
角度為 90° 的角,就是直角。
 
新 MacBook Pro 有 15% 的 CPU 性能提升。

⚙️ Usage

{
  "noSpaceBetweenNumberUnit": ["%", "°"]
}
  • Type: string[]
  • Default: []
  • Description: You have to set an array of strings, where each string is a unit symbol to apply the behavior to, for example: ['%', '°'].