Skip to content

chore(jsx): add jsx transformer #181

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

Closed
wants to merge 3 commits into from
Closed

Conversation

mtomcal
Copy link

@mtomcal mtomcal commented Nov 23, 2021

  • BREAKING CHANGE?

Description

We had difficulties with upgrading svg-icons library due to recent breaking changes from babel-eslint to @babel/eslint-parser. We introduced the JSX transformer in order to properly parse JSX files for ESLint given the new Babel change.

@mtomcal mtomcal requested a review from a team as a code owner November 23, 2021 21:31
plugins/react.js Outdated
babelOptions: {
plugins: [
jsxDevTransform
]
Copy link
Author

@mtomcal mtomcal Nov 23, 2021

Choose a reason for hiding this comment

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

No resorting to preset: '@babel/preset-react. We only needed @babel/plugin-transform-react-jsx-development to make this work for svg-icons.

Copy link
Member

Choose a reason for hiding this comment

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

Why not just use the preset, which doesn't require the eslint-disable clauses (inside the eslint-config 😬)?

Also, this should be added to the index where jsx: true.

Copy link
Author

Choose a reason for hiding this comment

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

After a convo offline, we will go with @babel/preset-react as the simplest option.

Copy link
Member

Choose a reason for hiding this comment

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

Also, this should be added to the index where jsx: true.

Also per offline convo, might be best to consolidate all the react/jsx stuff right here. In which case, we handle the peers a bit differently (aka, they aren't spelled out in the package.json)

plugins/react.js Outdated
babelOptions: {
plugins: [
jsxDevTransform
]
Copy link
Member

Choose a reason for hiding this comment

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

Why not just use the preset, which doesn't require the eslint-disable clauses (inside the eslint-config 😬)?

Also, this should be added to the index where jsx: true.

Comment on lines +31 to +33
"@babel/core": "^7.16.0",
"@babel/eslint-parser": "^7.15.0",
"@babel/preset-react": "^7.16.0",
Copy link
Member

Choose a reason for hiding this comment

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

Garden devDependencies need to be specific (and latest), not hat-range, versions.

Comment on lines +14 to +17
},
requireConfigFile: false,
babelOptions: {
presets: ['@babel/preset-react']
Copy link
Member

Choose a reason for hiding this comment

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

We don't want this requireConfigFile setting here. The existence of the config file is generally desirable; we turn it off for the repos where it is known not to exist.

But this is raising a larger question for me... I had verified the @babel/eslint-parser upgrade against both react-components and react-containers. I'm back to wondering if this is a JSX support preset that actually should live here?

After re-reading https://www.npmjs.com/package/@babel/eslint-parser re: requireConfigFile, I'm convinced that the majority case is that repos with React/JSX will also have a Babel config that the @babel/eslint-parser will follow. And svg-icons is the minority case that should have this babelOptions: { presets: ... } setting as a one-off.

A 1000 humble apologies for the whip around on this @mtomcal. But, as a centralized config for all of Garden, I think it is worth worrying about getting this right. tldr; I'm thinking we don't need this PR and should keep the added babelOptions config local to svg-icons.

@jzempel
Copy link
Member

jzempel commented Nov 30, 2021

closed by zendeskgarden/svg-icons#246

@jzempel jzempel closed this Nov 30, 2021
@jzempel jzempel deleted the mtomcal/add-jsx-transformer branch July 18, 2023 12:52
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.

2 participants