feat(gatsby): Add JSX Runtime options to gatsby-config.js#33050
Conversation
|
|
||
| ## jsxAutomaticRuntime | ||
|
|
||
| Allows using JSX without having to import React. |
There was a problem hiding this comment.
Might need further elaboration?
wardpeet
left a comment
There was a problem hiding this comment.
Awesome! Thank you very much.
Could you also add:
"react/jsx-uses-react": "off"to eslint-config.ts
| ) | ||
| .single(), | ||
| developMiddleware: Joi.func(), | ||
| jsxAutomaticRuntime: Joi.boolean().default(false), |
There was a problem hiding this comment.
Could we move to these 2 options please.
| jsxAutomaticRuntime: Joi.boolean().default(false), | |
| jsxRuntime: Joi.string().default('classic'), | |
| jsxImportSource: Joi.string() |
Added that, it looks like the eslint rule won't scan node_modules so plugins will be able to "mix and match" without throwing eslint errors. In addition enforced that the jsxRuntime == "automatic" | "classic" |
|
Might have missed your last part of the comment
What do you want this to do? |
|
We should also set an option to change the importSource to for example to emotion. Ideally, we want to also add an action so plugins can set it themselves importSource is similar to @jsx pragma |
gatsby-config.js
|
@wardpeet I think this is good to go now, There's a failing test but I'm convinced that's unrelated. |
|
@wardpeet I'm struggling with these tests, is it usual to have this level of flake (each run through spits out some new error). I also have no means to rerun this stuff and try and get it through! |
aa1636b to
87d0368
Compare
|
@wardpeet This is a new feature, not a hotfix - do we actually want to backport it to v3? If so, this likely needs a minor release, not a patch. |
Co-authored-by: Ward Peeters <ward@coding-tech.com>
…#33050) Co-authored-by: Ward Peeters <ward@coding-tech.com>
Description
Follow up to #32972.
Allow automatic react runtime to be enabled through config, the current workaround is to start manually setting babelPlugins and eslint config. There's going to be very few people doing this for something that is supposed to work out the box
Related Issues
Fixes #28657
Fixes #30373