fix: lint arrays from recipe's base property (ComplexStyleRule) (#8)
Some checks failed
CI / Build (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Lint (push) Has been cancelled

* fix support ComplexStyleRule array in recipe base
* cover base array sorting in alphabetical and custom order rules
This commit is contained in:
Seongmin Choi 2026-04-28 13:16:21 +09:00 committed by GitHub
parent 62b1844b44
commit aec1bf7d5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 143 additions and 7 deletions

View file

@ -88,6 +88,29 @@ run({
},
],
},
// Recipe with base as array (ComplexStyleRule)
{
code: `
import { recipe } from '@vanilla-extract/recipes';
const myRecipe = recipe({
base: [{
width: '100%',
margin: 0,
display: 'flex',
alignItems: 'center',
backgroundColor: 'white'
}],
});
`,
options: [
{
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
sortRemainingProperties: 'concentric',
},
],
},
],
invalid: [
// Recipe with incorrect ordering (concentric for remaining)
@ -207,5 +230,40 @@ run({
});
`,
},
// Recipe with base array in incorrect order
{
code: `
import { recipe } from '@vanilla-extract/recipes';
const myRecipe = recipe({
base: [{
backgroundColor: 'white',
width: '100%',
display: 'flex',
alignItems: 'center',
margin: 0
}],
});
`,
options: [
{
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
sortRemainingProperties: 'concentric',
},
],
errors: [{ messageId: 'incorrectOrder' }],
output: `
import { recipe } from '@vanilla-extract/recipes';
const myRecipe = recipe({
base: [{
width: '100%',
margin: 0,
display: 'flex',
alignItems: 'center',
backgroundColor: 'white'
}],
});
`,
},
],
});