Skip to content

Commit 39bb7f3

Browse files
committed
feat: linter passed
1 parent c213cfe commit 39bb7f3

13 files changed

Lines changed: 83 additions & 81 deletions

File tree

packages/decap-cms-core/src/actions/__tests__/entries.spec.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,30 +73,32 @@ describe('entries', () => {
7373
fields: [{ name: 'title' }, { name: 'boolean' }],
7474
});
7575

76-
return store.dispatch(createLocalEmptyDraft(collection, '?title=title&boolean=True')).then(() => {
77-
const actions = store.getActions();
78-
expect(actions).toHaveLength(1);
76+
return store
77+
.dispatch(createLocalEmptyDraft(collection, '?title=title&boolean=True'))
78+
.then(() => {
79+
const actions = store.getActions();
80+
expect(actions).toHaveLength(1);
7981

80-
expect(actions[0]).toEqual({
81-
payload: {
82-
author: '',
83-
collection: undefined,
84-
data: { title: 'title', boolean: true },
85-
meta: {},
86-
i18n: {},
87-
isModification: null,
88-
label: null,
89-
mediaFiles: [],
90-
partial: false,
91-
path: '',
92-
raw: '',
93-
slug: '',
94-
status: '',
95-
updatedOn: '',
96-
},
97-
type: 'DRAFT_CREATE_EMPTY',
82+
expect(actions[0]).toEqual({
83+
payload: {
84+
author: '',
85+
collection: undefined,
86+
data: { title: 'title', boolean: true },
87+
meta: {},
88+
i18n: {},
89+
isModification: null,
90+
label: null,
91+
mediaFiles: [],
92+
partial: false,
93+
path: '',
94+
raw: '',
95+
slug: '',
96+
status: '',
97+
updatedOn: '',
98+
},
99+
type: 'DRAFT_CREATE_EMPTY',
100+
});
98101
});
99-
});
100102
});
101103

