Skip to content

Latest commit

 

History

History
90 lines (71 loc) · 1.4 KB

no-invalid-nesting.md

File metadata and controls

90 lines (71 loc) · 1.4 KB

no-invalid-nesting

Warn against invalid nesting. i.e. nested styles that don't contain the & character.

📋 This rule is enabled in plugin:@pandacss/all.

📋 This rule is enabled in plugin:@pandacss/recommended.

Rule details

❌ Examples of incorrect code:

import { css } from './panda/css';

const styles = css({
  ':hover': { marginLeft: '4px' },
});
import { css } from './panda/css';

function App() {
  return (
    <div
      className={css({
        '.dark ': { background: 'red.100' },
      })}
    />
  );
};
import { Circle } from './panda/jsx';

function App() {
  return (
    <Circle
      css={{
        '[data-focus]': { position: 'absolute' },
      }}
    />
  );
}

✔️ Examples of correct code:

import { css } from './panda/css';

const styles = css({
  '&:hover': { marginLeft: '4px' },
});
import { css } from './panda/css';

function App() {
  return (
    <div
      className={css({
        '.dark &': { background: 'red.100' },
      })}
    />
  );
};
import { Circle } from './panda/jsx';

function App() {
  return (
    <Circle
      css={{
        '&[data-focus]': { position: 'absolute' },
      }}
    />
  );
}

Resources