Skip to content

Commit

Permalink
chore: Upgrade to Babel 7
Browse files Browse the repository at this point in the history
  • Loading branch information
taion committed Mar 20, 2019
1 parent 49f1c60 commit cb671c5
Show file tree
Hide file tree
Showing 6 changed files with 1,655 additions and 1,847 deletions.
12 changes: 5 additions & 7 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"presets": [
["env", {
"loose": true
}],
"stage-1",
"react"
["@4c", {
"runtime": true,
"corejs": 2,
"targets": {}
}]
],
"plugins": [
"dev-expression",
"transform-runtime", // Need stage-3 Symbol polyfill.
"add-module-exports"
]
}
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "rimraf lib && babel src -d lib && cpy types/*.d.ts lib",
"build": "babel src -d lib --delete-dir-on-start && cpy types/*.d.ts lib",
"format": "eslint --fix . && npm run prettier -- --write",
"lint": "eslint . && npm run prettier -- -l",
"prepublish": "npm run build",
Expand Down Expand Up @@ -53,6 +53,10 @@
],
"setupFiles": [
"<rootDir>/test/setup.js"
],
"testPathIgnorePatterns": [
"/node_modules/",
"<rootDir>/types/"
]
},
"repository": {
Expand All @@ -72,8 +76,8 @@
},
"homepage": "https://github.com/4Catalyzer/found#readme",
"dependencies": {
"babel-runtime": "^6.26.0",
"farce": "^0.2.7",
"@babel/runtime-corejs2": "^7.4.0",
"farce": "^0.2.8",
"is-promise": "^2.1.0",
"lodash": "^4.17.11",
"path-to-regexp": "^1.7.0",
Expand All @@ -87,18 +91,14 @@
"react": ">=16.4.0"
},
"devDependencies": {
"@4c/babel-preset": "^5.0.4",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.4.0",
"@types/react": "^16.8.8",
"@types/react-dom": "^16.8.2",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-jest": "^24.5.0",
"babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-dev-expression": "^0.2.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-1": "^6.24.1",
"codecov": "^3.2.0",
"cpy-cli": "^2.0.0",
"delay": "^4.1.0",
Expand All @@ -107,16 +107,16 @@
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.11.2",
"eslint": "^5.15.3",
"eslint-config-4catalyzer-jest": "^1.2.0",
"eslint-config-4catalyzer-react": "^0.9.2",
"eslint-config-4catalyzer-jest": "^1.2.1",
"eslint-config-4catalyzer-react": "^0.9.3",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jest": "^22.4.1",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "^7.12.4",
"husky": "^1.3.1",
"jest": "^23.6.0",
"jest": "^24.5.0",
"lint-staged": "^8.1.5",
"p-defer": "^2.0.0",
"prettier": "^1.16.4",
Expand All @@ -126,6 +126,6 @@
"react-stand-in": "^4.0.0-beta.14",
"react-test-renderer": "^16.8.4",
"rimraf": "^2.6.3",
"typescript": "^3.3.3333"
"typescript": "^3.3.4000"
}
}
12 changes: 8 additions & 4 deletions src/Matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default class Matcher {
return null;
}

const params = Object.create(null);
const params = {};
keys.forEach(({ name }, index) => {
const value = match[index + 1];
params[name] = value && decodeURIComponent(value);
Expand Down Expand Up @@ -153,7 +153,7 @@ export default class Matcher {
Object.keys(routeMatch.groups).join(', '),
);

const routeIndices = {};
const groupRouteIndices = {};
const routeParams = [];
const params = {};

Expand All @@ -163,7 +163,7 @@ export default class Matcher {

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

// Flatten route groups for route params matching getRoutesFromIndices
// below.
Expand All @@ -174,7 +174,11 @@ export default class Matcher {
},
);

return { routeIndices, routeParams, params };
return {
routeIndices: [groupRouteIndices],
routeParams,
params,
};
}

const { index, params } = routeMatch;
Expand Down
2 changes: 0 additions & 2 deletions src/createBaseRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ export default function createBaseRouter({
const pendingMatch = this.props.match;

try {
// ESLint doesn't handle for-await yet.
// eslint-disable-next-line semi
for await (const renderArgs of resolveRenderArgs(this.props)) {
if (!this.mounted || this.props.match !== pendingMatch) {
return;
Expand Down
2 changes: 0 additions & 2 deletions src/getRenderArgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import resolveRenderArgs from './utils/resolveRenderArgs';
export default async function getRenderArgs(props) {
let elements;

// ESLint doesn't handle for-await yet.
// eslint-disable-next-line semi
for await (elements of resolveRenderArgs(props)) {
// Nothing to do here. We just need the last value from the iterable.
}
Expand Down

0 comments on commit cb671c5

Please sign in to comment.