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

Code Cleanup: Enforce Linting Rules & Update UNSAFE_ React Lifecycle Events #559

Merged
merged 33 commits into from Jun 4, 2020
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
75b0091
add linting for no-param-reassign and fix resulting linting errors
IAmThePan Apr 29, 2020
8d37082
add linting for prefer-object-spread and fix resulting linting errors
IAmThePan Apr 29, 2020
3049bd1
add linting for no-restricted-syntax and fix 1/2 of resulting errors
IAmThePan May 1, 2020
fe03ad7
add linting for no-prototype-builtins and fix resulting linting errors
IAmThePan May 4, 2020
f11bc18
add linting for class-methods-use-this and fix most resulting errors.…
IAmThePan May 5, 2020
5f3471e
finish linting for class-methods-use-this
IAmThePan May 6, 2020
d4d84dc
add linting for no-mixed-operators and fix resulting linting errors
IAmThePan May 6, 2020
17f90ed
add linting for import/prefer-default-export and fix resulting lintin…
IAmThePan May 8, 2020
a77cd1b
add linting for react/no-access-state-in-setstate and fix resulting l…
IAmThePan May 8, 2020
c31dbaf
add linting for react/jsx-props-no-spreading and fix resulting lintin…
IAmThePan May 11, 2020
3d50aff
finish linting errors for no-restricted-syntax. 1 remains: couldn't r…
IAmThePan May 12, 2020
227d012
Merge branch 'develop' into feature/update-linter
IAmThePan May 12, 2020
0988a29
Fix linting errors resulting from the merge with develop
IAmThePan May 12, 2020
b55be21
Refactor UNSAFE_componentWillMount into either constructor or compone…
IAmThePan May 14, 2020
241747c
Refactor UNSAFE_componentWillReceiveProps to componentDidUpdate or ge…
IAmThePan May 18, 2020
eb413fb
re-enable lint exception for no-prototype-builtins and revert calls b…
IAmThePan May 20, 2020
ac0ec93
add single line exception for no-restricted-syntax linting rule
IAmThePan May 20, 2020
fd954eb
add linting for react/destructuring-assignment and fix errors. ToDo: …
IAmThePan May 21, 2020
e815546
Fix minor bugs
IAmThePan May 22, 2020
ae8ffcc
Fix General Settings last updated text
IAmThePan May 22, 2020
4c56460
rework linting rule no-param-reassign to have more exceptions and par…
IAmThePan May 23, 2020
c5ef663
Remove file and line linting exceptions.
IAmThePan May 26, 2020
3ca2402
re-add linting rule react/sort-comp and fix resulting errors
IAmThePan May 26, 2020
4533fd7
remove added linting exception consistent-return and fix resulting er…
IAmThePan May 26, 2020
590aa60
remove added linting expression no-use-before-define and fix resultin…
IAmThePan May 26, 2020
ecb62e8
Fix linting error
IAmThePan May 26, 2020
f634c1d
fix minor bugs
IAmThePan May 26, 2020
ea51432
Code cleanup: fix PromoModal imports
IAmThePan May 26, 2020
75a88cb
Merge with develop. Fix resulting linting errors
IAmThePan May 26, 2020
68493d2
remove unnecessary hasOwnProperty calls after refactored for...in loops
IAmThePan May 28, 2020
6297062
Fix missing strings bug
IAmThePan May 28, 2020
9b4d16c
Fix last remaining string bug
IAmThePan May 28, 2020
2cb47a1
Merge branch 'develop' into feature/cleanup
IAmThePan Jun 4, 2020
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

add linting for react/jsx-props-no-spreading and fix resulting lintin…

…g errors
  • Loading branch information
