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

Add `allow` option in style-prop-object #1819

Open
wants to merge 9 commits into
base: master
from

Conversation

5 participants
@hornta
Copy link

hornta commented Jun 9, 2018

Fixes #1813

@jseminck

This comment has been minimized.

Copy link
Contributor

jseminck commented Jun 9, 2018

I think that we should also make sure that React.createElement(MyCustomElem, { style: "myStyle" }) works if "MyCustomElem" is an exception?

@hornta

This comment has been minimized.

Copy link

hornta commented Jun 9, 2018

@jseminck Oh yes of course. Thank you. I'll try to cover that aswell.

@hornta hornta force-pushed the hornta:style-prop-object-option-allow branch 2 times, most recently from 3db0945 to b36dd68 Jun 9, 2018

@hornta

This comment has been minimized.

Copy link

hornta commented Jun 9, 2018

@jseminck I've updated this PR with React.createElement.
I've also managed to get 100% coverage in this rule 👍

@jseminck

This comment has been minimized.

Copy link
Contributor

jseminck commented Jun 9, 2018

Cool. LGTM from my side, as I attempted to add this improvement myself, and my solution was very similar. 😄

I haven't been involved in this project for a while though so it will need a review from someone else as well.

@ljharb
Copy link
Collaborator

ljharb left a comment

Overall this seems good, thanks

.gitignore Outdated
@@ -21,3 +21,6 @@ sftp-config.json
# Only apps should have lockfiles
yarn.lock
package-lock.json

# Visual Code folder
.vscode

This comment has been minimized.

@ljharb

ljharb Jun 12, 2018

Collaborator

please revert this; specific IDE files should go in your personal global gitignore, and not clutter every repo you use.

const componentName = node.arguments[0].name;

// allowed list contains the name
if (allowed.indexOf(componentName) > -1) {

This comment has been minimized.

@ljharb

ljharb Jun 12, 2018

Collaborator

we should be able to make a Set on line 38, so this doesn't need to be O(n)

// parent element is a JSXOpeningElement
if (node.parent && node.parent.type === 'JSXOpeningElement') {
// store parent element
const jsxOpeningElement = node.parent;

This comment has been minimized.

@ljharb

ljharb Jun 12, 2018

Collaborator

this can be stored prior to the "if", so we don't have to extract it multiple times.

evosch added a commit to evosch/eslint-plugin-react that referenced this pull request Dec 6, 2018

evosch added a commit to evosch/eslint-plugin-react that referenced this pull request Dec 6, 2018

evosch added a commit to evosch/eslint-plugin-react that referenced this pull request Dec 6, 2018

evosch added some commits Dec 6, 2018

@ljharb

This comment has been minimized.

Copy link
Collaborator

ljharb commented Dec 7, 2018

@hornta would you mind checking the "allow edits" checkbox on the right hand side of the PR?

@hornta

This comment has been minimized.

Copy link

hornta commented Dec 7, 2018

@hornta would you mind checking the "allow edits" checkbox on the right hand side of the PR?

Done. I totally forgot this one! 😨

@evosch

This comment has been minimized.

Copy link

evosch commented Dec 7, 2018

Sorry for the duplicate pull request, I'm a bit new to this. How should I get the changes in? Do a PR on hornta/eslint-plugin-react?

@hornta hornta closed this Dec 7, 2018

@ljharb ljharb reopened this Dec 7, 2018

@ljharb

This comment has been minimized.

Copy link
Collaborator

ljharb commented Dec 7, 2018

@evosch yep! Then you can post the link here, and i can merge it in to the PR if needed.

@ljharb

This comment has been minimized.

Copy link
Collaborator

ljharb commented Jan 4, 2019

Just noticed hornta#1 was filed. I'll pull that in soon.

@ljharb ljharb force-pushed the hornta:style-prop-object-option-allow branch from b36dd68 to dc0767e Jan 4, 2019

@ljharb
Copy link
Collaborator

ljharb left a comment

Seems reasonable overall

Show resolved Hide resolved lib/rules/style-prop-object.js Outdated
Update lib/rules/style-prop-object.js
Co-Authored-By: hornta <4553604+hornta@users.noreply.github.com>
@ljharb

ljharb approved these changes Jan 13, 2019

@ljharb ljharb requested review from yannickcr and EvHaus Jan 13, 2019

@EvHaus

EvHaus approved these changes Jan 13, 2019

Copy link
Collaborator

EvHaus left a comment

LGTM

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