Skip to content

Commit

Permalink
Refactor deep
Browse files Browse the repository at this point in the history
- Fix breaking tests due to _ts
- Add absolute imports
- Fix edit for links
  • Loading branch information
tnagorra committed May 28, 2018
1 parent b86b922 commit 8bea60e
Show file tree
Hide file tree
Showing 345 changed files with 2,264 additions and 2,201 deletions.
42 changes: 26 additions & 16 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,37 @@
"polyfill": false,
"regenerator": true
}
],
[
"module-resolver",
{
"root": ["."],
"alias": {
"#rs": "./src/vendor/react-store",
"#ravl": "./src/vendor/ravl",

"#components": "./src/components",
"#config": "./src/config",
"#entities": "./src/entities",
"#constants": "./src/constants",
"#redux": "./src/redux",
"#resources": "./src/resources",
"#rest": "./src/rest",
"#schema": "./src/schema",
"#utils": "./src/utils",
"#widgets": "./src/widgets",

"#notify": "./src/notify",
"#store": "./src/store",
"#ts": "./src/ts"
}
}
]
],
"env": {
"test": {
"presets": [
"@babel/preset-env",
"@babel/preset-react",
[
"@babel/preset-stage-2",
{ "decoratorsLegacy": true }
]
],
"plugins": [
"babel-plugin-dynamic-import-node",
[
"@babel/plugin-transform-runtime",
{
"polyfill": false,
"regenerator": true
}
],
"babel-plugin-dynamic-import-node"
]
}
}
Expand Down
10 changes: 8 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@
},
"plugins": [
"react",
"import",
"css-modules"
],
"settings": {
"import/resolver": {
"babel-module": {}
}
},
"rules": {
"strict": 0,
"indent": ["error", 4, { "SwitchCase": 1 }],
Expand Down Expand Up @@ -50,8 +56,8 @@

"react/no-unused-state": "warn",
"react/default-props-match-prop-types": ["warn", {
"allowRequiredDefaults": true
}],
"allowRequiredDefaults": true
}]
},
"parser": "babel-eslint",
"parserOptions": {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"babel-jest": "^22.4.3",
"babel-loader": "^8.0.0-beta.2",
"babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-module-resolver": "^3.1.1",
"babel-preset-env": "^1.6.1",
"circular-dependency-plugin": "^5.0.2",
"clean-webpack-plugin": "^0.1.19",
Expand All @@ -66,6 +67,7 @@
"enzyme-adapter-react-16": "^1.1.1",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-import-resolver-babel-module": "^5.0.0-beta.0",
"eslint-loader": "^2.0.0",
"eslint-plugin-css-modules": "^2.7.5",
"eslint-plugin-import": "^2.11.0",
Expand Down
16 changes: 8 additions & 8 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@ import React from 'react';
import { connect } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';

import { FgRestBuilder } from './vendor/react-store/utils/rest';
import AppLoading from './components/AppLoading';
import { FgRestBuilder } from '#rs/utils/rest';
import AppLoading from '#components/AppLoading';
import {
initializeGa,
setGaUserId,
} from './config/google-analytics';
} from '#config/google-analytics';
import {
createParamsForTokenRefresh,
urlForTokenRefresh,
} from './rest';
} from '#rest';
import {
startSiloBackgroundTasksAction,
stopSiloBackgroundTasksAction,
} from './redux/middlewares/siloBackgroundTasks';
} from '#redux/middlewares/siloBackgroundTasks';
import {
setAccessTokenAction,
logoutAction,
tokenSelector,
activeUserSelector,
readySelector,
} from './redux';
import getUserConfirmation from './utils/getUserConfirmation';
} from '#redux';
import getUserConfirmation from '#utils/getUserConfirmation';

import schema from './schema';
import schema from '#schema';

import Multiplexer from './Multiplexer';

Expand Down
12 changes: 6 additions & 6 deletions src/Multiplexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ import {
} from 'react-router-dom';
import { connect } from 'react-redux';

import ExclusivelyPublicRoute from './vendor/react-store/components/General/ExclusivelyPublicRoute';
import PrivateRoute from './vendor/react-store/components/General/PrivateRoute';
import Toast from './vendor/react-store/components/View/Toast';
import ExclusivelyPublicRoute from '#rs/components/General/ExclusivelyPublicRoute';
import PrivateRoute from '#rs/components/General/PrivateRoute';
import Toast from '#rs/components/View/Toast';

import Navbar from './components/Navbar';
import Navbar from '#components/Navbar';
import {
pathNames,
views,
routesOrder,
routes,
} from './constants';
} from '#constants';

import {
authenticatedSelector,
lastNotifySelector,
notifyHideAction,
} from './redux';
} from '#redux';

const ROUTE = {
exclusivelyPublic: 'exclusively-public',
Expand Down
4 changes: 2 additions & 2 deletions src/Root.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React from 'react';
import { Provider } from 'react-redux';
import { persistStore } from 'redux-persist';

import { startActionsSync } from './vendor/react-store/utils/redux-sync';
import { startActionsSync } from '#rs/utils/redux-sync';

import store from './store';
import store from '#store';

import App from './App';

Expand Down
28 changes: 14 additions & 14 deletions src/components/AddRegion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ import React from 'react';
import { connect } from 'react-redux';
import { Redirect } from 'react-router-dom';

import TextInput from '../../vendor/react-store/components/Input/TextInput';
import Faram, { requiredCondition } from '../../vendor/react-store/components/Input/Faram';
import NonFieldErrors from '../../vendor/react-store/components/Input/NonFieldErrors';
import DangerButton from '../../vendor/react-store/components/Action/Button/DangerButton';
import PrimaryButton from '../../vendor/react-store/components/Action/Button/PrimaryButton';
import LoadingAnimation from '../../vendor/react-store/components/View/LoadingAnimation';
import TextInput from '#rs/components/Input/TextInput';
import Faram, { requiredCondition } from '#rs/components/Input/Faram';
import NonFieldErrors from '#rs/components/Input/NonFieldErrors';
import DangerButton from '#rs/components/Action/Button/DangerButton';
import PrimaryButton from '#rs/components/Action/Button/PrimaryButton';
import LoadingAnimation from '#rs/components/View/LoadingAnimation';

import { FgRestBuilder } from '../../vendor/react-store/utils/rest';
import { reverseRoute } from '../../vendor/react-store/utils/common';
import { FgRestBuilder } from '#rs/utils/rest';
import { reverseRoute } from '#rs/utils/common';

import { pathNames } from '../../constants';
import { pathNames } from '#constants';

import {
alterResponseErrorToFaramError,
createParamsForRegionCreate,
urlForRegionCreate,
} from '../../rest';
} from '#rest';
import {
addNewRegionAction,
} from '../../redux';
import notify from '../../notify';
import schema from '../../schema';
import _ts from '../../ts';
} from '#redux';
import notify from '#notify';
import schema from '#schema';
import _ts from '#ts';

import styles from './styles.scss';

Expand Down
2 changes: 1 addition & 1 deletion src/components/AppError/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import _ts from '../../ts';
import _ts from '#ts';
import styles from './styles.scss';

export default class AppError extends React.PureComponent {
Expand Down
4 changes: 2 additions & 2 deletions src/components/AppLoading/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

import { getRandomFromList } from '../../vendor/react-store/utils/common';
import _ts from '../../ts';
import { getRandomFromList } from '#rs/utils/common';
import _ts from '#ts';

import styles from './styles.scss';

Expand Down
46 changes: 22 additions & 24 deletions src/components/AssistedTagging/index.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
import PropTypes from 'prop-types';
import React from 'react';

import PrimaryButton from '#rs/components/Action/Button/PrimaryButton';
import SuccessButton from '#rs/components/Action/Button/SuccessButton';
import WarningButton from '#rs/components/Action/Button/WarningButton';
import SegmentButton from '#rs/components/Action/SegmentButton';
import MultiSelectInput from '#rs/components/Input/MultiSelectInput';
import FloatingContainer from '#rs/components/View/FloatingContainer';
import ListView from '#rs/components/View/List/ListView';
import { getHexFromString } from '#rs/utils/common';
import { FgRestBuilder } from '#rs/utils/rest';

import { iconNames } from '#constants';
import notify from '#notify';
import {
getHexFromString,
} from '../../vendor/react-store/utils/common';
import { FgRestBuilder } from '../../vendor/react-store/utils/rest';
import PrimaryButton from '../../vendor/react-store/components/Action/Button/PrimaryButton';
import SuccessButton from '../../vendor/react-store/components/Action/Button/SuccessButton';
import WarningButton from '../../vendor/react-store/components/Action/Button/WarningButton';
import SegmentButton from '../../vendor/react-store/components/Action/SegmentButton';
import FloatingContainer from '../../vendor/react-store/components/View/FloatingContainer';
import ListView from '../../vendor/react-store/components/View/List/ListView';
import MultiSelectInput from '../../vendor/react-store/components/Input/MultiSelectInput';

import {
urlForLeadClassify,
urlForNer,
urlForFeedback,
createUrlForCeClassify,
createParamsForLeadClassify,
createParamsForCeClassify,
createParamsForNer,
createParamsForFeedback,
} from '../../rest';
import { iconNames } from '../../constants';
import notify from '../../notify';
import schema from '../../schema';
import SimplifiedLeadPreview from '../SimplifiedLeadPreview';
import _ts from '../../ts';
createParamsForLeadClassify,
createParamsForNer,
createUrlForCeClassify,
urlForFeedback,
urlForLeadClassify,
urlForNer,
} from '#rest';
import schema from '#schema';
import _ts from '#ts';

