Skip to content

Commit

Permalink
Merge pull request #371 from guardian/upgrade-eslint
Browse files Browse the repository at this point in the history
Upgrade eslint
  • Loading branch information
davidfurey authored Oct 25, 2024
2 parents adaf13f + f02b480 commit cd33dba
Show file tree
Hide file tree
Showing 47 changed files with 485 additions and 728 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"jsx": true
}
},
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"rules": {
"semi": 2,
"strict": 0
Expand Down
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c38afa310a6f479b2e1d54abbbb09fa7bbf0614f
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
"@babel/plugin-transform-object-assign": "^7.22.5",
"@babel/preset-env": "^7.23.2",
"@babel/preset-react": "^7.22.15",
"@babel/eslint-parser": "7.25.9",
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.3",
"css-loader": "^6.8.1",
"enzyme": "^3.10.0",
"eslint": "^4.18.2",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.33.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
Expand All @@ -51,7 +52,6 @@
"dependencies": {
"@babel/runtime": "^7.0.0",
"@guardian/prosemirror-editor": "^0.2.0",
"babel-eslint": "^10.1.0",
"copy-to-clipboard": "^3.0.5",
"date-fns": "^1.28.0",
"enzyme-adapter-react-16": "^1.15.7",
Expand Down
2 changes: 1 addition & 1 deletion public/js/components/AppMessage/AppMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default class AppMessage extends React.Component {

static propTypes = {
error: PropTypes.string
}
};

render() {
return (
Expand Down
2 changes: 1 addition & 1 deletion public/js/components/AtomCreate/AtomCreateExternalApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AtomCreateExternalApp extends React.Component {

static propTypes = {
atomType: AtomTypePropType
}
};

render () {
return (
Expand Down
12 changes: 6 additions & 6 deletions public/js/components/AtomCreate/AtomCreateGenericInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ class AtomCreateGenericInfo extends React.Component {
atomActions: PropTypes.shape({
createAtom: PropTypes.func.isRequired
}).isRequired
}
};

state = {
title: "",
commissioningDesks: []
}
};

updateTitle = (newTitle) => {
this.setState({
title: newTitle
});
}
};

updateTags = (tags) => {
this.setState({
commissioningDesks: tags
});
}
};

triggerAtomCreate = (e) => {
e.preventDefault();
Expand All @@ -43,15 +43,15 @@ class AtomCreateGenericInfo extends React.Component {
title: this.state.title,
commissioningDesks: this.state.commissioningDesks
});
}
};

shouldEnableCreateButton = () => {
if (!this.state.title || !this.state.title.length) {
return false;
}

return true;
}
};

render () {

Expand Down
8 changes: 4 additions & 4 deletions public/js/components/AtomEdit/AtomEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AtomEdit extends React.Component {
embeddedMode: PropTypes.string,
isEmbedded: PropTypes.bool.isRequired
})
}
};

UNSAFE_componentWillMount() {
subscribeToPresence(this.props.routeParams.atomType, this.props.routeParams.id);
Expand All @@ -52,7 +52,7 @@ class AtomEdit extends React.Component {
} finally {
this.props.atomActions.updateAtom(newAtom);
}
}
};

updateChartAtom = () => {
try {
Expand All @@ -65,11 +65,11 @@ class AtomEdit extends React.Component {
this.props.atomActions.updateAtom(atom);
});
}
}
};

updateFormErrors = (errors) => {
this.props.formErrorActions.updateFormErrors(errors);
}
};

renderSpecificEditor () {

Expand Down
4 changes: 2 additions & 2 deletions public/js/components/AtomEdit/AtomEditHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class AtomEditHeader extends React.Component {
static propTypes = {
atom: atomPropType.isRequired,
onUpdate: PropTypes.func
}
};

renderDate(dateType) {

Expand Down Expand Up @@ -48,7 +48,7 @@ export default class AtomEditHeader extends React.Component {
return (
<h4 className="atom-card__subheading">Title: {getTitleForAtom(atom)}</h4>
);
}
};


render () {
Expand Down
2 changes: 1 addition & 1 deletion public/js/components/AtomEdit/CustomEditors/CTAEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class CTAEditor extends React.Component {
}).isRequired,
onUpdate: PropTypes.func.isRequired,
onFormErrorsUpdate: PropTypes.func
}
};

render () {

Expand Down
2 changes: 1 addition & 1 deletion public/js/components/AtomEdit/CustomEditors/ChartEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class ChartEditor extends React.Component {
stage: PropTypes.string.isRequired
}).isRequired,
onUpdate: PropTypes.func.isRequired
}
};

state = {
modalOpen: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class CommonsDivisionEditor extends React.Component {
atom: atomPropType.isRequired,
onUpdate: PropTypes.func.isRequired,
onFormErrorsUpdate: PropTypes.func
}
};

renderDetails(details) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class ExplainerEditor extends React.Component {
atom: atomPropType.isRequired,
onUpdate: PropTypes.func.isRequired,
onFormErrorsUpdate: PropTypes.func
}
};

