-
Notifications
You must be signed in to change notification settings - Fork 318
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: strict report for stylex.create argument as object expression #141
fix: strict report for stylex.create argument as object expression #141
Conversation
Hi @kotarella1110! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
61fa5e5
to
dfdfa3c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this change can be made without a bigger refactor, but I'll let the tests run in case this is accounted for.
@@ -2347,8 +2347,7 @@ const stylexValidStyles = { | |||
node && | |||
node.type === 'CallExpression' && | |||
isStylexCallee(node.callee) && | |||
node.arguments.length === 1 && | |||
node.arguments[0].type === 'ObjectExpression' | |||
node.arguments.length === 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the code still depends on it being an object expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! The tests are still working.
I'll merge for now since the tests are still passing. The bigger refactor can wait. |
What do you mean? The only fix to this PR is that the following code is executed when a value other than stylex/packages/eslint-plugin/src/stylex-valid-styles.js Lines 2745 to 2755 in ca1dc8b
Prior to this fix, the following code would not report a problem, but now it does. stylex.create("test")
stylex.create(1)
const foo = {}
stylex.create(foo) |
@kotarella1110 That's my misunderstanding. Thanks! |
What changed / motivation ?
I have fixed to report when a value other than an
ObjectExpression
is specified as an argument forstylex.create
.Additional Context
Pre-flight checklist
Contribution Guidelines