import SimplifiedLeadPreview from '../SimplifiedLeadPreview';
import styles from './styles.scss';

const propTypes = {
Expand Down
24 changes: 12 additions & 12 deletions src/components/Baksa/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import PropTypes from 'prop-types';
import React from 'react';

import styles from './styles.scss';
import iconNames from '../../vendor/react-store/constants/iconNames';
import DropZone from '../../vendor/react-store/components/Input/DropZone';
import FileInput from '../../vendor/react-store/components/Input/FileInput';
import TextInput from '../../vendor/react-store/components/Input/TextInput';
import NumberInput from '../../vendor/react-store/components/Input/NumberInput';
import PrimaryButton from '../../vendor/react-store/components/Action/Button/PrimaryButton';
import DangerButton from '../../vendor/react-store/components/Action/Button/DangerButton';
import { UploadBuilder } from '../../vendor/react-store/utils/upload';
import { isTruthy, isFalsy } from '../../vendor/react-store/utils/common';
import FaramElement from '../../vendor/react-store/components/Input/Faram/FaramElement';
import DangerButton from '#rs/components/Action/Button/DangerButton';
import PrimaryButton from '#rs/components/Action/Button/PrimaryButton';
import DropZone from '#rs/components/Input/DropZone';
import FaramElement from '#rs/components/Input/Faram/FaramElement';
import FileInput from '#rs/components/Input/FileInput';
import NumberInput from '#rs/components/Input/NumberInput';
import TextInput from '#rs/components/Input/TextInput';
import iconNames from '#rs/constants/iconNames';
import { isTruthy, isFalsy } from '#rs/utils/common';
import { UploadBuilder } from '#rs/utils/upload';

import {
urlForUpload,
createParamsForFileUpload,
transformAndCombineResponseErrors,
} from '../../rest';
} from '#rest';

import styles from './styles.scss';

const propTypes = {
className: PropTypes.string,
Expand Down
5 changes: 2 additions & 3 deletions src/components/Cloak.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
currentUserProjectsSelector,
activeProjectFromStateSelector,
routePathKeySelector,
} from '../redux';
} from '#redux';

const mapStateToProps = state => ({
activeUser: activeUserSelector(state),
Expand Down Expand Up @@ -56,7 +56,7 @@ const defaultProps = {
};

@connect(mapStateToProps, undefined)
export default class Cloak extends React.PureComponent {
export default class Cloak extends React.Component {
static propTypes = propTypes;
static defaultProps = defaultProps;

Expand All @@ -79,7 +79,6 @@ export default class Cloak extends React.PureComponent {
renderOnCloak,
} = this.props;


if (
(requireDevMode && process.env.NODE_ENV !== 'development') ||
(requireProject && userProjects.length <= 0) ||
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import PropTypes from 'prop-types';
import React from 'react';

import { FgRestBuilder } from '../../../../vendor/react-store/utils/rest';
import { FgRestBuilder } from '#rs/utils/rest';

import { iconNames } from '../../../../constants';
import { iconNames } from '#constants';
import {
createUrlForWebsiteFetch,
createParamsForGet,
} from '../../../../rest';
import _ts from '../../../../ts';
} from '#rest';
import _ts from '#ts';

import GalleryViewer from '../GalleryViewer';
import styles from './styles.scss';
Expand Down
4 changes: 2 additions & 2 deletions src/components/DeepGallery/components/GalleryDocs/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import PropTypes from 'prop-types';
import React from 'react';

import { createUrlForGoogleViewer } from '../../../../rest/external';
import { createUrlForGoogleViewer } from '#rest/external';
import styles from './styles.scss';

export { galleryDocsMimeType as supportedMimeType } from '../../../../config/deepMimeTypes';
export { galleryDocsMimeType as supportedMimeType } from '#config/deepMimeTypes';

const propTypes = {
className: PropTypes.string,
Expand Down
Loading

0 comments on commit 8bea60e

Please sign in to comment.