Skip to content

Commit

Permalink
Eslint fix round two
Browse files Browse the repository at this point in the history
  • Loading branch information
noahtallen committed Jan 19, 2023
1 parent 9d53cbe commit e1f25f7
Show file tree
Hide file tree
Showing 93 changed files with 302 additions and 206 deletions.
2 changes: 1 addition & 1 deletion apps/happychat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This code is developed in the calypso monorepo at <https://github.com/Automattic/wp-calypso/tree/trunk/apps/happychat>.

This app contains an extracted happychat widget which can be used in wp-admin or other contexts.
This app contains an extracted happychat widget which can be used in wp-admin or other contexts.
8 changes: 5 additions & 3 deletions apps/notifications/src/panel/templates/button-approve.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { connect } from 'react-redux';
import { RestClientContext } from '../Notifications';
import { keys } from '../helpers/input';
import { getReferenceId } from '../helpers/notes';
import { setApproveStatus } from '../state/notes/thunks';
import { setApproveStatus as setApproveStatusAction } from '../state/notes/thunks';
import ActionButton from './action-button';

const ApproveButton = ( { isApproved, note, translate, setApproveStatus } ) => {
const restClient = useContext( RestClientContext );

return (
<ActionButton
icon={ 'checkmark' }
icon="checkmark"
isActive={ isApproved }
hotkey={ keys.KEY_A }
onToggle={ () =>
Expand Down Expand Up @@ -46,4 +46,6 @@ ApproveButton.propTypes = {
translate: PropTypes.func.isRequired,
};

export default connect( null, { setApproveStatus } )( localize( ApproveButton ) );
export default connect( null, { setApproveStatus: setApproveStatusAction } )(
localize( ApproveButton )
);
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ class CommentReplyInput extends Component {
event.preventDefault();
}

if ( '' === this.state.value ) return;
if ( '' === this.state.value ) {
return;
}

this.props.global.toggleNavigation( false );

Expand Down
11 changes: 8 additions & 3 deletions apps/notifications/src/panel/templates/status-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ export class StatusBar extends Component {
*/
// @TODO: Please update https://github.com/Automattic/wp-calypso/issues/58453 if you are refactoring away from UNSAFE_* lifecycle methods!
UNSAFE_componentWillReceiveProps( nextProps ) {
if ( '' == nextProps.statusMessage ) return;
if ( '' === nextProps.statusMessage ) {
return;
}

if ( nextProps.statusMessage == this.props.statusMessage ) return;
if ( nextProps.statusMessage === this.props.statusMessage ) {
return;
}

const component = this;

Expand All @@ -49,14 +53,15 @@ export class StatusBar extends Component {
const visibility = this.state.isVisible ? { display: 'flex' } : { display: 'none' };

const classes = [ 'wpnc__status-bar' ];
if ( 'undefined' != typeof this.props.statusClasses && this.props.statusClasses.length > 0 ) {
if ( 'undefined' !== typeof this.props.statusClasses && this.props.statusClasses.length > 0 ) {
classes.push.apply( classes, this.props.statusClasses );
}

return (
<div className={ classes.join( ' ' ) } style={ visibility }>
<span />
<span
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={ {
__html: this.props.statusMessage,
} }
Expand Down
12 changes: 9 additions & 3 deletions apps/notifications/src/panel/templates/undo-list-item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,19 @@ export class UndoListItem extends Component {
const component = this;

const updateSpamStatus = function ( error, data ) {
if ( error ) throw error;
if ( error ) {
throw error;
}

if ( 'spam' !== data.status ) {
// TODO: Handle failure to set Spam status
}
};

comment.get( function ( error, data ) {
if ( error ) throw error;
if ( error ) {
throw error;
}

data.status = 'spam';
comment.update( data, updateSpamStatus );
Expand All @@ -113,7 +117,9 @@ export class UndoListItem extends Component {
.site( this.props.note.meta.ids.site )
.comment( this.props.note.meta.ids.comment )
.del( ( error ) => {
if ( error ) throw error;
if ( error ) {
throw error;
}
} );

this.instance && this.setState( { isVisible: false } );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const editSitePackage = require( '@wordpress/edit-site' );
* both wp-admin and the calypso iframe.
*/
function overrideBackToDashboardButton() {
if ( ! editSitePackage?.__experimentalMainDashboardButton ) return;
if ( ! editSitePackage?.__experimentalMainDashboardButton ) {
return;
}

const SiteEditorDashboardFill = editSitePackage.__experimentalMainDashboardButton;
const siteSlug = window.location.hostname;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const ClassicGuide = () => {
'The <a>block editor</a> is now the default editor for all your sites, but you can still use the Classic block, if you prefer.'
),
{
a: <a href={ 'https://wordpress.com/support/wordpress-editor/' } />,
a: <a href="https://wordpress.com/support/wordpress-editor/" />,
}
) }
</p>
Expand Down
4 changes: 3 additions & 1 deletion build-tools/webpack/generate-chunks-map-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class GenerateChunksMapPlugin {
// This logic assumes there is only one `.js`. If there are more than one `.js` file linked to a chunk,
// this will be non deterministic as `chunk.files` iteration order is not guaranteed.
const name = Array.from( chunk.files ).find( ( file ) => /\.js$/.test( file ) );
if ( ! name ) continue;
if ( ! name ) {
continue;
}

const modules = [ ...compilation.chunkGraph.getChunkModulesIterable( chunk ) ]
.reduce( ( acc, item ) => acc.concat( item.modules || item ), [] )
Expand Down
4 changes: 2 additions & 2 deletions client/blocks/upsell-nudge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import UpsellNudge from 'calypso/blocks/upsell-nudge';
function myUpsell() {
return (
<UpsellNudge
tracksImpressionName={ 'calypso_domain_upsell_nudge' }
tracksImpressionName="calypso_domain_upsell_nudge"
callToAction={ translate( 'Upgrade' ) }
title={ translate( 'Free domain with a plan!' ) }
href={ '/plans' }
href="/plans"
showIcon={ true }
compact
/>
Expand Down
6 changes: 3 additions & 3 deletions client/components/action-card/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import ActionCard from 'calypso/components/action-card';
function render() {
return (
<ActionCard
headerText={ 'Header' }
mainText={ 'Some text' }
headerText="Header"
mainText="Some text"
className={ classnames( 'my-classname-1', 'my-classname-2' ) }
buttonText={ 'Call to action!' }
buttonText="Call to action!"
buttonIcon="external"
buttonPrimary={ true }
buttonHref="https://wordpress.com"
Expand Down
2 changes: 1 addition & 1 deletion client/components/animated-icon/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Animated Icon

`<AnimatedIcon />` is a component that enables the rendering of an Adobe After Effects animation.
`<AnimatedIcon />` is a component that enables the rendering of an Adobe After Effects animation.

The component imports the [Lottie library](https://airbnb.io/lottie/#/), which parses Adobe After Effects animations that have been exported as json with Bodymovin.

Expand Down
2 changes: 1 addition & 1 deletion client/components/data/query-canonical-theme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { getCanonicalTheme } from 'calypso/state/themes/selectors';
function MyTheme( { theme } ) {
return (
<div>
<QueryCanonicalTheme siteId={ 3584907 } themeId={ 'twentysixteen' } />
<QueryCanonicalTheme siteId={ 3584907 } themeId="twentysixteen" />
<Theme theme={ theme } />
</div>
);
Expand Down
1 change: 0 additions & 1 deletion client/components/data/query-email-stats/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ The post ID for which the email stat should be requested.
</table>

The stats fields being requested.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Query Jetpack Credentials Status

`<QueryJetpackCredentialsStatus />` is a React component that dispatches actions for testing Jetpack Credentials to determine whether they are still valid.

## Usage

Render the component, passing `siteId` and `role`. It does not accept any children, nor does it render any elements to the page. You can use it adjacent to other sibling components which make use of the fetched data made available through the global application state.
Expand Down Expand Up @@ -29,6 +30,7 @@ export default function MyComponent( { siteId, role } ) {
The site ID for which Jetpack Credentials status should be requested.

### `role`

<table>
<tr><th>Type</th><td>String</td></tr>
<tr><th>Required</th><td>Yes</td></tr>
Expand Down
2 changes: 1 addition & 1 deletion client/components/data/query-reader-tag-images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MyListItem from './list-item';
export default function MyReaderTagImages( { images } ) {
return (
<div>
<QueryReaderTagImages tag={ 'bananas' } />
<QueryReaderTagImages tag="bananas" />
{ images.map( ( image ) => {
return <MyListItem key={ image.url } image={ image } />;
} ) }
Expand Down
2 changes: 1 addition & 1 deletion client/components/data/query-theme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { getTheme } from 'calypso/state/themes/selectors';
function MyTheme( { theme } ) {
return (
<div>
<QueryTheme siteId={ 3584907 } themeId={ 'twentysixteen' } />
<QueryTheme siteId={ 3584907 } themeId="twentysixteen" />
<Theme theme={ theme } />
</div>
);
Expand Down
44 changes: 22 additions & 22 deletions client/components/foldable-card/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ function render() {

### Props

| Name | Type | Default | Description |
| ---------------------- | ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | `string` | null | HTML or component to show in the default header view of the box. |
| `content` | `string` | null | HTML or component to show in the expandable section of the box when it's expanded. |
| `actionButton` | `component` | null | A component to substitute the regular expand button. |
| `actionButtonExpanded` | `component` | null | A component to substitute the regular expand button when the card is expanded. If not provided, we use `actionButton`. |
| `icon` | `string` | `chevron-down` | Sets the Gridicon slug for the regular expand button. Retains the default value when the `actionButton` or `actionButtonExpanded` props are not set. |
| `cardKey` | `string` | '' | A unique identifier for the card that can be used to help track its state outside the component (for example, to record which cards are open). |
| `compact` | `bool` | false | Indicates if the foldable card is compact. |
| `disabled` | `bool` | false | Indicates if the component is not interactive. |
| `expandedSummary` | `string` | null | A string or component to show next to the action button when expanded. |
| `expanded` | `bool` | false | Indicates whether the component should be expanded initially. |
| `onClick` | `function` | null | Function to be executed in addition to the expand action when the header is clicked. |
| `onClose` | `function` | null | Function to be executed in addition to the expand action when the card is closed. |
| `onOpen` | `function` | null | Function to be executed in addition to the expand action when the card is opened. |
| `summary` | `string` | null | A string or component to show next to the action button when closed. |
| `hideSummary` | `bool` | false | Indicates if the summary area should be hidden. |
| `clickableHeader` | `bool` | false | Indicates if the whole header can be clicked to open the card. |
| `highlight` | `string` | null | Displays a colored highlight. If specified (default is no highlight), can be one of `info`, `success`, `error`, or `warning`. |
| `smooth` | `bool` | false | Enables smooth animation on collapse/expand. Recommended to specify `contentExpandedStyle` to set proper max-height or other animation parameters. |
| `contentExpandedStyle` | `object` | null | Styles specified when content is expanded to control smooth animation |
| `contentCollapsedStyle`| `object` | null | Styles specified when content is collapsed to control smooth animation |
| Name | Type | Default | Description |
| ----------------------- | ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `header` | `string` | null | HTML or component to show in the default header view of the box. |
| `content` | `string` | null | HTML or component to show in the expandable section of the box when it's expanded. |
| `actionButton` | `component` | null | A component to substitute the regular expand button. |
| `actionButtonExpanded` | `component` | null | A component to substitute the regular expand button when the card is expanded. If not provided, we use `actionButton`. |
| `icon` | `string` | `chevron-down` | Sets the Gridicon slug for the regular expand button. Retains the default value when the `actionButton` or `actionButtonExpanded` props are not set. |
| `cardKey` | `string` | '' | A unique identifier for the card that can be used to help track its state outside the component (for example, to record which cards are open). |
| `compact` | `bool` | false | Indicates if the foldable card is compact. |
| `disabled` | `bool` | false | Indicates if the component is not interactive. |
| `expandedSummary` | `string` | null | A string or component to show next to the action button when expanded. |
| `expanded` | `bool` | false | Indicates whether the component should be expanded initially. |
| `onClick` | `function` | null | Function to be executed in addition to the expand action when the header is clicked. |
| `onClose` | `function` | null | Function to be executed in addition to the expand action when the card is closed. |
| `onOpen` | `function` | null | Function to be executed in addition to the expand action when the card is opened. |
| `summary` | `string` | null | A string or component to show next to the action button when closed. |
| `hideSummary` | `bool` | false | Indicates if the summary area should be hidden. |
| `clickableHeader` | `bool` | false | Indicates if the whole header can be clicked to open the card. |
| `highlight` | `string` | null | Displays a colored highlight. If specified (default is no highlight), can be one of `info`, `success`, `error`, or `warning`. |
| `smooth` | `bool` | false | Enables smooth animation on collapse/expand. Recommended to specify `contentExpandedStyle` to set proper max-height or other animation parameters. |
| `contentExpandedStyle` | `object` | null | Styles specified when content is expanded to control smooth animation |
| `contentCollapsedStyle` | `object` | null | Styles specified when content is collapsed to control smooth animation |
2 changes: 1 addition & 1 deletion client/components/gauge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This component renders a simple gauge to show a percentage visually.
import Gauge from 'calypso/components/gauge';

function render() {
return <Gauge percentage={ 40 } metric={ 'Visits' } />;
return <Gauge percentage={ 40 } metric="Visits" />;
}
```

Expand Down
2 changes: 1 addition & 1 deletion client/components/jetpack/threat-dialog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function MyComponent() {
return (
<ThreatDialog
threatId={ 123 }
threatTitle={ 'Title...' }
threatTitle="Title..."
threatDescription="Description..."
action="fix"
siteName="WordPress.com"
Expand Down
10 changes: 5 additions & 5 deletions client/components/multiple-choice-question/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function MultipleChoiceQuestionExamples( { translate } ) {
} }
primary
>
{ 'The Stork Button' }
The Stork Button
</Button>
),
},
Expand All @@ -45,7 +45,7 @@ function MultipleChoiceQuestionExamples( { translate } ) {
notices.success( 'The Extra Button was clicked', { duration: 5000 } );
} }
>
{ 'The Extra Button' }
The Extra Button
</Button>
),
},
Expand All @@ -55,13 +55,13 @@ function MultipleChoiceQuestionExamples( { translate } ) {
<div>
<MultipleChoiceQuestion
answers={ answers }
question={ 'Please choose one of the following:' }
question="Please choose one of the following:"
onAnswerChange={ ( answer, text ) => {
setSelectedAnswer( answer );
setAnswerText( text || '' );
} }
/>
<h2>{ 'Selected Answer' }</h2>
<h2>Selected Answer</h2>
<p>
<b>Selected Answer is: </b>
{ selectedAnswer ? selectedAnswer : 'No Answer Currently Selected' }
Expand Down Expand Up @@ -160,4 +160,4 @@ The prompt to display in the text input referenced above.
- **Required:** `no`
- **Default:** `true`

Whether the answers should be shuffled.
Whether the answers should be shuffled.
2 changes: 1 addition & 1 deletion client/components/notice/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function MyNotice() {
return (
<Notice status="is-error" icon="mention" text="This is an error notice with a custom icon.">
<NoticeAction href="#" external>
{ 'Update' }
Update
</NoticeAction>
</Notice>
);
Expand Down
2 changes: 2 additions & 0 deletions client/components/split-button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Whether the button is compact or not.
</table>

Whether the button is styled as a primary button.

### `whiteSeparator`

<table>
Expand Down Expand Up @@ -81,6 +82,7 @@ Whether the button has modified styling to warn users (delete, remove, etc).es

Callback that will be invoked when menu button is clicked.
Will be passed the click event.

### `href`

<table>
Expand Down
2 changes: 1 addition & 1 deletion client/components/suggestion-search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function onChange( newValue, isNavigating ) {
function render() {
return (
<SuggestionSearch
placeholder={ 'Type here to search' }
placeholder="Type here to search"
onChange={ onChange }
suggestions={ [ { label: 'foo' }, { label: 'bar' } ] }
/>
Expand Down

0 comments on commit e1f25f7

Please sign in to comment.