Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 959 Bytes

no-unused-stylesheet.md

File metadata and controls

56 lines (39 loc) · 959 Bytes

no-unused-stylesheet

Rule Details

This rule aims to find unused SX stylesheet definitions.

Examples of incorrect code for this rule:

import sx from '@adeira/sx';

export default function MyComponent() {
  return null;
}

// Unused ⚠️
const styles = sx.create({
  aaa: { color: 'red' },
});
import sx from '@adeira/sx';

export default function MyComponent() {
  return <div className={styles('aaa')} />;
}

const styles = sx.create({
  aaa: { color: 'red' },
  bbb: { color: 'blue' }, // Unused ⚠️
  ccc: { color: 'green' }, // Unused ⚠️
});

Examples of correct code for this rule:

import sx from '@adeira/sx';

export default function MyComponent() {
  return <div className={styles('aaa')} />;
}

const styles = sx.create({
  aaa: { color: 'red' },
});

Options

none

When Not To Use It

There should be no valid reason to turn this rule off. It helps with a dead code elimination.