mirror of
https://github.com/antebudimir/eslint-plugin-vanilla-extract.git
synced 2026-04-15 16:27:25 +00:00
cover base array sorting in alphabetical and custom order rules
This commit is contained in:
parent
248e403a74
commit
0bd37dd744
2 changed files with 93 additions and 0 deletions
|
|
@ -36,6 +36,18 @@ run({
|
|||
}
|
||||
});
|
||||
`,
|
||||
|
||||
// Recipe with base as array (ComplexStyleRule)
|
||||
`
|
||||
import { recipe } from '@vanilla-extract/recipes';
|
||||
|
||||
const myRecipe = recipe({
|
||||
base: [{
|
||||
alignItems: 'center',
|
||||
display: 'flex'
|
||||
}],
|
||||
});
|
||||
`,
|
||||
],
|
||||
invalid: [
|
||||
// Recipe with incorrect ordering
|
||||
|
|
@ -88,5 +100,28 @@ run({
|
|||
});
|
||||
`,
|
||||
},
|
||||
|
||||
// Recipe with base array in incorrect order
|
||||
{
|
||||
code: `
|
||||
import { recipe } from '@vanilla-extract/recipes';
|
||||
const myRecipe = recipe({
|
||||
base: [{
|
||||
display: 'flex',
|
||||
alignItems: 'center'
|
||||
}],
|
||||
});
|
||||
`,
|
||||
errors: [{ messageId: 'alphabeticalOrder' }],
|
||||
output: `
|
||||
import { recipe } from '@vanilla-extract/recipes';
|
||||
const myRecipe = recipe({
|
||||
base: [{
|
||||
alignItems: 'center',
|
||||
display: 'flex'
|
||||
}],
|
||||
});
|
||||
`,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
}],
|
||||
});
|
||||
`,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue