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

FIX: Don't validate props in jsx-no-literals rule #2146

Open
wants to merge 5 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@iiison
Copy link

iiison commented Jan 29, 2019

  • Update Tests Accordingly
  • Update Rule Readme file
  • Rule shouldn't allow strings in empty tags
FIX: Don't validate props in jsx-no-literals rule
- Update Tests Accordingly
- Update Rule Readme file
- Rule shouldn't allow strings in empty tags
FEAT: Add options to validate props
- Introduce new option -- `validateProps` in jsx-no-literals rule.
- Set `validateProps` to `true` by default.
@iiison

This comment has been minimized.

Copy link
Author

iiison commented Feb 7, 2019

@ljharb added new option to validate props. I've set it to true by default so that behaviour stays the same, user can set the value to false in order to remove props validation.

One more thing, rule passes if prop is a strings literal(<div className="abc" />), but if the prop value is a template literal, then rule will throw error. This behaviour was there from starting, LMK if you want to change this.

@iiison

This comment has been minimized.

Copy link
Author

iiison commented Feb 7, 2019

@ljharb the build is breaking from starting, it works fine in my local, is it because I am using ES6 syntax? Could you please help me if you are aware of the error..

Show resolved Hide resolved docs/rules/jsx-no-literals.md
Show resolved Hide resolved docs/rules/jsx-no-literals.md Outdated
Show resolved Hide resolved tests/lib/rules/jsx-no-literals.js Outdated

ljharb and others added some commits Feb 7, 2019

Update docs/rules/jsx-no-literals.md
Co-Authored-By: iiison <i.bharat.soni@gmail.com>
@iiison

This comment has been minimized.

Copy link
Author

iiison commented Feb 7, 2019

@ljharb I see you removed your comment to detect and disallow string literals in props, shall I add that feature or not..

@ljharb

This comment has been minimized.

Copy link
Collaborator

ljharb commented Feb 7, 2019

@iiison i marked it resolved because you indicated you'd incorporate it. There's no reason for a rule called "literals" to differentiate between string and template.

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