pi-lens
Version:
Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo
53 lines (41 loc) • 974 B
YAML
# CSS Calc Spacing
# Detects calc() operands without correct spacing
id: calc-spacing
name: calc Operands Should Be Correctly Spaced
severity: error
category: reliability
defect_class: correctness
inline_tier: blocking
language: css
message: "calc() operands should be correctly spaced"
description: |
calc() expressions require spaces around + and - operators.
Without spaces, they may be parsed as signs instead of operators.
✅ FIX: Add spaces around + and -
```css
width: calc(100% - 20px); /* GOOD - spaces */
```
query: |
((call_expression
(function_name) @FUNC
(arguments
(_) @LEFT
(_) @RIGHT) @EXPR)
(#eq? @FUNC "calc"))
metavars:
- FUNC
- LEFT
- RIGHT
- EXPR
post_filter: calc_missing_spaces
tags:
- reliability
- css
- syntax
examples:
bad: |
width: calc(100%-20px); /* BAD - no spaces */
good: |
width: calc(100% - 20px); /* GOOD - spaces */
has_fix: true
fix_action: add_calc_spaces