-
Notifications
You must be signed in to change notification settings - Fork 99
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
feat: migrate to new JSX transform #2006
Conversation
Preview is ready. |
Visual Tests Report is ready. |
.eslintrc
Outdated
@@ -32,7 +28,8 @@ | |||
"import/consistent-type-specifier-style": ["error", "prefer-top-level"], | |||
"@typescript-eslint/prefer-ts-expect-error": "error", | |||
"@typescript-eslint/consistent-type-imports": ["error", {"prefer": "type-imports", "fixStyle": "separate-type-imports"}], | |||
"complexity": "off" | |||
"complexity": "off", | |||
"react/react-in-jsx-scope": "off" |
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.
Guide also suggest react/jsx-uses-react
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.
We can simply extend plugin:react/jsx-runtime
which does the job. No need to off the rules here.
{ | ||
"selector": "ImportDeclaration[source.value='react'] :matches(ImportNamespaceSpecifier, ImportSpecifier)", | ||
"message": "Please use import React from 'react' instead." | ||
}, |
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.
Using React
namespace is our codestyle. So import * as React from 'react'
should be the only option.
To accomplish this, change the rule to:
{
"selector": "ImportDeclaration[source.value='react'] :matches(ImportDefaultSpecifier, ImportSpecifier)",
"message": "Please use `import * as React from 'react'` instead."
}
.babelrc
Outdated
} | ||
} | ||
"sourceType": "unambiguous", | ||
"presets": [ |
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.
Please keep current preset order
.eslintrc
Outdated
@@ -32,7 +28,8 @@ | |||
"import/consistent-type-specifier-style": ["error", "prefer-top-level"], | |||
"@typescript-eslint/prefer-ts-expect-error": "error", | |||
"@typescript-eslint/consistent-type-imports": ["error", {"prefer": "type-imports", "fixStyle": "separate-type-imports"}], | |||
"complexity": "off" | |||
"complexity": "off", | |||
"react/react-in-jsx-scope": "off" |
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.
We can simply extend plugin:react/jsx-runtime
which does the job. No need to off the rules here.
# Conflicts: # src/components/Alert/__tests__/Alert.visual.test.tsx
@u4aew Thanks for contribution! |
Description
Added
react-jsx
to tsconfig.json | tsconfig.test.json, updated rules in .eslintrc, updated presets in .babelrc and removedReact
imports.docs
issue: #2003