IAmThePan committed May 11, 2020
commit c31dbaf10160462fe7b4df1944291e62dcca6541
@@ -85,7 +85,7 @@ module.exports = {
'react/jsx-curly-newline': [0],
'react/jsx-indent': [1, 'tab'],
'react/jsx-indent-props': [1, 'tab'],
'react/jsx-props-no-spreading': [0], // TODO: enable this check
'react/jsx-props-no-spreading': [1],
'react/no-access-state-in-setstate': [1],
This conversation was marked as resolved by wlycdgr

This comment has been minimized.

@christophertino

christophertino Jun 4, 2020
Member

Remove both jsx-props-no-spreading and no-access-state-in-setstate

This comment has been minimized.

@IAmThePan

IAmThePan Jun 11, 2020
Author Contributor

updated in feature/cleanup-cleanup as this PR was already merged.

This comment has been minimized.

@wlycdgr

wlycdgr Jun 11, 2020
Member

lgtm in feature/cleanup-cleanup

'react/no-danger': [0],
'react/prop-types': [0],
@@ -36,11 +36,13 @@ class AppViewContainer extends Component {
* @return {JSX} JSX for rendering the Home View of the Hub app
*/
render() {
const childProps = {
...this.props,
exitToast: this._exitToast,
};
return <AppView {...childProps} />;
const { app, children } = this.props;

return (
<AppView app={app} exitToast={this._exitToast}>
{children}
</AppView>
);
}
}

@@ -172,30 +172,26 @@ class CreateAccountViewContainer extends Component {
passwordInvalidError,
passwordLengthError,
} = this.state;
const createAccountChildProps = {
email,
emailError,
confirmEmail,
confirmEmailError,
firstName,
lastName,
legalConsentChecked,
legalConsentNotCheckedError,
password,
passwordInvalidError,
passwordLengthError,
handleInputChange: this._handleInputChange,
handleLegalConsentCheckboxChange: this._handleLegalConsentCheckboxChange,
handleSubmit: this._handleCreateAccountAttempt
};
const signedInChildProps = {
email: (user && user.email) || email,
};

return loggedIn ? (
<SignedInView {...signedInChildProps} />
<SignedInView email={(user && user.email) || email} />
) : (
<CreateAccountView {...createAccountChildProps} />
<CreateAccountView
email={email}
emailError={emailError}
confirmEmail={confirmEmail}
confirmEmailError={confirmEmailError}
firstName={firstName}
lastName={lastName}
legalConsentChecked={legalConsentChecked}
legalConsentNotCheckedError={legalConsentNotCheckedError}
password={password}
passwordInvalidError={passwordInvalidError}
passwordLengthError={passwordLengthError}
handleInputChange={this._handleInputChange}
handleLegalConsentCheckboxChange={this._handleLegalConsentCheckboxChange}
handleSubmit={this._handleCreateAccountAttempt}
/>
);
}
}
@@ -124,15 +124,6 @@ class HomeViewContainer extends Component {
tutorial_complete,
enable_metrics,
} = home;
const childProps = {
justInstalled,
setup_complete,
tutorial_complete,
enable_metrics,
changeMetrics: this._handleToggleMetrics,
email: user ? user.email : '',
isPlus,
};

const showPromoModal = !premium_promo_modal_shown && !this._premiumSubscriber();

@@ -147,7 +138,15 @@ class HomeViewContainer extends Component {
handleGetPlusClick={this._handleGetPlusClick}
handleTryMidnightClick={this._handleTryMidnightClick}
/>
<HomeView {...childProps} />
<HomeView
justInstalled={justInstalled}
setup_complete={setup_complete}
tutorial_complete={tutorial_complete}
enable_metrics={enable_metrics}
changeMetrics={this._handleToggleMetrics}
email={user ? user.email : ''}
isPlus={isPlus}
/>
</div>
);
}
@@ -128,22 +128,18 @@ class LogInViewContainer extends Component {
emailError,
passwordError,
} = this.state;
const logInChildProps = {
email,
password,
emailError,
passwordError,
handleInputChange: this._handleInputChange,
handleSubmit: this._handleLoginAttempt,
};
const signedInChildProps = {
email: (user && user.email) || 'email',
};

