mirror of
https://github.com/antebudimir/eslint-plugin-vanilla-extract.git
synced 2026-04-16 00:37:24 +00:00
fix: move wrapper detection to global settings and support cross-module style/recipe wrappers
This commit is contained in:
parent
62b1844b44
commit
3c223c2909
10 changed files with 482 additions and 7 deletions
|
|
@ -195,5 +195,69 @@ run({
|
|||
});
|
||||
`,
|
||||
},
|
||||
|
||||
// Imported local wrapper with global settings style
|
||||
{
|
||||
code: `
|
||||
import { componentStyle } from './style.css.js';
|
||||
|
||||
export const myStyle = componentStyle({
|
||||
padding: '18px',
|
||||
backgroundColor: 'black',
|
||||
});
|
||||
`,
|
||||
settings: {
|
||||
'vanilla-extract': {
|
||||
style: ['componentStyle'],
|
||||
},
|
||||
},
|
||||
errors: [{ messageId: 'alphabeticalOrder' }],
|
||||
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({
|
||||
display: 'flex',
|
||||
color: 'white',
|
||||
});
|
||||
|
||||
export const b = componentStyle({
|
||||
padding: '18px',
|
||||
backgroundColor: 'black',
|
||||
});
|
||||
`,
|
||||
settings: {
|
||||
'vanilla-extract': {
|
||||
style: ['componentStyle'],
|
||||
},
|
||||
},
|
||||
errors: [{ messageId: 'alphabeticalOrder' }, { messageId: 'alphabeticalOrder' }],
|
||||
output: `
|
||||
import { style } from '@vanilla-extract/css';
|
||||
import { componentStyle } from './style.css.js';
|
||||
|
||||
export const a = style({
|
||||
color: 'white',
|
||||
display: 'flex',
|
||||
});
|
||||
|
||||
export const b = componentStyle({
|
||||
backgroundColor: 'black',
|
||||
padding: '18px',
|
||||
});
|
||||
`,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue