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

eslint-plugin: do not allow undefined as a value #300

Open
layershifter opened this issue Jan 3, 2023 · 2 comments
Open

eslint-plugin: do not allow undefined as a value #300

layershifter opened this issue Jan 3, 2023 · 2 comments
Labels
💅 enhancement New feature or request

Comments

@layershifter
Copy link
Member

layershifter commented Jan 3, 2023

ESLint plugin should prevent passing undefined to properties:

makeStyles({
  // ❌ should throw
  root: { color: undefined },
  // ✅ should pass
  root: { color: 'red' }
})
@layershifter layershifter added the 💅 enhancement New feature or request label Jan 3, 2023
@NotWoods
Copy link
Member

This rule should also disallow empty strings

makeStyles({
  // ❌ should throw
  root: { color: '' }
})

@layershifter
Copy link
Member Author

Agree, however [content](https://developer.mozilla.org/en-US/docs/Web/CSS/content) should have a special handling in errors:

makeStyles({
  // ❌ should throw and recommend to do `content: '""'`
  root: { ":before" { content: '' } },
  // ✅ all good
  root: { ":before" { content: '""' } }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💅 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants