Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: import Alias (use absolute import) #1161

Merged
merged 3 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ module.exports = {
config: {
resolve: {
alias: {
actions: path.resolve('./src/actions'),
apis: path.resolve('./src/apis'),
common: path.resolve('./src/components/common'),
utils: path.resolve('./src/utils'),
constants: path.resolve('./src/constants'),
contexts: path.resolve('./src/contexts'),
graphql: path.resolve('./src/graphql'),
hooks: path.resolve('./src/hooks'),
contexts: path.resolve('./src/contexts'),
constants: path.resolve('./src/constants'),
actions: path.resolve('./src/actions'),
selectors: path.resolve('./src/selectors'),
utils: path.resolve('./src/utils'),
},
},
},
Expand Down
11 changes: 6 additions & 5 deletions jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"compilerOptions": {
"baseUrl": "./",
"paths": {
"actions/*": ["src/actions/*"],
"apis/*": ["src/apis/*"],
"common/*": ["src/components/common/*"],
"utils/*": ["src/utils/*"],
"constants/*": ["src/constants/*"],
"contexts/*": ["src/contexts/*"],
"graphql/*": ["src/graphql/*"],
"hooks/*": ["src/hooks/*"],
"contexts/*": ["src/contexts/*"],
"constants/*": ["src/constants/*"],
"actions/*": ["src/actions/*"],
"selectors/*": ["src/selectors/*"]
"selectors/*": ["src/selectors/*"],
"utils/*": ["src/utils/*"]
}
},
"exclude": ["node_modules", "dist"]
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
},
"jest": {
"moduleNameMapper": {
"^actions(.*)": "<rootDir>/src/actions$1",
"^apis(.*)": "<rootDir>/src/apis$1",
"^common(.*)": "<rootDir>/src/components/common$1",
"^utils(.*)": "<rootDir>/src/utils$1",
"^constants(.*)": "<rootDir>/src/constants$1",
"^contexts(.*)": "<rootDir>/src/contexts$1",
"^graphql(.*)": "<rootDir>/src/graphql$1",
"^hooks(.*)": "<rootDir>/src/hooks$1",
"^contexts(.*)": "<rootDir>/src/contexts$1",
"^constants(.*)": "<rootDir>/src/constants$1",
"^actions(.*)": "<rootDir>/src/actions$1",
"^selectors(.*)": "<rootDir>/src/selectors$1"
"^selectors(.*)": "<rootDir>/src/selectors$1",
"^utils(.*)": "<rootDir>/src/utils$1"
}
},
"devDependencies": {
Expand Down
9 changes: 3 additions & 6 deletions src/components/App/Header/Top/EmailVerificationTop.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ import { connect } from 'react-redux';
import cls from 'classnames';

import { Wrapper } from 'common/base';
import Modal from 'common/Modal';

import { getUserName, getUserEmail } from 'selectors/authSelector';
import { sendVerifyEmail } from 'actions/emailVerify';
import topStyles from './Top.module.css';
import styles from './EmailVerificationTop.module.css';

import Modal from '../../../common/Modal';
import VerifyEmailForm from '../../../EmailVerification/VerifyEmailForm';

import { getUserName, getUserEmail } from '../../../../selectors/authSelector';

import { sendVerifyEmail } from '../../../../actions/emailVerify';

const EmailVerificationTop = ({
isSentVerificationEmail,
userName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ import AboutThisJobModal from '../../TimeAndSalary/common/AboutThisJobModal';
import timeAndSalaryBoardStyles from '../../TimeAndSalary/TimeAndSalaryBoard/TimeAndSalaryBoard.module.css';
import timeAndSalaryBannerStyles from '../../TimeAndSalary/Banner.module.css';
import timeAndSalaryCommonStyles from '../../TimeAndSalary/views/view.module.css';
import fetchingStatus, { isFetched } from '../../../constants/status';
import { MAX_ROWS_IF_HIDDEN } from '../../../constants/hideContent';
import fetchingStatus, { isFetched } from 'constants/status';
import { MAX_ROWS_IF_HIDDEN } from 'constants/hideContent';
import { BasicPermissionBlock } from 'common/PermissionBlock';
import styles from '../CampaignTimeAndSalary.module.css';

import { queryCampaignInfoList } from '../../../actions/campaignInfo';
import { queryCampaignTimeAndSalary } from '../../../actions/campaignTimeAndSalaryBoard';
import GradientMask from '../../common/GradientMask';
import { queryCampaignInfoList } from 'actions/campaignInfo';
import { queryCampaignTimeAndSalary } from 'actions/campaignTimeAndSalaryBoard';
import GradientMask from 'common/GradientMask';

import DashBoardTable from '../../TimeAndSalary/common/DashBoardTable';
import { campaignEntriesSelector } from '../../../selectors/campaignSelector';
import { campaignEntriesSelector } from 'selectors/campaignSelector';

import {
pathSelector,
Expand Down
4 changes: 2 additions & 2 deletions src/components/CampaignTimeAndSalary/NotFound.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import CommonNotFound from 'common/NotFound';
import Redirect from 'common/routing/Redirect';
import { queryCampaignInfoList } from '../../actions/campaignInfo';
import { isFetched } from '../../constants/status';
import { queryCampaignInfoList } from 'actions/campaignInfo';
import { isFetched } from 'constants/status';

class NotFound extends Component {
static fetchData({ store: { dispatch } }) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/CampaignTimeAndSalary/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import InfoSalaryModal from '../TimeAndSalary/common/InfoSalaryModal';
import withModal from '../TimeAndSalary/common/withModal';
import styles from './CampaignTimeAndSalary.module.css';

import { queryCampaignInfoList } from '../../actions/campaignInfo';
import { queryCampaignInfoList } from 'actions/campaignInfo';

const campaignListFromEntries = campaignEntries =>
campaignEntries
Expand Down
6 changes: 3 additions & 3 deletions src/components/Company/CompanyIndexProvider.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import CompanyAndJobTitleIndexPage from '../CompanyAndJobTitle/IndexPage';
import { pageType } from '../../constants/companyJobTitle';
import { fetchCompanyNames } from '../../actions/company';
import { pageType } from 'constants/companyJobTitle';
import { fetchCompanyNames } from 'actions/company';
import {
companyNames as companyNamesSelector,
companyNamesStatus as companyNamesStatusSelector,
} from '../../selectors/companyAndJobTitle';
} from 'selectors/companyAndJobTitle';

const CompanyIndexProvider = () => {
const status = useSelector(companyNamesStatusSelector);
Expand Down
6 changes: 3 additions & 3 deletions src/components/Company/CompanyPageProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import Overview from '../CompanyAndJobTitle/Overview';
import InterviewExperiences from '../CompanyAndJobTitle/InterviewExperiences';
import WorkExperiences from '../CompanyAndJobTitle/WorkExperiences';
import CompanyJobTitleTimeAndSalary from '../CompanyAndJobTitle/TimeAndSalary';
import NotFound from '../common/NotFound';
import NotFound from 'common/NotFound';
import { withPermission } from 'common/permission-context';

import { tabType, pageType } from '../../constants/companyJobTitle';
import companyActions from '../../actions/company';
import { tabType, pageType } from 'constants/companyJobTitle';
import companyActions from 'actions/company';
import {
interviewExperiences,
workExperiences,
Expand Down
2 changes: 1 addition & 1 deletion src/components/CompanyAndJobTitle/TimeAndSalary/ViewLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

import { viewSalaryWorkTimes } from '../../../actions/viewLog';
import { viewSalaryWorkTimes } from 'actions/viewLog';

class ViewLog extends Component {
componentDidMount() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/EmailVerification/VerificationPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import GjLogo from 'common/icons/GjLogo.svg';
import Heading from 'common/base/Heading';
import P from 'common/base/P';

import { verifyEmail } from '../../actions/emailVerify';
import { verifyEmail } from 'actions/emailVerify';

import VerificationSuccess from './VerificationSuccess';
import VerificationFailure from './VerificationFailure';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ExperienceDetail/hooks/useTrace.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect, useCallback } from 'react';
import { useDispatch } from 'react-redux';
import ReactPixel from 'react-facebook-pixel';
import PIXEL_CONTENT_CATEGORY from '../../../constants/pixelConstants';
import { viewExperiences as viewExperiencesAction } from '../../../actions/viewLog';
import { viewExperiences as viewExperiencesAction } from 'actions/viewLog';

const useView = experienceId => {
const dispatch = useDispatch();
Expand Down
12 changes: 6 additions & 6 deletions src/components/ExperienceSearch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import Pagination from 'common/Pagination';
import { pathnameSelector, querySelector } from 'common/routing/selectors';
import getScale from 'utils/numberUtils';
import { formatTitle, formatCanonicalPath } from 'utils/helmetHelper';
import { fetchExperiences as fetchExperiencesAction } from '../../actions/experienceSearch';
import { IMG_HOST, SITE_NAME } from '../../constants/helmetData';
import PIXEL_CONTENT_CATEGORY from '../../constants/pixelConstants';
import { PAGE_COUNT } from '../../constants/experienceSearch';
import status from '../../constants/status';
import { GA_CATEGORY, GA_ACTION } from '../../constants/gaConstants';
import { fetchExperiences as fetchExperiencesAction } from 'actions/experienceSearch';
import { IMG_HOST, SITE_NAME } from 'constants/helmetData';
import PIXEL_CONTENT_CATEGORY from 'constants/pixelConstants';
import { PAGE_COUNT } from 'constants/experienceSearch';
import status from 'constants/status';
import { GA_CATEGORY, GA_ACTION } from 'constants/gaConstants';
import styles from './ExperienceSearch.module.css';
import Searchbar from './Searchbar';
import ExperienceBlock from './ExperienceBlock';
Expand Down
4 changes: 2 additions & 2 deletions src/components/JobTitle/JobTitleIndexProvider.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import CompanyAndJobTitleIndexPage from '../CompanyAndJobTitle/IndexPage';
import { pageType } from '../../constants/companyJobTitle';
import { fetchJobTitles } from '../../actions/jobTitle';
import { pageType } from 'constants/companyJobTitle';
import { fetchJobTitles } from 'actions/jobTitle';
import {
jobTitlesStatus as jobTitlesStatusSelector,
jobTitles as jobTitlesSelector,
Expand Down
8 changes: 4 additions & 4 deletions src/components/JobTitle/JobTitlePageProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import Overview from '../CompanyAndJobTitle/Overview';
import InterviewExperiences from '../CompanyAndJobTitle/InterviewExperiences';
import WorkExperiences from '../CompanyAndJobTitle/WorkExperiences';
import CompanyJobTitleTimeAndSalary from '../CompanyAndJobTitle/TimeAndSalary';
import NotFound from '../common/NotFound';
import NotFound from 'common/NotFound';
import { withPermission } from 'common/permission-context';

import { tabType, pageType } from '../../constants/companyJobTitle';
import jobTitleActions from '../../actions/jobTitle';
import { tabType, pageType } from 'constants/companyJobTitle';
import jobTitleActions from 'actions/jobTitle';
import {
interviewExperiences,
workExperiences,
Expand All @@ -25,7 +25,7 @@ import {
overtimeFrequencyCount,
status,
jobTitle as jobTitleSelector,
} from '../../selectors/companyAndJobTitle';
} from 'selectors/companyAndJobTitle';
import { paramsSelector } from 'common/routing/selectors';
import withRouteParameter from '../ExperienceSearch/withRouteParameter';

Expand Down
4 changes: 2 additions & 2 deletions src/components/LaborRightsMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import Columns from 'common/Columns';
import { Section, Wrapper, Heading } from 'common/base';
import FanPageBlock from 'common/FanPageBlock';
import { useShareLink } from 'hooks/experiments';
import { queryMenu } from '../../actions/laborRights';
import { isFetching, isError, isFetched } from '../../constants/status';
import { queryMenu } from 'actions/laborRights';
import { isFetching, isError, isFetched } from 'constants/status';
import LaborRightsEntry from './LaborRightsEntry';
import StaticHelmet from 'common/StaticHelmet';
import styles from './LaborRightsEntry.module.css';
Expand Down
2 changes: 1 addition & 1 deletion src/components/LaborRightsSingle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
queryEntry,
queryMenuIfUnfetched,
queryEntryIfUnfetched,
} from '../../actions/laborRights';
} from 'actions/laborRights';
import useEntry, { useNeighborEntry } from './useEntry';
import useTracking from './useTracking';
import Body from './Body';
Expand Down
4 changes: 2 additions & 2 deletions src/components/LandingPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { compose, setStatic, lifecycle } from 'recompose';
import { Section, Wrapper, Heading } from 'common/base';
import Columns from 'common/Columns';
import ExperienceBlock from '../ExperienceSearch/ExperienceBlock';
import { queryPopularExperiences } from '../../actions/popularExperiences';
import { queryMenu } from '../../actions/laborRights';
import { queryPopularExperiences } from 'actions/popularExperiences';
import { queryMenu } from 'actions/laborRights';
import LaborRightsEntry from '../LaborRightsMenu/LaborRightsEntry';
import Banner from './Banner';
import StaticHelmet from 'common/StaticHelmet';
Expand Down
2 changes: 1 addition & 1 deletion src/components/PlanPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { isUnfetched, isFetched } from 'utils/fetchBox';
import Loading from 'common/Loader';
import { subscriptionType } from 'constants/subscription';

import { fetchSubscriptionPlans } from '../../actions/payment';
import { fetchSubscriptionPlans } from 'actions/payment';
import styles from './PlanPage.module.css';
import CardSection from './CardSection';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import NotFound from 'common/NotFound';
import IconHeadingBlock from 'common/IconHeadingBlock';
import TextInput from 'common/form/TextInput';
import TextArea from 'common/form/TextArea';
import fetchingStatus from '../../../constants/status';
import fetchingStatus from 'constants/status';
import BasicInfo from '../TimeSalaryForm/BasicInfo';
import SalaryInfo from '../TimeSalaryForm/SalaryInfo';
import TimeInfo from '../TimeSalaryForm/TimeInfo';
import InputTitle from '../common/InputTitle';
import SubmitArea from '../../../containers/ShareExperience/SubmitAreaContainer';
import MarkdownParser from '../../LaborRightsSingle/MarkdownParser';
import { queryCampaignInfoList } from '../../../actions/campaignInfo';
import { queryCampaignInfoList } from 'actions/campaignInfo';

import timeAndSalaryFormStyles from '../TimeSalaryForm/TimeSalaryForm.module.css';
import styles from '../CampaignTimeAndSalaryForm/CampaignTimeAndSalaryForm.module.css';
Expand Down
14 changes: 7 additions & 7 deletions src/components/ShareExperience/InterviewForm/TypeForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ import FormBuilder from 'common/FormBuilder';
import ConfirmModal from 'common/FormBuilder/Modals/ConfirmModal';
import Header, { CompanyJobTitleHeader } from '../../common/TypeFormHeader';
import Footer from '../../common/TypeFormFooter';
import { getCompaniesSearch } from '../../../../apis/companySearchApi';
import { getJobTitlesSearch } from '../../../../apis/jobTitleSearchApi';
import { getCompaniesSearch } from 'apis/companySearchApi';
import { getJobTitlesSearch } from 'apis/jobTitleSearchApi';
import {
experienceCountSelector,
timeAndSalaryCountSelector,
} from '../../../../selectors/countSelector';
} from 'selectors/countSelector';
import {
createInterviewExperience,
queryExperienceCountIfUnfetched,
} from '../../../../actions/experiences';
import { queryTimeAndSalaryCountIfUnfetched } from '../../../../actions/timeAndSalary';
import { GA_CATEGORY, GA_ACTION } from '../../../../constants/gaConstants';
import PIXEL_CONTENT_CATEGORY from '../../../../constants/pixelConstants';
} from 'actions/experiences';
import { queryTimeAndSalaryCountIfUnfetched } from 'actions/timeAndSalary';
import { GA_CATEGORY, GA_ACTION } from 'constants/gaConstants';
import PIXEL_CONTENT_CATEGORY from 'constants/pixelConstants';
import {
DATA_KEY_COMPANY_NAME,
DATA_KEY_JOB_TITLE,
Expand Down
5 changes: 1 addition & 4 deletions src/components/TimeAndSalary/SearchScreen/SearchScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import Pagination from 'common/Pagination';
import { isFetching, isFetched, isUnfetched } from 'constants/status';
import { pageType } from 'constants/companyJobTitle';
import { useQuery } from 'hooks/routing';
import {
queryKeyword,
keywordMinLength,
} from '../../../actions/timeAndSalarySearch';
import { queryKeyword, keywordMinLength } from 'actions/timeAndSalarySearch';
import {
keywordSelector,
pageSelector,
Expand Down
6 changes: 3 additions & 3 deletions src/components/TimeAndSalary/TimeAndSalaryBoard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import AboutThisJobModal from '../common/AboutThisJobModal';
import withModal from '../common/withModal';
import styles from './TimeAndSalaryBoard.module.css';
import commonStyles from '../views/view.module.css';
import { isFetching, isFetched } from '../../../constants/status';
import { queryTimeAndSalary } from '../../../actions/timeAndSalaryBoard';
import { isFetching, isFetched } from 'constants/status';
import { queryTimeAndSalary } from 'actions/timeAndSalaryBoard';
import DashBoardTable from '../common/DashBoardTable';
import { toQsString, queryParser } from './helper';
import { DATA_NUM_PER_PAGE } from '../../../constants/timeAndSalarSearch';
import { DATA_NUM_PER_PAGE } from 'constants/timeAndSalarSearch';
import renderHelmet from './helmet';

const pathParameters = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import ProgressBar from 'common/ProgressBar';
import { goalNum } from '../../../constants/dataProgress';
import { queryExperienceCountIfUnfetched as queryExperienceCount } from '../../../actions/experiences';
import { experienceCountSelector } from '../../../selectors/countSelector';
import { queryExperienceCountIfUnfetched as queryExperienceCount } from 'actions/experiences';
import { experienceCountSelector } from 'selectors/countSelector';

const ProgressBarWithDataCount = props => {
const experienceCount = useSelector(experienceCountSelector);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import CampaignTimeAndSalaryBoard from '../../components/CampaignTimeAndSalary/CampaignTimeAndSalaryBoard';
import { queryCampaignInfoListIfNeeded } from '../../actions/campaignInfo';
import { queryCampaignTimeAndSalary } from '../../actions/campaignTimeAndSalaryBoard';
import { queryCampaignInfoListIfNeeded } from 'actions/campaignInfo';
import { queryCampaignTimeAndSalary } from 'actions/campaignTimeAndSalaryBoard';
import {
campaignNameSelector,
campaignEntriesSelector,
campaignEntriesStatusSelector,
campaignEntriesErrorSelector,
} from '../../selectors/campaignSelector';
} from 'selectors/campaignSelector';

const mapStateToProps = (state, { match }) => ({
campaignName: campaignNameSelector(match),
Expand Down
4 changes: 2 additions & 2 deletions src/containers/CampaignTimeAndSalary/NotFound.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import NotFound from '../../components/CampaignTimeAndSalary/NotFound';
import { queryCampaignInfoListIfNeeded } from '../../actions/campaignInfo';
import { queryCampaignInfoListIfNeeded } from 'actions/campaignInfo';
import {
campaignNameSelector,
campaignEntriesSelector,
campaignEntriesStatusSelector,
campaignEntriesErrorSelector,
} from '../../selectors/campaignSelector';
} from 'selectors/campaignSelector';

const mapStateToProps = (state, { match }) => ({
campaignName: campaignNameSelector(match),
Expand Down
Loading