Skip to content

Commit

Permalink
Upgrade to babel 7
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelJamesParsons authored Jul 14, 2019
1 parent 5b6b79d commit a1b76ec
Show file tree
Hide file tree
Showing 18 changed files with 2,495 additions and 1,438 deletions.
46 changes: 35 additions & 11 deletions titan-web-client/.babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
{
"presets": ["env", "react", "es2015", "stage-2", "./.babelrc.js"],
"plugins": ["transform-async-to-generator"],
"env": {
"test": {
"plugins": [
[ "babel-plugin-webpack-alias", { "config": "./config/webpack.config.dev.js" } ]
]
}
}
}
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-transform-async-to-generator",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions"
],
"env": {
"test": {
"plugins": [
[
"babel-plugin-webpack-alias",
{
"config": "./config/webpack.config.dev.js"
}
]
]
}
}
}
1 change: 0 additions & 1 deletion titan-web-client/.babelrc.js

This file was deleted.

18 changes: 16 additions & 2 deletions titan-web-client/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
"extends": ["semistandard", "semistandard-react", "react-app"],
"rules": {
"jsx-quotes": ["error", "prefer-double"],
"semistandard-react/prop-types": [1, {
"jsx-a11y/href-no-hash": [0],
"href-no-hash": [0],
"camelcase": [0, {
"allow": [
"UNSAFE_componentDidMount",
"UNSAFE_componentWillReceiveProps",
"UNSAFE_componentWillUpdate"
]
}],
"semistandard-react/prop-types": [0, {
"ignore": [
"children",
"enqueueSnackbar",
Expand All @@ -20,5 +29,10 @@
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2017
},
"settings": {
"react": {
"version": "detect"
}
}
}
}
1 change: 0 additions & 1 deletion titan-web-client/babelrc.js

This file was deleted.

1 change: 0 additions & 1 deletion titan-web-client/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ module.exports = {
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {

// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
Expand Down
68 changes: 38 additions & 30 deletions titan-web-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/plugin-transform-async-to-generator": "^7.0.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/runtime-corejs2": "^7.0.0",
"@date-io/date-fns": "^0.0.2",
"@fortawesome/fontawesome": "^1.1.8",
"@fortawesome/fontawesome-free-regular": "^5.0.13",
Expand All @@ -11,41 +26,37 @@
"@fortawesome/free-solid-svg-icons": "^5.6.1",
"@fortawesome/react-fontawesome": "^0.1.3",
"@material-ui/core": "^4.0.2",
"@material-ui/pickers": "^3.1.0",
"@material-ui/pickers": "^3.1.2",
"autoprefixer": "7.1.6",
"axios": "^0.19.0",
"babel-core": "6.26.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.2",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^9.0.0",
"babel-jest": "^23.4.2",
"babel-loader": "^8.0.0",
"babel-plugin-webpack-alias": "^2.1.2",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-react-app": "^3.1.1",
"babel-preset-stage-2": "^6.24.1",
"babel-runtime": "6.26.0",
"babel-preset-react-app": "^3.1.2",
"babel-runtime": "^6.26.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"color": "^3.0.0",
"css-loader": "0.28.7",
"date-fns": "2.0.0-alpha.31",
"date-fns": "2.0.0-alpha.21",
"deepmerge": "^2.2.1",
"dotenv": "4.0.0",
"dotenv-expand": "4.0.1",
"eslint": "^5.6.0",
"eslint": "^5.16.0",
"eslint-config-react-app": "^2.1.0",
"eslint-config-semistandard": "^13.0.0",
"eslint-config-semistandard": "12.0.1",
"eslint-config-semistandard-react": "^4.2.0",
"eslint-config-standard": "^12.0.0",
"eslint-config-standard": "^13.0.1",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.39.1",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "7.4.0",
"eslint-plugin-flowtype": "3.11.1",
"eslint-plugin-import": "2.18.0",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "7.14.2",
"eslint-plugin-react-hooks": "^1.6.1",
"eslint-plugin-semistandard-react": "^4.1.0",
"eslint-plugin-standard": "^4.0.0",
"extract-text-webpack-plugin": "3.0.2",
Expand Down Expand Up @@ -87,11 +98,13 @@
"scripts": {
"start": "babel-node scripts/start.js",
"build": "babel-node scripts/build.js",
"test": "mocha --compilers babel-core/register ./src/**/*.test.js"
"test": "mocha --require @babel/register ./src/**/*.test.js"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.7.0",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/node": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"mocha": "^5.2.0",
"sinon": "^7.1.1",
"standard": "^12.0.1"
Expand Down Expand Up @@ -130,10 +143,5 @@
"node"
]
},
"babel": {
"presets": [
"react-app"
]
},
"proxy": "http://0.0.0.0:8000"
}
6 changes: 3 additions & 3 deletions titan-web-client/src/boot/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const mountRoutes = (routesMap, routes) => {
routes.forEach((route) => {
const routeKey = makeRouteKey(route.path);

if (routesMap.hasOwnProperty(routeKey)) {
if (routesMap[routeKey]) {
throw new Error(`Duplicate route pattern: ${routeKey}.`);
}

Expand All @@ -53,7 +53,7 @@ export const mountRoutes = (routesMap, routes) => {
* @param {object} reducer
*/
export const mountReducer = (reducersMap, name, reducer) => {
if (reducersMap.hasOwnProperty(name)) {
if (reducersMap[name]) {
throw new Error(`Duplicate module name for reducer: ${name}.`);
}

Expand All @@ -66,7 +66,7 @@ export const mountReducer = (reducersMap, name, reducer) => {
* @param moduleConfig
*/
export const mountConfig = (rootConfig, name, moduleConfig) => {
if (rootConfig.hasOwnProperty(name)) {
if (rootConfig[name]) {
throw new Error(`Duplicate module name for config: ${name}.`);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class ChronologicalItemList extends React.Component {
}

render () {
let list = [];
const list = [];
let prevDate = null;

for (let x = 0; x < this.props.items.length; x++) {
Expand Down
2 changes: 1 addition & 1 deletion titan-web-client/src/components/core/TitanApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TitanApp extends React.Component {
}

renderRoutes (routes) {
let routeComponents = [];
const routeComponents = [];

Object.keys(routes).forEach((key) => {
const RouteComponent = TitanApp.getRouteComponent(routes[key]);
Expand Down
2 changes: 1 addition & 1 deletion titan-web-client/src/http/AuthenticatedService.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AuthenticatedService {
}

authHeadersInterceptor (config) {
let state = this.appContext.getStore().getState();
const state = this.appContext.getStore().getState();

if (_.isEmpty(state.auth.session.token)) {
this.appContext.getStore().dispatch(authActions.logout());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';

export const SidebarContentGroupWrapper = styled.div`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';

export const SidebarHeadingWrapper = styled.div`
Expand Down
4 changes: 2 additions & 2 deletions titan-web-client/src/lib/acl.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class Acl {
hasAclPermissions (expectedAclOptions, mustHaveAllOptions) {
if (mustHaveAllOptions) {
return expectedAclOptions.every((optionKey) =>
this.authUserAclOptions.hasOwnProperty(optionKey));
this.authUserAclOptions[optionKey]);
}

return expectedAclOptions.some((optionKey) =>
this.authUserAclOptions.hasOwnProperty(optionKey));
this.authUserAclOptions[optionKey]);
}
}

Expand Down
4 changes: 2 additions & 2 deletions titan-web-client/src/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class Config {
const parts = path.split('.');
let value = this.config;

for (let part of parts) {
if (!value.hasOwnProperty(part)) {
for (const part of parts) {
if (!value[part]) {
return null;
}

Expand Down
1 change: 1 addition & 0 deletions titan-web-client/src/lib/matPickerDateUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class MatPickerDateUtils extends DateFnsUtils {
startOfMonth (date) {
return this.getStartOfMonth(date);
}

getDatePickerHeaderText (date) {
return formatDate(date, 'd MMMM', { locale: this.locale });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class OrganizationChainOfCommand extends React.Component {
};
}

componentWillMount () {
UNSAFE_componentWillMount () {
this.loadOrganizationCoC(this.props.organizationId);
}

Expand Down
12 changes: 6 additions & 6 deletions titan-web-client/src/themes/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,35 +56,35 @@ export default {
}
},
MuiPaper: {
'elevation1': {
elevation1: {
boxShadow: `0px 1px 3px 0px rgba(0, 0, 0, 0.06),
0px 1px 1px 0px rgba(0, 0, 0, 0.08),
0px 2px 1px -1px rgba(0, 0, 0, 0.06)`
},
'elevation2': {
elevation2: {
boxShadow: `0px 1px 5px 0px rgba(0, 0, 0, 0.06),
0px 2px 2px 0px rgba(0, 0, 0, 0.08),
0px 3px 1px -2px rgba(0, 0, 0, 0.06)`
},
'elevation3': {
elevation3: {
boxShadow: `0px 1px 8px 0px rgba(0, 0, 0, 0.06),
0px 3px 4px 0px rgba(0, 0, 0, 0.08),
0px 3px 3px -2px rgba(0, 0, 0, 0.06)
`
},
'elevation4': {
elevation4: {
boxShadow: `0px 2px 20px -1px rgba(0, 0, 0, 0.06),
0px 4px 5px 0px rgba(0, 0, 0, 0.08),
0px 1px 10px 0px rgba(0, 0, 0, 0.06)
`
},
'elevation5': {
elevation5: {
boxShadow: `0px 3px 5px -1px rgba(0, 0, 0, 0.06),
0px 5px 8px 0px rgba(0, 0, 0, 0.08),
0px 1px 14px 0px rgba(0, 0, 0, 0.06)
`
},
'elevation6': {
elevation6: {
boxShadow: `0px 3px 5px -1px rgba(0, 0, 0, 0.06),
0px 6px 10px 0px rgba(0, 0, 0, 0.08),
0px 1px 18px 0px rgba(0, 0, 0, 0.06)
Expand Down
Loading

0 comments on commit a1b76ec

Please sign in to comment.