Skip to content

Commit

Permalink
FIX ESLint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabina Talipova committed Jul 2, 2023
1 parent 06d39c2 commit 4fdf1c1
Show file tree
Hide file tree
Showing 10 changed files with 202 additions and 200 deletions.
4 changes: 2 additions & 2 deletions client/dist/js/bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions client/src/boot/registerComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default () => {
(updater) => {
// Add CMS page history GraphQL query to the HistoryViewer
updater.component('HistoryViewer.pages-controller-cms-content', readOnePageQuery, 'PageHistoryViewer');
}
},
);

Injector.transform(
Expand All @@ -24,8 +24,8 @@ export default () => {
// arguments. The "rollback" mutation correctly handles relations and is a more consumable
// API endpoint.
rollbackPageMutation,
'PageRevertMutation'
'PageRevertMutation',
);
}
},
);
};
14 changes: 7 additions & 7 deletions client/src/components/AnchorSelectorField/AnchorSelectorField.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class AnchorSelectorField extends SilverStripeComponent {
// Query endpoint for anchors for this page
const fetchURL = props.data.endpoint.replace(/:id/, props.pageId);
return fetch(fetchURL, { credentials: 'same-origin' })
.then(response => response.json())
.then((response) => response.json())
.then((anchors) => {
// Fold in field anchors and ensure array has only unique values
const allAnchors = [...new Set([...anchors, ...fieldAnchors])];
Expand All @@ -82,9 +82,9 @@ class AnchorSelectorField extends SilverStripeComponent {
* @return {Array}
*/
getDropdownOptions() {
const options = this.props.anchors.map(value => ({ value }));
const options = this.props.anchors.map((value) => ({ value }));
// Ensure value is available in the list
if (this.props.value && !this.props.anchors.find(value => value === this.props.value)) {
if (this.props.value && !this.props.anchors.find((value) => value === this.props.value)) {
options.unshift({ value: this.props.value });
}
return options;
Expand Down Expand Up @@ -153,8 +153,8 @@ AnchorSelectorField.propTypes = {
pageId: PropTypes.number,
anchors: PropTypes.array,
loadingState: PropTypes.oneOf(Object
.keys(anchorSelectorStates)
.map((key) => anchorSelectorStates[key])),
.keys(anchorSelectorStates)
.map((key) => anchorSelectorStates[key])),
onLoadingError: PropTypes.func,
data: PropTypes.shape({
endpoint: PropTypes.string,
Expand All @@ -167,7 +167,7 @@ AnchorSelectorField.defaultProps = {
extraClass: '',
onLoadingError: noop,
attributes: {},
CreatableSelectComponent: CreatableSelect
CreatableSelectComponent: CreatableSelect,
};

function mapStateToProps(state, ownProps) {
Expand All @@ -179,7 +179,7 @@ function mapStateToProps(state, ownProps) {
// Load anchors from page
let anchors = [];
const page = pageId
? state.cms.anchorSelector.pages.find(next => next.id === pageId)
? state.cms.anchorSelector.pages.find((next) => next.id === pageId)
: null;
if (page
&& (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/* global jest, test, describe, beforeEach, it, expect, setTimeout */

import React from 'react';
import { Component as AnchorSelectorField } from '../AnchorSelectorField';
import anchorSelectorStates from 'state/anchorSelector/AnchorSelectorStates';
import { render, screen } from '@testing-library/react';
import { Component as AnchorSelectorField } from '../AnchorSelectorField';

jest.mock('isomorphic-fetch', () =>
() => Promise.resolve({
json: () => ['anchor3', 'anchor4'],
jest.mock('isomorphic-fetch', () => () => Promise.resolve({
json: () => ['anchor3', 'anchor4'],
}));
jest.mock('i18n');

Expand All @@ -24,7 +23,7 @@ function makeProps(obj = {}) {
loadingState: anchorSelectorStates.SUCCESS,
CreatableSelectComponent: ({ options }) => (
<div data-testid="test-creatable-select">
{options.map(option => <div key={option.value} data-option={option.value}/>)}
{options.map((option) => <div key={option.value} data-option={option.value} />)}
</div>
),
...obj,
Expand All @@ -50,7 +49,7 @@ test('AnchorSelectorField componentDidMount() Loads dirty selectors', async () =

test('AnchorSelectorField Merges value with page anchors', async () => {
const beginUpdating = jest.fn();
const { container } = render(<AnchorSelectorField {...makeProps({
render(<AnchorSelectorField {...makeProps({
loadingState: anchorSelectorStates.DIRTY,
actions: {
anchorSelector: {
Expand Down
Loading

0 comments on commit 4fdf1c1

Please sign in to comment.