render() {
return (<ManagedForm data={this.props.atom} updateData={this.props.onUpdate} onFormErrorsUpdate={this.props.onFormErrorsUpdate} formName="explainerEditor">
Expand Down
2 changes: 1 addition & 1 deletion public/js/components/AtomEdit/CustomEditors/QAndAEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class QAndAEditor extends React.Component {
config: PropTypes.shape({
gridUrl: PropTypes.string.isRequired
}).isRequired
}
};

render () {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class TimelineEditor extends React.Component {
atom: atomPropType.isRequired,
onUpdate: PropTypes.func.isRequired,
onFormErrorsUpdate: PropTypes.func
}
};

render () {

Expand Down
6 changes: 3 additions & 3 deletions public/js/components/AtomEdit/EmbeddedAtomPick.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ class EmbeddedAtomPick extends React.Component {
static propTypes = {
atom: atomPropType.isRequired,
publishAtom: PropTypes.func.isRequired
}
};

triggerEmbedMessage = () => {
window.parent.postMessage({
atomId: this.props.atom.id,
atomType: this.props.atom.atomType
}, '*');
}
};

triggerAtomPublished = () => {
this.props.publishAtom(this.props.atom);
}
};

atomHasBeenPublished(){
return !!this.props.atom.contentChangeDetails.published;
Expand Down
10 changes: 5 additions & 5 deletions public/js/components/AtomEmbed/CreateTargetForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ class CreateTargetForm extends React.Component {
title: PropTypes.string.isRequired,
triggerTargetFetch: PropTypes.func.isRequired,
toggleEditMode: PropTypes.func.isRequired
}
};

state = {
creating: false,
currentTarget: {},
formHasError: true
}
};


UNSAFE_componentWillMount() {
Expand Down Expand Up @@ -56,19 +56,19 @@ class CreateTargetForm extends React.Component {
});
}
});
}
};

updateCurrentTarget = (newTarget) => {
this.setState({
currentTarget: newTarget
});
}
};

updateFormErrorState = (errorState) => {
this.setState({
formHasError: errorState
});
}
};

render() {
return (
Expand Down
2 changes: 1 addition & 1 deletion public/js/components/AtomRoot/AtomRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AtomRoot extends React.Component {
liveCapiUrl: PropTypes.string
}),
children: PropTypes.element.isRequired
}
};


UNSAFE_componentWillMount() {
Expand Down
8 changes: 4 additions & 4 deletions public/js/components/AtomStats/AtomStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AtomStats extends React.Component {
composerUrl: PropTypes.string.isRequired,
viewerUrl: PropTypes.string.isRequired
}).isRequired
}
};

UNSAFE_componentWillMount() {
this.props.atomActions.getAtomUsages(this.props.routeParams.atomType, this.props.routeParams.id);
Expand Down Expand Up @@ -54,7 +54,7 @@ class AtomStats extends React.Component {
</li>
);
}
}
};

renderAtomUsages = () => {
if (this.props.atomUsages && this.props.atomUsages.length > 0) {
Expand All @@ -68,7 +68,7 @@ class AtomStats extends React.Component {
<div>This atom is not currently used in any content.</div>
);
}
}
};

renderSuggestedContent = () => {
if (this.props.suggestedContent && this.props.suggestedContent.length > 0) {
Expand All @@ -82,7 +82,7 @@ class AtomStats extends React.Component {
<div>No suggested content for the last 7 days.</div>
);
}
}
};

render() {
return (
Expand Down
10 changes: 5 additions & 5 deletions public/js/components/ContentSuggestions/ContentSuggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ContentSuggestions extends React.Component {
viewerUrl: PropTypes.string.isRequired,
liveCapiUrl: PropTypes.string
}).isRequired
}
};

UNSAFE_componentWillMount() {
this.props.atomActions.getSuggestionsForLatestContent();
Expand All @@ -35,7 +35,7 @@ class ContentSuggestions extends React.Component {
</div>
</li>
);
}
};

renderContent = content => {
const composerLink = `${this.props.config.composerUrl}/content/${content.internalComposerCode}`;
Expand All @@ -61,7 +61,7 @@ class ContentSuggestions extends React.Component {
</div>
</div>
);
}
};

renderAtomsArray = (atomsArray) => {
return (
Expand All @@ -72,7 +72,7 @@ class ContentSuggestions extends React.Component {
</ul>
</div>
);
}
};

renderContentAndSuggestions = (item, i) => {
return (
Expand All @@ -81,7 +81,7 @@ class ContentSuggestions extends React.Component {
{ this.renderAtomsArray(item.atoms) }
</li>
);
}
};

renderSuggestionsForLatestContent() {
if (this.props.suggestionsForLatestContent) {
Expand Down
6 changes: 3 additions & 3 deletions public/js/components/ContentSuggestions/CopyUrlButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ class CopyUrlButton extends React.Component {
config: PropTypes.shape({
capiLiveUrl: PropTypes.string
}).isRequired
}
};

state = {
copied: false
}
};

generateEmbedUrl() {
if (!this.props.atom) {
Expand All @@ -33,7 +33,7 @@ class CopyUrlButton extends React.Component {
setTimeout(() => {
this.setState({copied: false});
}, 5000);
}
};

render() {
return (
Expand Down
4 changes: 2 additions & 2 deletions public/js/components/ExternalAtom/ExternalAtom.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ExternalAtom extends React.Component {
externalAtomActions: PropTypes.shape({
getExternalAtom: PropTypes.func.isRequired
})
}
};

UNSAFE_componentWillMount() {
this.props.externalAtomActions.getExternalAtom(this.props.routeParams.atomType, this.props.routeParams.id);
Expand All @@ -28,7 +28,7 @@ class ExternalAtom extends React.Component {
<a target="_blank" rel="noreferrer" href={getAtomEditorUrl(atom)} className="link">Open dedicated {_capitalize(atom.atomType)} atom editor</a>
</div>
);
}
};

render () {

Expand Down
Loading

0 comments on commit cd33dba

Please sign in to comment.