Skip to content

🏗 Lint uses of core/dom/jsx#36881

Merged
alanorozco merged 10 commits intoampproject:mainfrom
alanorozco:lint-jsx
Nov 11, 2021
Merged

🏗 Lint uses of core/dom/jsx#36881
alanorozco merged 10 commits intoampproject:mainfrom
alanorozco:lint-jsx

Conversation

@alanorozco
Copy link
Copy Markdown
Member

@alanorozco alanorozco commented Nov 10, 2021

Closes #36679

This handles all caveats mentioned except mapped attribute names, which are handled by local/preact-preferred-props

Also transfers relevant rules from local/preact into local/core-dom-jsx.

@amp-owners-bot
Copy link
Copy Markdown

amp-owners-bot bot commented Nov 10, 2021

Hey @erwinmombay! These files were changed:

build-system/eslint-rules/core-dom-jsx.js
build-system/eslint-rules/preact.js

Hey @jridgewell! These files were changed:

build-system/eslint-rules/core-dom-jsx.js
build-system/eslint-rules/preact.js
src/core/dom/jsx.js

Hey @gmajoulet, @newmuis! These files were changed:

extensions/amp-story/1.0/amp-story-system-layer.js
extensions/amp-story/1.0/toast.js

isCoreDomJsx = false;
},
ImportNamespaceSpecifier(node) {
if (node.parent.source.value.endsWith('core/dom/jsx')) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another one for #36680

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll handle that right after this so I can start off with a clean preact rule.

Comment on lines +51 to +52
node.value.expression?.type === 'Literal' ||
node.value.expression?.type === 'TemplateLiteral'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the expression?.type optional chain because of JSX nodes as direct values of attributes? I'm surprised you caught that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Wow, I did not know this was possible! I used an optional chain out of habit only.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lint unsupported features when using #core/dom/jsx

3 participants