Skip to content

Commit

Permalink
[#1869] Create widgets alias in Webpack, update .flowconfig, and alia…
Browse files Browse the repository at this point in the history
…s cleanup
  • Loading branch information
julianguyen committed Oct 3, 2020
1 parent 5c16649 commit 647d563
Show file tree
Hide file tree
Showing 110 changed files with 170 additions and 161 deletions.
5 changes: 5 additions & 0 deletions client/.flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
[options]

module.name_mapper='^libs\(.*\)$' -> '<PROJECT_ROOT>/app/libs\1'
module.name_mapper='^styles\(.*\)$' -> '<PROJECT_ROOT>/app/styles\1'
module.name_mapper='^components\(.*\)$' -> '<PROJECT_ROOT>/app/components\1'
module.name_mapper='^utils\(.*\)$' -> '<PROJECT_ROOT>/app/utils\1'
module.name_mapper='^mocks\(.*\)$' -> '<PROJECT_ROOT>/app/mocks\1'
module.name_mapper='^widgets\(.*\)$' -> '<PROJECT_ROOT>/app/widgets\1'

module.name_mapper='.*\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)' -> '<PROJECT_ROOT>/flow/media.js'
module.name_mapper='.*\.\(css\|sass\|scss\)' -> '<PROJECT_ROOT>/flow/stylesheets.js'
Expand Down
2 changes: 1 addition & 1 deletion client/.storybook/stories.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../app/styles/global.scss";
@import "~styles/global.scss";

/* This file is to override Storybook default styles */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import React from 'react';
import { render, fireEvent } from '@testing-library/react';
import { Accordion } from '../index';
import { Accordion } from 'components/Accordion';

const id = 'some-id';
const title = 'Accordions have pianos';
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Accordion/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import renderHTML from 'react-render-html';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faCaretDown, faCaretUp } from '@fortawesome/free-solid-svg-icons';
import globalCss from 'styles/_global.scss';
import css from '../Input/Input.scss';
import css from 'components/Input/Input.scss';

export type Props = {
id: string,
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Avatar/Avatar.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../styles/_global.scss";
@import "~styles/_global.scss";

.avatar {
@include setFontSize($size-20);
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Avatar/__tests__/Avatar.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import React from 'react';
import { render, screen } from '@testing-library/react';
import { Avatar } from '../index';
import { Avatar } from 'components/Avatar';

const name = 'Julia Nguyen';
const src = '/some-img-url';
Expand Down
4 changes: 2 additions & 2 deletions client/app/components/BaseContainer/StoryContainer.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import React from 'react';
import { Story } from '../Story';
import type { Props as StoryProps } from '../Story';
import { Story } from 'components/Story';
import type { Props as StoryProps } from 'components/Story';

export type Props = {
data: StoryProps[],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import React from 'react';
import { render } from '@testing-library/react';
import { StoryContainer } from '../StoryContainer';
import { StoryContainer } from 'components/BaseContainer/StoryContainer';

describe('StoryContainer', () => {
it('renders correctly', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React from 'react';
import axios from 'axios';
import { render, fireEvent } from '@testing-library/react';
import BaseContainer from '../index';
import BaseContainer from 'components/BaseContainer';

const response = {
data: {
Expand Down
4 changes: 2 additions & 2 deletions client/app/components/BaseContainer/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @flow
import React, { useState } from 'react';
import axios from 'axios';
import { StoryContainer } from './StoryContainer';
import { LoadMoreButton } from '../LoadMoreButton';
import { Utils } from 'utils';
import { StoryContainer } from 'components/BaseContainer/StoryContainer';
import { LoadMoreButton } from 'components/LoadMoreButton';

export type Props = {
container: string,
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Blockquote/Blockquote.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../styles/_global.scss";
@import "~styles/_global.scss";

.text {
@include setFontSize($size-24);
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Chart/ChartControl.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow
import React, { useState } from 'react';
import { I18n } from 'libs/i18n';
import { Chart } from './index';
import globalCss from 'styles/_global.scss';
import { Chart } from 'components/Chart';
import css from './ChartControl.scss';

type chartControlProps = {
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Chart/ChartControl.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../styles/_global.scss";
@import "~styles/_global.scss";

.chartControl {
> div:first-of-type {
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Chart/__tests__/Chart.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import { shallow } from 'enzyme';
import React from 'react';
import { Chart } from '../index';
import { Chart } from 'components/Chart';

function getComponent(options) {
return shallow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
import { shallow } from 'enzyme';
import React from 'react';
import { ChartControl } from '../ChartControl';
import { ChartControl } from 'components/Chart/ChartControl';

describe('ChartControl', () => {
it('renders', () => {
Expand Down
4 changes: 2 additions & 2 deletions client/app/components/Form/DynamicForm.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow
import React, { useState } from 'react';
import axios from 'axios';
import Input from '../Input';
import { TYPES as INPUT_TYPES } from '../Input/utils';
import Input from 'components/Input';
import { TYPES as INPUT_TYPES } from 'components/Input/utils';
import css from './Form.scss';
import { getNewInputs } from './utils';
import type { Errors, MyInputProps, FormProps } from './utils';
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Form/Form.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../styles/_global.scss";
@import "~styles/_global.scss";

.form {
> div {
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Form/__tests__/DynamicForm.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { mount } from 'enzyme';
import React from 'react';
import { act } from 'react-dom/test-utils';
import DynamicForm from '../DynamicForm';
import { InputMocks } from 'mocks/InputMocks';
import DynamicForm from 'components/Form/DynamicForm';

// TODO (julianguyen): Include InputTextarea after writing stubs for pell editor

Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Form/__tests__/Form.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { mount } from 'enzyme';
import React from 'react';
import { act } from 'react-dom/test-utils';
import Form from '../index';
import { InputMocks } from 'mocks/InputMocks';
import Form from 'components/Form';

// TODO (julianguyen): Include InputTextarea after writing stubs for pell editor

Expand Down
8 changes: 4 additions & 4 deletions client/app/components/Form/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @flow
import React, { useState, type Node } from 'react';
import Input from '../Input';
import { TYPES as INPUT_TYPES } from '../Input/utils';
import { QuickCreate } from '../../widgets/QuickCreate';
import type { Props as QuickCreateProps } from '../../widgets/QuickCreate';
import Input from 'components/Input';
import { TYPES as INPUT_TYPES } from 'components/Input/utils';
import { QuickCreate } from 'widgets/QuickCreate';
import type { Props as QuickCreateProps } from 'widgets/QuickCreate';
import css from './Form.scss';
import { getNewInputs } from './utils';
import type { Errors, MyInputProps, FormProps as Props } from './utils';
Expand Down
4 changes: 2 additions & 2 deletions client/app/components/Form/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import { REQUIRES_DEFAULT } from '../Input/InputDefault';
import { Utils } from 'utils';
import type { Props as InputProps } from '../Input/utils';
import { REQUIRES_DEFAULT } from 'components/Input/InputDefault';
import type { Props as InputProps } from 'components/Input/utils';

type KeyProps = { myKey?: string };

Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Header/Header.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../styles/_global.scss";
@import "~styles/_global.scss";

@mixin linkStyle() {
a {
Expand Down
8 changes: 4 additions & 4 deletions client/app/components/Header/HeaderProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import React from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faBell } from '@fortawesome/free-solid-svg-icons';
import type { Profile } from './types';
import { Notifications } from '../../widgets/Notifications';
import { Utils } from 'utils';
import { Avatar } from '../Avatar';
import css from './HeaderProfile.scss';
import globalCSS from 'styles/_global.scss';
import { Notifications } from 'widgets/Notifications';
import { Avatar } from 'components/Avatar';
import type { Profile } from './types';
import css from './HeaderProfile.scss';

export type Props = {
profile: Profile,
Expand Down
8 changes: 4 additions & 4 deletions client/app/components/Header/HeaderProfile.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import "../../styles/_global.scss";
@import "~styles/_global.scss";

.header {
z-index: $z-index-front;

> div {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -41,5 +41,5 @@
text-align: center;
justify-content: center;
}
}
}
}
}
2 changes: 1 addition & 1 deletion client/app/components/Header/__tests__/Header.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import { mount } from 'enzyme';
import React from 'react';
import Header from '../index';
import Header from 'components/Header';

const getComponent = () => (
<Header
Expand Down
4 changes: 2 additions & 2 deletions client/app/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faBars, faTimes } from '@fortawesome/free-solid-svg-icons';
import ReactHtmlParser from 'react-html-parser';
import { I18n } from 'libs/i18n';
import { Logo } from '../Logo';
import { HeaderProfile } from './HeaderProfile';
import { Logo } from 'components/Logo';
import { HeaderProfile } from 'components/Header/HeaderProfile';
import type { Profile, Link } from './types';
import css from './Header.scss';

Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Input/Input.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../styles/_global.scss";
@import "~styles/_global.scss";

@mixin paddingForSelectIcon($padding) {
padding-right: $padding * 2 + $size-12;
Expand Down
4 changes: 2 additions & 2 deletions client/app/components/Input/InputCheckbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import React from 'react';
import renderHTML from 'react-render-html';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faQuestion } from '@fortawesome/free-solid-svg-icons';
import css from './Input.scss';
import globalCss from 'styles/_global.scss';
import { Tooltip } from 'components/Tooltip';
import css from './Input.scss';
import type { Checkbox as Props } from './utils';
import { Tooltip } from '../Tooltip';

const displayUnchecked = (name: ?string, uncheckedValue: ?any) => (
<input name={name} type="hidden" value={uncheckedValue} />
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Input/InputCheckboxGroup.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import React, { useState } from 'react';
import { InputCheckbox } from 'components/Input/InputCheckbox';
import type { Checkbox } from './utils';
import { InputCheckbox } from './InputCheckbox';

export type Props = {
checkboxes: Checkbox[],
Expand Down
4 changes: 2 additions & 2 deletions client/app/components/Input/InputLabel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import React from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faAsterisk, faQuestion } from '@fortawesome/free-solid-svg-icons';
import { Tooltip } from '../Tooltip';
import css from './Input.scss';
import globalCss from 'styles/_global.scss';
import { Tooltip } from 'components/Tooltip';
import css from './Input.scss';

export type Props = {
label: string,
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Input/InputPassword.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useState } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
import { I18n } from 'libs/i18n';
import css from './InputPassword.scss';
import css from 'components/Input/InputPassword.scss';
import inputCss from './Input.scss';

export type Props = {
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Input/InputPassword.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../styles/_global.scss";
@import "~styles/_global.scss";

.password {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Input/InputRadioGroup.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../styles/_global.scss";
@import "~styles/_global.scss";

.wrapper {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Input/InputSwitch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faCheck, faTimes } from '@fortawesome/free-solid-svg-icons';
import { I18n } from 'libs/i18n';
import { Utils } from 'utils';
import { InputCheckbox } from 'components/Input/InputCheckbox';
import css from './InputSwitch.scss';
import { InputCheckbox } from './InputCheckbox';

export type Props = {
id: string,
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Input/InputSwitch.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../styles/_global.scss";
@import "~styles/_global.scss";

.switch {
@include setFontSize($size-16);
Expand Down
4 changes: 2 additions & 2 deletions client/app/components/Input/InputTag.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @flow
import React, { useState } from 'react';
import Autosuggest from 'react-autosuggest';
import type { Checkbox } from './utils';
import { Utils } from 'utils';
import { InputCheckbox } from './InputCheckbox';
import { InputCheckbox } from 'components/Input/InputCheckbox';
import type { Checkbox } from './utils';
import inputCss from './Input.scss';
import css from './InputTag.scss';

Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Input/InputTag.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../styles/_global.scss";
@import "~styles/_global.scss";

.tag {
&Checkboxes {
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Input/InputTextarea.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../styles/_global.scss";
@import "~styles/_global.scss";

.button {
@include setFontSize($size-24);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import { shallow } from 'enzyme';
import React from 'react';
import { InputCheckbox } from '../InputCheckbox';
import { InputCheckbox } from 'components/Input/InputCheckbox';

const id = 'some-id';
const name = 'some-name';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React from 'react';
import { mount } from 'enzyme';
import { act } from 'react-dom/test-utils';
import { InputCheckboxGroup } from '../InputCheckboxGroup';
import { InputCheckboxGroup } from 'components/Input/InputCheckboxGroup';

const id = 'some-id';
const name = 'some-name';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow
import { shallow } from 'enzyme';
import React from 'react';
import { InputDefault } from '../InputDefault';
import { InputMocks } from 'mocks/InputMocks';
import { InputDefault } from 'components/Input/InputDefault';

const { id } = InputMocks.inputTextProps;
const { name } = InputMocks.inputTextProps;
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Input/__tests__/InputError.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import { shallow } from 'enzyme';
import React from 'react';
import { InputError } from '../InputError';
import { InputError } from 'components/Input/InputError';

describe('InputError', () => {
it('renders correctly when error does not exist', () => {
Expand Down
Loading

0 comments on commit 647d563

Please sign in to comment.