mirror of
https://github.com/antebudimir/eslint-plugin-vanilla-extract.git
synced 2026-06-27 15:10:47 +00:00
fix: move wrapper detection to global settings and support cross-module style/recipe wrappers (#9)
This commit is contained in:
parent
aec1bf7d5d
commit
787d74ec6b
10 changed files with 486 additions and 10 deletions
|
|
@ -375,5 +375,81 @@ run({
|
|||
});
|
||||
`,
|
||||
},
|
||||
|
||||
// Imported local wrapper with global settings style
|
||||
{
|
||||
code: `
|
||||
import { componentStyle } from './style.css.js';
|
||||
|
||||
export const myStyle = componentStyle({
|
||||
padding: '18px',
|
||||
backgroundColor: 'black',
|
||||
});
|
||||
`,
|
||||
options: [
|
||||
{
|
||||
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
||||
sortRemainingProperties: 'concentric',
|
||||
},
|
||||
],
|
||||
settings: {
|
||||
'vanilla-extract': {
|
||||
style: ['componentStyle'],
|
||||
},
|
||||
},
|
||||
errors: [{ messageId: 'incorrectOrder' }],
|
||||
output: `
|
||||
import { componentStyle } from './style.css.js';
|
||||
|
||||
export const myStyle = componentStyle({
|
||||
backgroundColor: 'black',
|
||||
padding: '18px',
|
||||
});
|
||||
`,
|
||||
},
|
||||
|
||||
// Both vanilla style and configured wrapper should be linted (wrapper augments, not replaces)
|
||||
{
|
||||
code: `
|
||||
import { style } from '@vanilla-extract/css';
|
||||
import { componentStyle } from './style.css.js';
|
||||
|
||||
export const a = style({
|
||||
color: 'white',
|
||||
display: 'flex',
|
||||
});
|
||||
|
||||
export const b = componentStyle({
|
||||
padding: '18px',
|
||||
backgroundColor: 'black',
|
||||
});
|
||||
`,
|
||||
options: [
|
||||
{
|
||||
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
||||
sortRemainingProperties: 'concentric',
|
||||
},
|
||||
],
|
||||
settings: {
|
||||
'vanilla-extract': {
|
||||
style: ['componentStyle'],
|
||||
},
|
||||
},
|
||||
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
||||
output: `
|
||||
import { style } from '@vanilla-extract/css';
|
||||
import { componentStyle } from './style.css.js';
|
||||
|
||||
export const a = style({
|
||||
display: 'flex',
|
||||
color: 'white',
|
||||
});
|
||||
|
||||
export const b = componentStyle({
|
||||
backgroundColor: 'black',
|
||||
padding: '18px',
|
||||
});
|
||||
`,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue