Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule proposal: no undefined styles #3

Open
lencioni opened this issue Aug 31, 2016 · 2 comments
Open

Rule proposal: no undefined styles #3

lencioni opened this issue Aug 31, 2016 · 2 comments

Comments

@lencioni
Copy link
Collaborator

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);
@ljharb
Copy link
Collaborator

ljharb commented Aug 31, 2016

This seems very aspirational - especially if MyComponent is defined in a different file than the HOC.

@lencioni
Copy link
Collaborator Author

I think a 90% solution is better than none.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants