Skip to content

Rule proposal: no undefined styles #3

Open
@lencioni

Description

@lencioni

Similar to #2, it would be nice to have a rule that enforces the inverse: using styles that are not defined.

Bad:

function MyComponent({ styles }) {
  return (
    <div {...css(styles.foo, styles.bar)}>
      Foo
    </div>
  );
}

export default withStyles(() => ({
  foo: {
    backgroundColor: 'red',
  },
}))(MyComponent);

Good:

function MyComponent({ styles }) {
  return (
    <div {...css(styles.foo, styles.bar)}>
      Foo
    </div>
  );
}

export default withStyles(() => ({
  foo: {
    backgroundColor: 'red',
  },

  bar: {
    color: 'white',
  },
}))(MyComponent);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions