Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e811086

Browse files
authoredMar 20, 2019
chore: Upgrade to Babel 7 (#274)
2 parents 49f1c60 + cb671c5 commit e811086

File tree

6 files changed

+1655
-1847
lines changed

6 files changed

+1655
-1847
lines changed
 

‎.babelrc

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
{
22
"presets": [
3-
["env", {
4-
"loose": true
5-
}],
6-
"stage-1",
7-
"react"
3+
["@4c", {
4+
"runtime": true,
5+
"corejs": 2,
6+
"targets": {}
7+
}]
88
],
99
"plugins": [
10-
"dev-expression",
11-
"transform-runtime", // Need stage-3 Symbol polyfill.
1210
"add-module-exports"
1311
]
1412
}

‎package.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"main": "lib/index.js",
99
"types": "lib/index.d.ts",
1010
"scripts": {
11-
"build": "rimraf lib && babel src -d lib && cpy types/*.d.ts lib",
11+
"build": "babel src -d lib --delete-dir-on-start && cpy types/*.d.ts lib",
1212
"format": "eslint --fix . && npm run prettier -- --write",
1313
"lint": "eslint . && npm run prettier -- -l",
1414
"prepublish": "npm run build",
@@ -53,6 +53,10 @@
5353
],
5454
"setupFiles": [
5555
"<rootDir>/test/setup.js"
56+
],
57+
"testPathIgnorePatterns": [
58+
"/node_modules/",
59+
"<rootDir>/types/"
5660
]
5761
},
5862
"repository": {
@@ -72,8 +76,8 @@
7276
},
7377
"homepage": "https://github.com/4Catalyzer/found#readme",
7478
"dependencies": {
75-
"babel-runtime": "^6.26.0",
76-
"farce": "^0.2.7",
79+
"@babel/runtime-corejs2": "^7.4.0",
80+
"farce": "^0.2.8",
7781
"is-promise": "^2.1.0",
7882
"lodash": "^4.17.11",
7983
"path-to-regexp": "^1.7.0",
@@ -87,18 +91,14 @@
8791
"react": ">=16.4.0"
8892
},
8993
"devDependencies": {
94+
"@4c/babel-preset": "^5.0.4",
95+
"@babel/cli": "^7.2.3",
96+
"@babel/core": "^7.4.0",
9097
"@types/react": "^16.8.8",
9198
"@types/react-dom": "^16.8.2",
92-
"babel-cli": "^6.26.0",
93-
"babel-core": "^6.26.3",
9499
"babel-eslint": "^10.0.1",
95-
"babel-jest": "^23.6.0",
100+
"babel-jest": "^24.5.0",
96101
"babel-plugin-add-module-exports": "^1.0.0",
97-
"babel-plugin-dev-expression": "^0.2.1",
98-
"babel-plugin-transform-runtime": "^6.23.0",
99-
"babel-preset-env": "^1.7.0",
100-
"babel-preset-react": "^6.24.1",
101-
"babel-preset-stage-1": "^6.24.1",
102102
"codecov": "^3.2.0",
103103
"cpy-cli": "^2.0.0",
104104
"delay": "^4.1.0",
@@ -107,16 +107,16 @@
107107
"enzyme": "^3.9.0",
108108
"enzyme-adapter-react-16": "^1.11.2",
109109
"eslint": "^5.15.3",
110-
"eslint-config-4catalyzer-jest": "^1.2.0",
111-
"eslint-config-4catalyzer-react": "^0.9.2",
110+
"eslint-config-4catalyzer-jest": "^1.2.1",
111+
"eslint-config-4catalyzer-react": "^0.9.3",
112112
"eslint-config-prettier": "^4.1.0",
113113
"eslint-plugin-import": "^2.16.0",
114114
"eslint-plugin-jest": "^22.4.1",
115115
"eslint-plugin-jsx-a11y": "^6.2.1",
116116
"eslint-plugin-prettier": "^3.0.1",
117117
"eslint-plugin-react": "^7.12.4",
118118
"husky": "^1.3.1",
119-
"jest": "^23.6.0",
119+
"jest": "^24.5.0",
120120
"lint-staged": "^8.1.5",
121121
"p-defer": "^2.0.0",
122122
"prettier": "^1.16.4",
@@ -126,6 +126,6 @@
126126
"react-stand-in": "^4.0.0-beta.14",
127127
"react-test-renderer": "^16.8.4",
128128
"rimraf": "^2.6.3",
129-
"typescript": "^3.3.3333"
129+
"typescript": "^3.3.4000"
130130
}
131131
}

‎src/Matcher.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export default class Matcher {
112112
return null;
113113
}
114114

115-
const params = Object.create(null);
115+
const params = {};
116116
keys.forEach(({ name }, index) => {
117117
const value = match[index + 1];
118118
params[name] = value && decodeURIComponent(value);
@@ -153,7 +153,7 @@ export default class Matcher {
153153
Object.keys(routeMatch.groups).join(', '),
154154
);
155155

156-
const routeIndices = {};
156+
const groupRouteIndices = {};
157157
const routeParams = [];
158158
const params = {};
159159

@@ -163,7 +163,7 @@ export default class Matcher {
163163

164164
// Retain the nested group structure for route indices so we can
165165
// reconstruct the element tree from flattened route elements.
166-
routeIndices[groupName] = groupPayload.routeIndices;
166+
groupRouteIndices[groupName] = groupPayload.routeIndices;
167167

168168
// Flatten route groups for route params matching getRoutesFromIndices
169169
// below.
@@ -174,7 +174,11 @@ export default class Matcher {
174174
},
175175
);
176176

177-
return { routeIndices, routeParams, params };
177+
return {
178+
routeIndices: [groupRouteIndices],
179+
routeParams,
180+
params,
181+
};
178182
}
179183

180184
const { index, params } = routeMatch;

‎src/createBaseRouter.js

-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ export default function createBaseRouter({
118118
const pendingMatch = this.props.match;
119119

120120
try {
121-
// ESLint doesn't handle for-await yet.
122-
// eslint-disable-next-line semi
123121
for await (const renderArgs of resolveRenderArgs(this.props)) {
124122
if (!this.mounted || this.props.match !== pendingMatch) {
125123
return;

‎src/getRenderArgs.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import resolveRenderArgs from './utils/resolveRenderArgs';
33
export default async function getRenderArgs(props) {
44
let elements;
55

6-
// ESLint doesn't handle for-await yet.
7-
// eslint-disable-next-line semi
86
for await (elements of resolveRenderArgs(props)) {
97
// Nothing to do here. We just need the last value from the iterable.
108
}
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.