Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
romainmenke committed Jun 30, 2023
1 parent 5993d79 commit caf90ce
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/rules/unit-disallowed-list/index.js
Expand Up @@ -198,15 +198,16 @@ const rule = (primary, secondaryOptions) => {
* For CSS authors however this distinction doesn't make sense, so we convert
* percentage tokens to dimension tokens with a unit of "%".
*
* @param {string} value
* Percentage tokens also aren't valid in media queries.
* Converting percentage tokens to dimension tokens simplifies any code checking for units.
*
* @param {string} css
* @returns {Array<import('@csstools/css-tokenizer').CSSToken>}
*/
function tokenizeWithoutPercentages(value) {
return tokenize({ css: value }).map((x) => {
function tokenizeWithoutPercentages(css) {
return tokenize({ css }).map((x) => {
if (x[0] !== TokenType.Percentage) return x;

// Percentage values are not valid in media queries, so we can't parse them and get something valid back.
// Dimension tokens with a unit of "%" work just fine.
return [
TokenType.Dimension,
x[1],
Expand Down

0 comments on commit caf90ce

Please sign in to comment.