Skip to content

Commit

Permalink
Fix: Allow references to object constants in ESLint plugin (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
kotarella1110 authored Dec 12, 2023
1 parent 31bc58c commit ca1dc8b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 12 additions & 0 deletions packages/eslint-plugin/__tests__/stylex-valid-styles-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,18 @@ eslintTester.run('stylex-valid-styles', rule.default, {
`,
],
invalid: [
{
code: `
import stylex from 'stylex';
const styles = {default: {width: '30pt'}};
stylex.create(styles);
`,
errors: [
{
message: 'Styles must be represented as JavaScript objects',
},
],
},
{
code: "import stylex from 'stylex'; stylex.create({default: {textAlin: 'left'}});",
errors: [
Expand Down
3 changes: 1 addition & 2 deletions packages/eslint-plugin/src/stylex-valid-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

Expand Down

0 comments on commit ca1dc8b

Please sign in to comment.