Skip to content

Commit

Permalink
fix lint warnings, disable the most annoying one
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed May 17, 2022
1 parent b436b6d commit 50d748c
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ module.exports = {
'import/extensions': ['error', 'ignorePackages'],
},
},
{
files: [
'packages/@uppy/dashboard/src/components/**/*.jsx',
],
rules: {
'react/destructuring-assignment': 'off',
},
},
{
files: [
// Those need looser rules, and cannot be made part of the stricter rules above.
Expand Down
10 changes: 5 additions & 5 deletions packages/@uppy/dashboard/src/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default class Dashboard extends UIPlugin {
&& callerPluginType !== 'editor') {
const msg = 'Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor'
this.uppy.log(msg, 'error')
return
return undefined
}

const target = {
Expand Down Expand Up @@ -266,7 +266,7 @@ export default class Dashboard extends UIPlugin {
const { isHidden, isClosing } = this.getPluginState()
if (isHidden || isClosing) {
// short-circuit if animation is ongoing
return
return undefined
}

const { promise, resolve } = createPromise()
Expand Down Expand Up @@ -462,7 +462,7 @@ export default class Dashboard extends UIPlugin {
// save previous tabindex in a data-attribute, to restore when enabling
const currentTabIndex = node.getAttribute('tabindex')
if (currentTabIndex) {
node.dataset.inertTabindex = currentTabIndex
node.dataset.inertTabindex = currentTabIndex // eslint-disable-line no-param-reassign
}
node.setAttribute('tabindex', '-1')
})
Expand Down Expand Up @@ -584,15 +584,15 @@ export default class Dashboard extends UIPlugin {
|| (this.opts.disableLocalFiles && (hasFiles || !somePluginCanHandleRootDrop))
|| !this.uppy.getState().allowNewUpload
) {
event.dataTransfer.dropEffect = 'none'
event.dataTransfer.dropEffect = 'none' // eslint-disable-line no-param-reassign
clearTimeout(this.removeDragOverClassTimeout)
return
}

// Add a small (+) icon on drop
// (and prevent browsers from interpreting this as files being _moved_ into the
// browser, https://github.com/transloadit/uppy/issues/1978).
event.dataTransfer.dropEffect = 'copy'
event.dataTransfer.dropEffect = 'copy' // eslint-disable-line no-param-reassign

clearTimeout(this.removeDragOverClassTimeout)
this.setPluginState({ isDraggingOver: true })
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/dashboard/src/components/AddFiles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AddFiles extends Component {
// ___Why not use value="" on <input/> instead?
// Because if we use that method of clearing the input,
// Chrome will not trigger change if we drop the same file twice (Issue #768).
event.target.value = null
event.target.value = null // eslint-disable-line no-param-reassign
}

renderHiddenInput = (isFolder, refCallback) => {
Expand Down
1 change: 1 addition & 0 deletions packages/@uppy/dashboard/src/components/AddFilesPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const AddFilesPanel = (props) => {
{props.i18n('back')}
</button>
</div>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<AddFiles {...props} />
</div>
)
Expand Down
7 changes: 7 additions & 0 deletions packages/@uppy/dashboard/src/components/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default function Dashboard (props) {
{props.i18n('dropHint')}
</div>

{/* eslint-disable-next-line react/jsx-props-no-spreading */}
{showFileList && <PanelTopBar {...props} />}

{numberOfFilesForRecovery && (
Expand All @@ -132,26 +133,32 @@ export default function Dashboard (props) {

{showFileList ? (
<FileList
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
itemsPerRow={itemsPerRow}
/>
) : (
// eslint-disable-next-line react/jsx-props-no-spreading
<AddFiles {...props} isSizeMD={isSizeMD} />
)}

<Slide>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
{props.showAddFilesPanel ? <AddFilesPanel key="AddFiles" {...props} isSizeMD={isSizeMD} /> : null}
</Slide>

<Slide>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
{props.fileCardFor ? <FileCard key="FileCard" {...props} /> : null}
</Slide>

<Slide>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
{props.activePickerPanel ? <PickerPanelContent key="Picker" {...props} /> : null}
</Slide>

<Slide>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
{props.showFileEditor ? <EditorPanel key="Editor" {...props} /> : null}
</Slide>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@ export default function FileProgress (props) {
}

if (props.recoveredState) {
return
return undefined
}

// Retry button for error
if (props.error && !props.hideRetryButton) {
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<ProgressIndicatorButton {...props}>
<svg aria-hidden="true" focusable="false" className="uppy-c-icon uppy-Dashboard-Item-progressIcon--retry" width="28" height="31" viewBox="0 0 16 19">
<path d="M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z" />
Expand All @@ -137,6 +138,7 @@ export default function FileProgress (props) {
// Pause/resume button for resumable uploads
if (props.resumableUploads && !props.hidePauseResumeButton) {
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<ProgressIndicatorButton {...props}>
<ProgressCircleContainer>
<ProgressCircle progress={props.file.progress.percentage} />
Expand All @@ -158,6 +160,7 @@ export default function FileProgress (props) {
// Cancel button for non-resumable uploads if individualCancellation is supported (not bundled)
if (!props.resumableUploads && props.individualCancellation && !props.hideCancelButton) {
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<ProgressIndicatorButton {...props}>
<ProgressCircleContainer>
<ProgressCircle progress={props.file.progress.percentage} />
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/dashboard/src/components/FileList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default (props) => {
<FileItem
key={fileID}
uppy={props.uppy}
{...fileProps}
{...fileProps} // eslint-disable-line react/jsx-props-no-spreading
role="listitem"
openFileEditor={props.openFileEditor}
canEditFile={props.canEditFile}
Expand Down

0 comments on commit 50d748c

Please sign in to comment.