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

[New] jsx-no-literals: new config for allowedProps #3588

Closed
wants to merge 1 commit into from
Closed

[New] jsx-no-literals: new config for allowedProps #3588

wants to merge 1 commit into from

Conversation

thiagofelix
Copy link

Fixes #3003

This is adding a new property allowedProps to whitelist props allowed to have string literals. Some examples are class id and etc.

@codecov
Copy link

codecov bot commented Jun 15, 2023

Codecov Report

Merging #3588 (3275ae4) into master (9c5ac98) will decrease coverage by 1.60%.
The diff coverage is 100.00%.

❗ Current head 3275ae4 differs from pull request most recent head e866741. Consider uploading reports for the commit e866741 to get more accurate results

@@            Coverage Diff             @@
##           master    #3588      +/-   ##
==========================================
- Coverage   97.62%   96.03%   -1.60%     
==========================================
  Files         132      264     +132     
  Lines        9295    18566    +9271     
  Branches     3397     6784    +3387     
==========================================
+ Hits         9074    17829    +8755     
- Misses        221      737     +516     
Impacted Files Coverage Δ
lib/rules/jsx-no-literals.js 100.00% <100.00%> (ø)

... and 133 files with indirect coverage changes

@@ -116,6 +117,11 @@ var Hello = <Text {...props} />
var Hello = <div class={xx} />
```

```jsx
// an allowed property
var Hello = <div allowed='foo'>allowed</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var Hello = <div allowed='foo'>allowed</div>
var Hello = <div allowed="foo">allowed</div>

tests/lib/rules/jsx-no-literals.js Outdated Show resolved Hide resolved
@thiagofelix thiagofelix requested a review from ljharb June 19, 2023 11:50
@ljharb ljharb changed the title [Fix] jsx-no-literals: new config for allowedProps [New] jsx-no-literals: new config for allowedProps Jul 19, 2023
@ljharb
Copy link
Member

ljharb commented Jul 19, 2023

I've rebased this.

I think it needs to be per-component - I'd think you wouldn't want to allow a prop on every component, only on the specific component(s) that use that prop.

@ljharb ljharb marked this pull request as draft July 19, 2023 18:54
@thiagofelix thiagofelix closed this by deleting the head repository Mar 2, 2024
@ljharb
Copy link
Member

ljharb commented Mar 2, 2024

It’s really unfortunate you deleted the fork; this PR is now unrecoverable.

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

Successfully merging this pull request may close these issues.

jsx-no-literals proposal
2 participants