Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 915 Bytes

valid-usage.md

File metadata and controls

54 lines (39 loc) · 915 Bytes

valid-usage

Rule Details

This rule tries to catch obviously invalid SX usages.

Examples of incorrect code for this rule:

const styles = sx.create(); // should not be empty ⚠️
const animation = sx.keyframes(); // should not be empty ⚠️
const styles = sx.create(
  'should be an object, not a string', // ⚠️
);
const styles = sx.create({
  aaa: 'this should be an object', // ⚠️
});
const styles = sx.create(
  { aaa: { color: 'red' } },
  'unknown argument', // ⚠️
);

Examples of correct code for this rule:

import { create } from '@adeira/sx';

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

const styles = create({
  aaa: { color: 'red' },
  bbb: { color: 'blue' },
});

Options

none

When Not To Use It

There should be no valid reason to turn this rule off.