return loggedIn ? (
<SignedInView {...signedInChildProps} />
<SignedInView email={(user && user.email) || 'email'} />
) : (
<LogInView {...logInChildProps} />
<LogInView
email={email}
password={password}
emailError={emailError}
passwordError={passwordError}
handleInputChange={this._handleInputChange}
handleSubmit={this._handleLoginAttempt}
/>
);
}
}
@@ -43,12 +43,12 @@ class PlusViewContainer extends Component {
* @return {JSX} JSX for rendering the Plus View of the Hub app
*/
render() {
const childProps = {
isPlus: (this.props.user && this.props.user.subscriptionsPlus) || false,
onPlusClick: this._sendPlusPing,
};

return <PlusView {...childProps} />;
return (
<PlusView
isPlus={(this.props.user && this.props.user.subscriptionsPlus) || false}
onPlusClick={this._sendPlusPing}
/>
);
}
}

@@ -36,7 +36,7 @@ const SetupView = (props) => {
path={step.path}
render={() => (
<div>
<SetupHeader {...step.headerProps} />
<SetupHeader title={step.headerProps.title} titleImage={step.headerProps.titleImage} />
<step.bodyComponent index={step.index} sendMountActions={sendMountActions} />
</div>
)}
@@ -58,11 +58,12 @@ class SetupHumanWebViewContainer extends Component {
* @return {JSX} JSX for rendering the Setup Human Web View of the Hub app
*/
render() {
const childProps = {
enableHumanWeb: this.props.setup.enable_human_web,
changeHumanWeb: this._handleToggle,
};
return <SetupHumanWebView {...childProps} />;
return (
<SetupHumanWebView
enableHumanWeb={this.props.setup.enable_human_web}
changeHumanWeb={this._handleToggle}
/>
);
}
}

@@ -22,12 +22,19 @@ import { SteppedNavigation } from '../../../../shared-components';
*/
const SetupNavigationContainer = (props) => {
const { totalSteps, setup } = props;
const childProps = {
totalSteps,
...setup.navigation,
};

return <SteppedNavigation {...childProps} />;
return (
<SteppedNavigation
totalSteps={totalSteps}
activeIndex={setup.navigation.activeIndex}
hrefPrev={setup.navigation.hrefPrev}
hrefNext={setup.navigation.hrefNext}
hrefDone={setup.navigation.hrefDone}
textPrev={setup.navigation.textPrev}
textNext={setup.navigation.textNext}
textDone={setup.navigation.textDone}
/>
);
};

// PropTypes ensure we pass required props of the correct type
@@ -68,13 +68,14 @@ class SideNavigationViewContainer extends Component {
icon: 'profile',
},
];
const childProps = {
menuItems,
bottomItems,
disableNav: disableRegEx.test(location.pathname),
};

return <SideNavigationView {...childProps} />;
return (
<SideNavigationView
menuItems={menuItems}
bottomItems={bottomItems}
disableNav={disableRegEx.test(location.pathname)}
/>
);
}
}

@@ -22,11 +22,19 @@ import { SteppedNavigation } from '../../../../shared-components';
*/
const TutorialNavigationContainer = (props) => {
const { totalSteps, tutorial } = props;
const childProps = {
totalSteps,
...tutorial.navigation,
};
return <SteppedNavigation {...childProps} />;

return (
<SteppedNavigation
totalSteps={totalSteps}
activeIndex={tutorial.navigation.activeIndex}
hrefPrev={tutorial.navigation.hrefPrev}
hrefNext={tutorial.navigation.hrefNext}
hrefDone={tutorial.navigation.hrefDone}
textPrev={tutorial.navigation.textPrev}
textNext={tutorial.navigation.textNext}
textDone={tutorial.navigation.textDone}
/>
);
};

// PropTypes ensure we pass required props of the correct type
ProTip! Use n and p to navigate between commits in a pull request.