Commit c58808f
authored
* feat: deprecate bare @variable in non-value at-rule positions
Bare @var in at-rule preludes, names, and identifiers is deprecated in
favour of @{foo} interpolation; the bare form still resolves, so this is
a warning only (id: variable-in-at-rule-prelude, respects
--quiet-deprecations and the repetition cap).
Covered positions:
- @media / @container feature preludes
- @supports / @document / unknown & custom at-rule preludes
- @Keyframes / @counter-style / @charset identifiers
- @layer names and lists
- @namespace prefix
@{foo} interpolation is now accepted in these positions as the migration
target (previously it errored in most of them). A bare @var in a nested
declaration value -- e.g. @supports (display: @v) or @media
(min-width: @v) -- is NOT deprecated: it is a declaration value and
stays valid, detected via paren-depth awareness so parsing and output
are unchanged.
Value-position parsing is otherwise untouched: @var works, @{var} is not
newly accepted in top-level declaration values.
Migrates existing fixtures to @{var} and adds a dedicated fixture
locking in backward-compatible resolution of the bare form.
* fix: also deprecate @@variable-variable prefix in @namespace
The @namespace prefix lookahead used `@[\w-]`, which misses an indirect
`@@ref` (variable-variable) reference — entities.variable() accepts
`@@name`, so `@namespace @@ref "..."` fell through to expression() and
resolved without the deprecation warning. Widen the lookahead to
`@@?[\w-]` so @@-prefixes hit the same warning path. Adds fixture
coverage.
1 parent 8ae2cc3 commit c58808f
9 files changed
Lines changed: 267 additions & 25 deletions
File tree
- packages
- less/lib/less
- parser
- test-data
- tests-config/at-rules-compressed-evaluation
- tests-unit
- at-rule-variable-deprecated
- container
- media
- permissive-parse
- variables-in-at-rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | | - | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
74 | 83 | | |
75 | 84 | | |
76 | 85 | | |
| |||
86 | 95 | | |
87 | 96 | | |
88 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
89 | 134 | | |
90 | 135 | | |
91 | 136 | | |
| |||
1636 | 1681 | | |
1637 | 1682 | | |
1638 | 1683 | | |
1639 | | - | |
| 1684 | + | |
1640 | 1685 | | |
1641 | 1686 | | |
1642 | 1687 | | |
| |||
1695 | 1740 | | |
1696 | 1741 | | |
1697 | 1742 | | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
1698 | 1746 | | |
1699 | | - | |
| 1747 | + | |
| 1748 | + | |
1700 | 1749 | | |
1701 | 1750 | | |
1702 | 1751 | | |
| |||
1723 | 1772 | | |
1724 | 1773 | | |
1725 | 1774 | | |
1726 | | - | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
1727 | 1789 | | |
1728 | 1790 | | |
1729 | 1791 | | |
| |||
1776 | 1838 | | |
1777 | 1839 | | |
1778 | 1840 | | |
1779 | | - | |
1780 | | - | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
1781 | 1850 | | |
1782 | 1851 | | |
1783 | | - | |
| 1852 | + | |
1784 | 1853 | | |
1785 | 1854 | | |
1786 | 1855 | | |
| |||
1889 | 1958 | | |
1890 | 1959 | | |
1891 | 1960 | | |
1892 | | - | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
1893 | 1972 | | |
1894 | 1973 | | |
1895 | 1974 | | |
| |||
1980 | 2059 | | |
1981 | 2060 | | |
1982 | 2061 | | |
1983 | | - | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
1984 | 2073 | | |
1985 | 2074 | | |
1986 | 2075 | | |
| |||
2094 | 2183 | | |
2095 | 2184 | | |
2096 | 2185 | | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
2097 | 2202 | | |
2098 | | - | |
| 2203 | + | |
2099 | 2204 | | |
2100 | 2205 | | |
2101 | 2206 | | |
| |||
2111 | 2216 | | |
2112 | 2217 | | |
2113 | 2218 | | |
2114 | | - | |
| 2219 | + | |
2115 | 2220 | | |
2116 | 2221 | | |
2117 | 2222 | | |
2118 | 2223 | | |
2119 | 2224 | | |
2120 | | - | |
| 2225 | + | |
2121 | 2226 | | |
2122 | 2227 | | |
2123 | | - | |
| 2228 | + | |
2124 | 2229 | | |
2125 | 2230 | | |
2126 | 2231 | | |
| |||
2205 | 2310 | | |
2206 | 2311 | | |
2207 | 2312 | | |
2208 | | - | |
| 2313 | + | |
2209 | 2314 | | |
2210 | 2315 | | |
2211 | 2316 | | |
2212 | 2317 | | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
2213 | 2328 | | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
2214 | 2332 | | |
2215 | 2333 | | |
2216 | 2334 | | |
| |||
packages/test-data/tests-config/at-rules-compressed-evaluation/at-rules-compressed-evaluation.less
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
Lines changed: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
0 commit comments