stylex icon indicating copy to clipboard operation
stylex copied to clipboard

@stylexjs/eslint-plugin: Error When Using `keyframes` Named Import

Open edamascus opened this issue 1 year ago • 0 comments

The problem

When using the named import of keyframes as follows:

import { create, props, keyframes } from '@stylexjs/stylex';

const beat = keyframes({
  '0%': {
    transform: 'scale(1)',
  },
  // ...
});

const styles = create({
  image: {
    animationName: beat,
    // ...
  }
});

// ...

beat is highlighted with the error: (ESLint) @stylexjs/valid-styles animationName value must be one of...

However, when using the namespace import:

import * as stylex from '@stylexjs/stylex';

const beat = stylex.keyframes({
  '0%': {
    transform: 'scale(1)',
  },
  // ...
});

const styles = create({
  image: {
    animationName: beat,
    // ...
  }
});

// ...

ESLint doesn't report an error.

StyleX works as expected in both cases.

Expected behavior ESLint should not report an error in both cases.

Environment (include versions). Did this work in previous versions? @stylexjs/stylex v0.4.1 @stylexjs/eslint-plugin v0.4.1

edamascus avatar Jan 08 '24 09:01 edamascus