102104
it('should html escape URL params', () => {

packages/decap-cms-core/src/components/App/StackToolbar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const StatusButton = styled(DropdownButton)`
9595
css`
9696
background-color: ${colors.processingBackground};
9797
color: ${colors.processingText};
98-
`}
98+
`}
9999
100100
${props =>
101101
props.label === 'stale' &&

packages/decap-cms-core/src/components/Editor/Editor.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export class Editor extends React.Component {
232232
// deleteLocalBackup(collection, !newEntry && slug);
233233
// }
234234

235-
createHookContext = (context) => {
235+
createHookContext = context => {
236236
const defaultContext = {
237237
editor: {
238238
props: this.props,
@@ -253,7 +253,12 @@ export class Editor extends React.Component {
253253
persistUnpublishedEntry: async (collection, existingUnpublishedEntry, entry, opts = {}) => {
254254
const context = this.createHookContext(opts);
255255
const entryDraft = entry || this.props.createEmptyDraft(collection);
256-
return this.props.persistUnpublishedEntry(collection, existingUnpublishedEntry, context, entryDraft);
256+
return this.props.persistUnpublishedEntry(
257+
collection,
258+
existingUnpublishedEntry,
259+
context,
260+
entryDraft,
261+
);
257262
},
258263
publishUnpublishedEntry: async (collection, slug, entry, opts = {}) => {
259264
const context = this.createHookContext(opts);
@@ -417,7 +422,6 @@ export class Editor extends React.Component {
417422
}
418423
}
419424

420-
421425
await deleteUnpublishedEntry(collection.get('name'), slug);
422426

423427
// this.deleteBackup();

packages/decap-cms-core/src/components/Editor/EditorControlPane/EditorControl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const styleStrings = {
7272
`,
7373
flat: `
7474
margin-top: 0 !important;
75-
`
75+
`,
7676
};
7777

7878
const ControlContainer = styled.div`

packages/decap-cms-core/src/components/Editor/EditorControlPane/Widget.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ export default class Widget extends Component {
301301

302302
setInactiveStyle = () => {
303303
this.props.setInactiveStyle();
304-
if ((this.props.field.has('pattern') || this.props.field.has('negative_pattern')) && !isEmpty(this.getValidateValue())) {
304+
if (
305+
(this.props.field.has('pattern') || this.props.field.has('negative_pattern')) &&
306+
!isEmpty(this.getValidateValue())
307+
) {
305308
this.validate();
306309
}
307310
};

packages/decap-cms-core/src/components/Editor/EditorToolbar.js

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ const StatusButton = styled(DropdownButton)`
224224
css`
225225
background-color: ${colors.processingBackground};
226226
color: ${colors.processingText};
227-
`}
227+
`}
228228
229229
${props =>
230230
props.label === 'stale' &&
@@ -390,34 +390,29 @@ export class EditorToolbar extends React.Component {
390390
);
391391
};
392392

393-
handleStatusChange = (newStatusName) => {
394-
const {
395-
currentStatus,
396-
onChangeStatus,
397-
t
398-
} = this.props;
393+
handleStatusChange = newStatusName => {
394+
const { currentStatus, onChangeStatus, t } = this.props;
399395

400396
if (currentStatus === status.get('PROCESSING')) {
401397
const newStatusLabel = t(`editor.editorToolbar.${newStatusName.toLowerCase()}`);
402398

403-
if (!window.confirm(t('editor.editor.onProcessingStatusChange', {
404-
newStatus: newStatusLabel
405-
}))) {
399+
if (
400+
!window.confirm(
401+
t('editor.editor.onProcessingStatusChange', {
402+
newStatus: newStatusLabel,
403+
}),
404+
)
405+
) {
406406
return;
407407
}
408408
}
409409

410410
onChangeStatus(newStatusName);
411-
}
411+
};
412412

413413
handleDelete = () => {
414-
const {
415-
currentStatus,
416-
hasUnpublishedChanges,
417-
onDeleteUnpublishedChanges,
418-
onDelete,
419-
t
420-
} = this.props;
414+
const { currentStatus, hasUnpublishedChanges, onDeleteUnpublishedChanges, onDelete, t } =
415+
this.props;
421416
if (currentStatus === status.get('PROCESSING')) {
422417
const translationKey = hasUnpublishedChanges
423418
? 'editor.editor.onProcessingDeleteUnpublishedChanges'
@@ -427,7 +422,7 @@ export class EditorToolbar extends React.Component {
427422
}
428423
}
429424
return hasUnpublishedChanges ? onDeleteUnpublishedChanges() : onDelete();
430-
}
425+
};
431426

432427
renderWorkflowStatusControls = () => {
433428
const { isUpdatingStatus, currentStatus, t, useOpenAuthoring } = this.props;
@@ -681,26 +676,23 @@ export class EditorToolbar extends React.Component {
681676
</SaveButton>,
682677
currentStatus
683678
? [
684-
<React.Fragment key="workflow-status-controls">
685-
{this.renderWorkflowStatusControls()}
686-
{currentStatus === status.get('PENDING_PUBLISH') &&
687-
this.renderNewEntryWorkflowPublishControls({ canCreate, canPublish })}
688-
</React.Fragment>,
689-
]
679+
<React.Fragment key="workflow-status-controls">
680+
{this.renderWorkflowStatusControls()}
681+
{currentStatus === status.get('PENDING_PUBLISH') &&
682+
this.renderNewEntryWorkflowPublishControls({ canCreate, canPublish })}
683+
</React.Fragment>,
684+
]
690685
: !isNewEntry && (
691-
<React.Fragment key="existing-entry-workflow-publish-controls">
692-
{this.renderExistingEntryWorkflowPublishControls({
693-
canCreate,
694-
canPublish,
695-
canDelete,
696-
})}
697-
</React.Fragment>
698-
),
686+
<React.Fragment key="existing-entry-workflow-publish-controls">
687+
{this.renderExistingEntryWorkflowPublishControls({
688+
canCreate,
689+
canPublish,
690+
canDelete,
691+
})}
692+
</React.Fragment>
693+
),
699694
!hasUnpublishedChanges && !isModification ? null : (
700-
<DeleteButton
701-
key="delete-button"
702-
onClick={this.handleDelete}
703-
>
695+
<DeleteButton key="delete-button" onClick={this.handleDelete}>
704696
{isDeleting ? t('editor.editorToolbar.discarding') : deleteLabel}
705697
</DeleteButton>
706698
),

packages/decap-cms-core/src/components/Editor/withWorkflow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function mergeProps(stateProps, dispatchProps, ownProps) {
3838
returnObj.persistEntry = (collection, context, entryDraft) => {
3939
const { unpublished = stateProps.unpublishedEntry } = context;
4040
return dispatch(persistUnpublishedEntry(collection, unpublished, context, entryDraft));
41-
}
41+
};
4242
}
4343

4444
return {

packages/decap-cms-core/src/components/Workflow/WorkflowList.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const ColumnHeader = styled.h2`
110110
css`
111111
background-color: ${colors.processingBackground};
112112
color: ${colors.processingText};
113-
`}
113+
`}
114114
115115
${props =>
116116
props.name === 'stale' &&
@@ -162,7 +162,7 @@ class WorkflowList extends React.Component {
162162
const collection = dragProps.collection;
163163
const oldStatus = dragProps.ownStatus;
164164
if (oldStatus === 'processing') {
165-
window.alert(this.props.t('workflow.workflowList.onProcessingUpdate'))
165+
window.alert(this.props.t('workflow.workflowList.onProcessingUpdate'));
166166
return;
167167
}
168168
if (newStatus === 'stale') {
@@ -174,7 +174,7 @@ class WorkflowList extends React.Component {
174174

175175
requestDelete = (collection, slug, ownStatus) => {
176176
if (ownStatus === 'processing') {
177-
window.alert(this.props.t('workflow.workflowList.onProcessingUpdate'))
177+
window.alert(this.props.t('workflow.workflowList.onProcessingUpdate'));
178178
return;
179179
}
180180
if (window.confirm(this.props.t('workflow.workflowList.onDeleteEntry'))) {

packages/decap-cms-core/src/lib/registry.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ allowedEvents.forEach(e => {
2020

2121
const lib = {
2222
immutable,
23-
}
23+
};
2424

2525
/**
2626
* Global Registry Object
@@ -321,4 +321,3 @@ export function getCustomFormatsFormatters() {
321321
export function getFormatter(name) {
322322
return registry.formats[name]?.formatter;
323323
}
324-

packages/decap-cms-locales/src/en/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const en = {
8080
widget: {
8181
required: '%{fieldLabel} is required.',
8282
regexPattern: "%{fieldLabel} didn't match the pattern: %{pattern}.",
83-
regexNegativePattern: "%{fieldLabel} should not contain pattern: %{pattern}.",
83+
regexNegativePattern: '%{fieldLabel} should not contain pattern: %{pattern}.',
8484
processing: '%{fieldLabel} is processing.',
8585
range: '%{fieldLabel} must be between %{minValue} and %{maxValue}.',
8686
min: '%{fieldLabel} must be at least %{minValue}.',
@@ -115,9 +115,11 @@ const en = {
115115
'All changes to this entry will be deleted.\n\n Do you still want to delete?',
116116
loadingEntry: 'Loading entry...',
117117
confirmLoadBackup: 'A local backup was recovered for this entry, would you like to use it?',
118-
onProcessingStatusChange: "Are you sure you want to change the status to %{newStatus} while the entry is processing?",
119-
onProcessingDeleteUnpublishedChanges: "Are you sure you want to delete unpublished changes while the entry is processing?",
120-
onProcessingDeleteEntry: "Are you sure you want to delete this entry while it is processing?",
118+
onProcessingStatusChange:
119+
'Are you sure you want to change the status to %{newStatus} while the entry is processing?',
120+
onProcessingDeleteUnpublishedChanges:
121+
'Are you sure you want to delete unpublished changes while the entry is processing?',
122+
onProcessingDeleteEntry: 'Are you sure you want to delete this entry while it is processing?',
121123
onStackPublishing: 'Are you sure you want to publish all changes?',
122124
onStackClosing: 'Are you sure you want to discard all changes?',
123125
},

0 commit comments

Comments
 (0)