Skip to content

Commit e452229

Browse files
committed
Update babel.config.js, tsconfig.json and eslintrc.js
1 parent 628cc5d commit e452229

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

.eslintrc.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ module.exports = {
5555
'react/button-has-type': 'off',
5656
'react/no-array-index-key': 'off',
5757
'react/no-unsafe': ['error', {checkAliases: true}],
58+
59+
// These can be removed when eslint-plugin-react is updated
60+
'react/jsx-uses-react': 'off',
61+
'react/react-in-jsx-scope': 'off',
62+
5863
'@shopify/jsx-no-complex-expressions': 'off',
5964
'@shopify/jsx-prefer-fragment-wrappers': 'off',
6065
'@shopify/no-ancestor-directory-import': 'error',
@@ -165,7 +170,6 @@ module.exports = {
165170
files: ['polaris.shopify.com/**/*'],
166171
extends: 'plugin:@next/eslint-plugin-next/recommended',
167172
rules: {
168-
'react/react-in-jsx-scope': 'off',
169173
'@shopify/jsx-no-hardcoded-content': 'off',
170174
'import/no-default-export': 'off',
171175
},

babel.config.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
/**
22
* @type {import('@babel/core').TransformOptions}
33
*/
4-
module.exports = function () {
4+
module.exports = function (api) {
5+
const envName = api.env();
6+
const development = envName === 'development' || envName === 'test';
7+
58
return {
69
presets: [
710
[
811
'@babel/preset-env',
912
{useBuiltIns: 'entry', corejs: '3.0', bugfixes: true},
1013
],
1114
['@babel/preset-typescript'],
12-
['@babel/preset-react', {runtime: 'automatic', useBuiltIns: true}],
15+
[
16+
'@babel/preset-react',
17+
{
18+
development: envName === 'development' || envName === 'test',
19+
runtime: 'automatic',
20+
useBuiltIns: true,
21+
},
22+
],
1323
],
1424
assumptions: {
1525
setPublicClassFields: true,

polaris-migrator/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"emitDeclarationOnly": true,
77
"outDir": "dist/types",
88
"rootDir": "src",
9-
"jsx": "react",
9+
"jsx": "react-jsx",
1010
"types": ["node", "jest"]
1111
},
1212
"include": ["src"],

polaris-react/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"strictFunctionTypes": false,
1010
"paths": {
1111
"tests/*": ["./tests/*"]
12-
}
12+
},
13+
"jsx": "react-jsx"
1314
},
1415
"include": [
1516
"./src",

polaris.shopify.com/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"moduleResolution": "node",
1616
"resolveJsonModule": true,
1717
"isolatedModules": true,
18-
"jsx": "preserve",
18+
"jsx": "react-jsx",
1919
"composite": true,
2020
"noUnusedLocals": true,
2121
"noUnusedParameters": true

0 commit comments

Comments
 (0)