From 7ab106ee279f1109f1a12dbe118c715c85943172 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Tue, 9 Feb 2021 12:14:00 -0500 Subject: [PATCH] Update eslint and fix duplicate import errors --- package.json | 4 ++-- src/components/fixed-tools/fixed-tools.jsx | 3 +-- src/components/mode-tools/mode-tools.jsx | 3 +-- src/components/paint-editor/paint-editor.jsx | 3 +-- src/containers/color-indicator.jsx | 3 +-- src/containers/fixed-tools.jsx | 3 +-- src/containers/line-mode.jsx | 3 +-- src/containers/mode-tools.jsx | 3 +-- src/containers/paint-editor.jsx | 6 ++---- src/containers/paper-canvas.jsx | 6 ++++-- src/containers/stroke-color-indicator.jsx | 3 +-- src/containers/stroke-width-indicator.jsx | 3 +-- src/helper/bit-tools/brush-tool.js | 3 +-- src/helper/bit-tools/line-tool.js | 3 +-- src/helper/selection-tools/move-tool.js | 3 +-- src/helper/style-path.js | 3 +-- src/helper/undo.js | 3 +-- src/hocs/copy-paste-hoc.jsx | 3 +-- src/hocs/keyboard-shortcuts-hoc.jsx | 3 +-- src/hocs/undo-hoc.jsx | 7 ++++--- src/hocs/update-image-hoc.jsx | 12 ++++++------ test/unit/blob-mode-reducer.test.js | 6 ++---- test/unit/clipboard-reducer.test.js | 5 +++-- test/unit/format-reducer.test.js | 3 +-- test/unit/hover-reducer.test.js | 3 +-- test/unit/modes-reducer.test.js | 3 +-- test/unit/selected-items-reducer.test.js | 5 +++-- test/unit/stroke-width-reducer.test.js | 5 +++-- test/unit/undo-reducer.test.js | 5 +++-- 29 files changed, 51 insertions(+), 67 deletions(-) diff --git a/package.json b/package.json index 45bda35c..2a48197f 100644 --- a/package.json +++ b/package.json @@ -60,9 +60,9 @@ "css-loader": "3.4.0", "enzyme": "^3.6.0", "enzyme-adapter-react-16": "^1.5.0", - "eslint": "^4.4.1", + "eslint": "^5.7.0", "eslint-config-import": "^0.13.0", - "eslint-config-scratch": "^5.0.0", + "eslint-config-scratch": "^6.0.0", "eslint-plugin-import": "^2.18.2", "eslint-plugin-react": "7.20.3", "gh-pages": "github:rschamp/gh-pages#publish-branch-to-subfolder", diff --git a/src/components/fixed-tools/fixed-tools.jsx b/src/components/fixed-tools/fixed-tools.jsx index 0a808549..b1d325fa 100644 --- a/src/components/fixed-tools/fixed-tools.jsx +++ b/src/components/fixed-tools/fixed-tools.jsx @@ -12,12 +12,11 @@ import Button from '../button/button.jsx'; import ButtonGroup from '../button-group/button-group.jsx'; import Dropdown from '../dropdown/dropdown.jsx'; import {defineMessages, injectIntl, intlShape} from 'react-intl'; -import Formats from '../../lib/format'; +import Formats, {isVector} from '../../lib/format'; import Input from '../forms/input.jsx'; import InputGroup from '../input-group/input-group.jsx'; import Label from '../forms/label.jsx'; import LabeledIconButton from '../labeled-icon-button/labeled-icon-button.jsx'; -import {isVector} from '../../lib/format'; import layout from '../../lib/layout-constants'; import {hideLabel} from '../../lib/hide-label'; import styles from './fixed-tools.css'; diff --git a/src/components/mode-tools/mode-tools.jsx b/src/components/mode-tools/mode-tools.jsx index 408a6bb4..78771edb 100644 --- a/src/components/mode-tools/mode-tools.jsx +++ b/src/components/mode-tools/mode-tools.jsx @@ -17,8 +17,7 @@ import Input from '../forms/input.jsx'; import InputGroup from '../input-group/input-group.jsx'; import LabeledIconButton from '../labeled-icon-button/labeled-icon-button.jsx'; import Modes from '../../lib/modes'; -import Formats from '../../lib/format'; -import {isBitmap, isVector} from '../../lib/format'; +import Formats, {isBitmap, isVector} from '../../lib/format'; import {hideLabel} from '../../lib/hide-label'; import styles from './mode-tools.css'; diff --git a/src/components/paint-editor/paint-editor.jsx b/src/components/paint-editor/paint-editor.jsx index b4a2844d..c94d3585 100644 --- a/src/components/paint-editor/paint-editor.jsx +++ b/src/components/paint-editor/paint-editor.jsx @@ -34,8 +34,7 @@ import StrokeColorIndicatorComponent from '../../containers/stroke-color-indicat import StrokeWidthIndicatorComponent from '../../containers/stroke-width-indicator.jsx'; import TextMode from '../../containers/text-mode.jsx'; -import Formats from '../../lib/format'; -import {isBitmap, isVector} from '../../lib/format'; +import Formats, {isBitmap, isVector} from '../../lib/format'; import styles from './paint-editor.css'; import bitmapIcon from './icons/bitmap.svg'; diff --git a/src/containers/color-indicator.jsx b/src/containers/color-indicator.jsx index bd119408..10b5faf0 100644 --- a/src/containers/color-indicator.jsx +++ b/src/containers/color-indicator.jsx @@ -5,8 +5,7 @@ import parseColor from 'parse-color'; import {injectIntl, intlShape} from 'react-intl'; import {getSelectedLeafItems} from '../helper/selection'; -import Formats from '../lib/format'; -import {isBitmap} from '../lib/format'; +import Formats, {isBitmap} from '../lib/format'; import GradientTypes from '../lib/gradient-types'; import ColorIndicatorComponent from '../components/color-indicator.jsx'; diff --git a/src/containers/fixed-tools.jsx b/src/containers/fixed-tools.jsx index fb5aeb40..8bbaf155 100644 --- a/src/containers/fixed-tools.jsx +++ b/src/containers/fixed-tools.jsx @@ -15,8 +15,7 @@ import {getSelectedLeafItems} from '../helper/selection'; import {bringToFront, sendBackward, sendToBack, bringForward} from '../helper/order'; import {groupSelection, ungroupSelection} from '../helper/group'; -import Formats from '../lib/format'; -import {isBitmap} from '../lib/format'; +import Formats, {isBitmap} from '../lib/format'; import bindAll from 'lodash.bindall'; class FixedTools extends React.Component { diff --git a/src/containers/line-mode.jsx b/src/containers/line-mode.jsx index f9043ad4..db4f0976 100644 --- a/src/containers/line-mode.jsx +++ b/src/containers/line-mode.jsx @@ -8,12 +8,11 @@ import ColorStyleProptype from '../lib/color-style-proptype'; import {clearSelection} from '../helper/selection'; import {endPointHit, touching} from '../helper/snapping'; import {drawHitPoint, removeHitPoint} from '../helper/guides'; -import {styleShape} from '../helper/style-path'; +import {styleShape, MIXED} from '../helper/style-path'; import {changeStrokeColor, clearStrokeGradient} from '../reducers/stroke-style'; import {changeStrokeWidth} from '../reducers/stroke-width'; import {changeMode} from '../reducers/modes'; import {clearSelectedItems} from '../reducers/selected-items'; -import {MIXED} from '../helper/style-path'; import {snapDeltaToAngle} from '../helper/math'; import LineModeComponent from '../components/line-mode/line-mode.jsx'; diff --git a/src/containers/mode-tools.jsx b/src/containers/mode-tools.jsx index b3f77c08..95f85229 100644 --- a/src/containers/mode-tools.jsx +++ b/src/containers/mode-tools.jsx @@ -18,8 +18,7 @@ import { import {HANDLE_RATIO, ensureClockwise} from '../helper/math'; import {getRaster} from '../helper/layer'; import {flipBitmapHorizontal, flipBitmapVertical, selectAllBitmap} from '../helper/bitmap'; -import {isBitmap} from '../lib/format'; -import Formats from '../lib/format'; +import Formats, {isBitmap} from '../lib/format'; import Modes from '../lib/modes'; class ModeTools extends React.Component { diff --git a/src/containers/paint-editor.jsx b/src/containers/paint-editor.jsx index 1e2d3ac0..cd3d944c 100644 --- a/src/containers/paint-editor.jsx +++ b/src/containers/paint-editor.jsx @@ -23,10 +23,8 @@ import {convertToBitmap, convertToVector} from '../helper/bitmap'; import {resetZoom, zoomOnSelection, OUTERMOST_ZOOM_LEVEL} from '../helper/view'; import EyeDropperTool from '../helper/tools/eye-dropper'; -import Modes from '../lib/modes'; -import {BitmapModes, VectorModes} from '../lib/modes'; -import Formats from '../lib/format'; -import {isBitmap, isVector} from '../lib/format'; +import Modes, {BitmapModes, VectorModes} from '../lib/modes'; +import Formats, {isBitmap, isVector} from '../lib/format'; import bindAll from 'lodash.bindall'; /** diff --git a/src/containers/paper-canvas.jsx b/src/containers/paper-canvas.jsx index 256f864b..2f9de52f 100644 --- a/src/containers/paper-canvas.jsx +++ b/src/containers/paper-canvas.jsx @@ -11,8 +11,10 @@ import {undoSnapshot, clearUndoState} from '../reducers/undo'; import {isGroup, ungroupItems} from '../helper/group'; import {clearRaster, convertBackgroundGuideLayer, getRaster, setupLayers} from '../helper/layer'; import {clearSelectedItems} from '../reducers/selected-items'; -import {ART_BOARD_WIDTH, ART_BOARD_HEIGHT, CENTER, MAX_WORKSPACE_BOUNDS} from '../helper/view'; -import {clampViewBounds, resetZoom, setWorkspaceBounds, zoomToFit, resizeCrosshair} from '../helper/view'; +import { + ART_BOARD_WIDTH, ART_BOARD_HEIGHT, CENTER, MAX_WORKSPACE_BOUNDS, + clampViewBounds, resetZoom, setWorkspaceBounds, zoomToFit, resizeCrosshair +} from '../helper/view'; import {ensureClockwise, scaleWithStrokes} from '../helper/math'; import {clearHoveredItem} from '../reducers/hover'; import {clearPasteOffset} from '../reducers/clipboard'; diff --git a/src/containers/stroke-color-indicator.jsx b/src/containers/stroke-color-indicator.jsx index b912bcc3..eb33393a 100644 --- a/src/containers/stroke-color-indicator.jsx +++ b/src/containers/stroke-color-indicator.jsx @@ -2,9 +2,8 @@ import {connect} from 'react-redux'; import {defineMessages} from 'react-intl'; import {changeColorIndex} from '../reducers/color-index'; -import {changeStrokeColor, changeStrokeColor2} from '../reducers/stroke-style'; +import {changeStrokeColor, changeStrokeColor2, changeStrokeGradientType} from '../reducers/stroke-style'; import {changeStrokeWidth} from '../reducers/stroke-width'; -import {changeStrokeGradientType} from '../reducers/stroke-style'; import {openStrokeColor, closeStrokeColor} from '../reducers/modals'; import {getSelectedLeafItems} from '../helper/selection'; import {setSelectedItems} from '../reducers/selected-items'; diff --git a/src/containers/stroke-width-indicator.jsx b/src/containers/stroke-width-indicator.jsx index ed27ff96..201dedf9 100644 --- a/src/containers/stroke-width-indicator.jsx +++ b/src/containers/stroke-width-indicator.jsx @@ -11,8 +11,7 @@ import {applyColorToSelection, applyStrokeWidthToSelection, getColorsFromSelecti from '../helper/style-path'; import GradientTypes from '../lib/gradient-types'; import Modes from '../lib/modes'; -import Formats from '../lib/format'; -import {isBitmap} from '../lib/format'; +import Formats, {isBitmap} from '../lib/format'; class StrokeWidthIndicator extends React.Component { constructor (props) { diff --git a/src/helper/bit-tools/brush-tool.js b/src/helper/bit-tools/brush-tool.js index 495edc06..bca883d9 100644 --- a/src/helper/bit-tools/brush-tool.js +++ b/src/helper/bit-tools/brush-tool.js @@ -1,7 +1,6 @@ import paper from '@scratch/paper'; -import {getRaster} from '../layer'; +import {getRaster, getGuideLayer} from '../layer'; import {forEachLinePoint, getBrushMark} from '../bitmap'; -import {getGuideLayer} from '../layer'; /** * Tool for drawing with the bitmap brush and eraser diff --git a/src/helper/bit-tools/line-tool.js b/src/helper/bit-tools/line-tool.js index 3a2f42d2..1efbce81 100644 --- a/src/helper/bit-tools/line-tool.js +++ b/src/helper/bit-tools/line-tool.js @@ -1,7 +1,6 @@ import paper from '@scratch/paper'; -import {getRaster} from '../layer'; +import {getRaster, createCanvas, getGuideLayer} from '../layer'; import {forEachLinePoint, getBrushMark} from '../bitmap'; -import {createCanvas, getGuideLayer} from '../layer'; import {ART_BOARD_WIDTH, ART_BOARD_HEIGHT} from '../view'; /** diff --git a/src/helper/selection-tools/move-tool.js b/src/helper/selection-tools/move-tool.js index fa62b8b9..97967539 100644 --- a/src/helper/selection-tools/move-tool.js +++ b/src/helper/selection-tools/move-tool.js @@ -1,6 +1,5 @@ import paper from '@scratch/paper'; -import Modes from '../../lib/modes'; -import {BitmapModes} from '../../lib/modes'; +import Modes, {BitmapModes} from '../../lib/modes'; import {isGroup} from '../group'; import {isCompoundPathItem, getRootItem} from '../item'; import {checkPointsClose, snapDeltaToAngle} from '../math'; diff --git a/src/helper/style-path.js b/src/helper/style-path.js index 839a5a07..a9bbce8f 100644 --- a/src/helper/style-path.js +++ b/src/helper/style-path.js @@ -1,8 +1,7 @@ import paper from '@scratch/paper'; -import {getSelectedLeafItems} from './selection'; +import {getSelectedLeafItems, getItems} from './selection'; import {isPointTextItem} from './item'; import {isGroup} from './group'; -import {getItems} from './selection'; import GradientTypes from '../lib/gradient-types'; import {DEFAULT_COLOR} from '../reducers/fill-style'; import {isCompoundPathChild} from '../helper/compound-path'; diff --git a/src/helper/undo.js b/src/helper/undo.js index 9961a16e..97c7b630 100644 --- a/src/helper/undo.js +++ b/src/helper/undo.js @@ -3,8 +3,7 @@ import paper from '@scratch/paper'; import {hideGuideLayers, showGuideLayers, getRaster} from '../helper/layer'; import {getSelectedLeafItems} from '../helper/selection'; -import Formats from '../lib/format'; -import {isVector, isBitmap} from '../lib/format'; +import Formats, {isVector, isBitmap} from '../lib/format'; import log from '../log/log'; /** diff --git a/src/hocs/copy-paste-hoc.jsx b/src/hocs/copy-paste-hoc.jsx index 75f9f3bd..d9a364c5 100644 --- a/src/hocs/copy-paste-hoc.jsx +++ b/src/hocs/copy-paste-hoc.jsx @@ -12,8 +12,7 @@ import { getSelectedRootItems } from '../helper/selection'; import {getTrimmedRaster} from '../helper/bitmap'; -import {isBitmap} from '../lib/format'; -import Formats from '../lib/format'; +import Formats, {isBitmap} from '../lib/format'; import Modes from '../lib/modes'; import {clearSelectedItems, setSelectedItems} from '../reducers/selected-items'; diff --git a/src/hocs/keyboard-shortcuts-hoc.jsx b/src/hocs/keyboard-shortcuts-hoc.jsx index deb2449a..c9cc788f 100644 --- a/src/hocs/keyboard-shortcuts-hoc.jsx +++ b/src/hocs/keyboard-shortcuts-hoc.jsx @@ -13,8 +13,7 @@ import {groupSelection, shouldShowGroup, ungroupSelection, shouldShowUngroup} fr import {clearSelectedItems, setSelectedItems} from '../reducers/selected-items'; import {changeMode} from '../reducers/modes'; -import {isBitmap} from '../lib/format'; -import Formats from '../lib/format'; +import Formats, {isBitmap} from '../lib/format'; import Modes from '../lib/modes'; const KeyboardShortcutsHOC = function (WrappedComponent) { diff --git a/src/hocs/undo-hoc.jsx b/src/hocs/undo-hoc.jsx index 294d7ea9..e7114437 100644 --- a/src/hocs/undo-hoc.jsx +++ b/src/hocs/undo-hoc.jsx @@ -6,11 +6,12 @@ import {connect} from 'react-redux'; import {getSelectedLeafItems} from '../helper/selection'; import {setSelectedItems} from '../reducers/selected-items'; -import {performUndo, performRedo, shouldShowUndo, shouldShowRedo} from '../helper/undo'; +import { + performUndo, performRedo, shouldShowUndo, shouldShowRedo +} from '../helper/undo'; import {undo, redo} from '../reducers/undo'; -import {isBitmap} from '../lib/format'; -import Formats from '../lib/format'; +import Formats, {isBitmap} from '../lib/format'; const UndoHOC = function (WrappedComponent) { class UndoWrapper extends React.Component { diff --git a/src/hocs/update-image-hoc.jsx b/src/hocs/update-image-hoc.jsx index 0286c827..dae756d2 100644 --- a/src/hocs/update-image-hoc.jsx +++ b/src/hocs/update-image-hoc.jsx @@ -16,13 +16,13 @@ import {commitRectToBitmap, commitOvalToBitmap, commitSelectionToBitmap, getHitB import {performSnapshot} from '../helper/undo'; import {scaleWithStrokes} from '../helper/math'; -import {ART_BOARD_WIDTH, ART_BOARD_HEIGHT, SVG_ART_BOARD_WIDTH, SVG_ART_BOARD_HEIGHT} from '../helper/view'; -import {setWorkspaceBounds} from '../helper/view'; +import { + ART_BOARD_WIDTH, ART_BOARD_HEIGHT, SVG_ART_BOARD_WIDTH, SVG_ART_BOARD_HEIGHT, + setWorkspaceBounds +} from '../helper/view'; -import Modes from '../lib/modes'; -import {BitmapModes} from '../lib/modes'; -import Formats from '../lib/format'; -import {isBitmap, isVector} from '../lib/format'; +import Modes, {BitmapModes} from '../lib/modes'; +import Formats, {isBitmap, isVector} from '../lib/format'; const UpdateImageHOC = function (WrappedComponent) { class UpdateImageWrapper extends React.Component { diff --git a/test/unit/blob-mode-reducer.test.js b/test/unit/blob-mode-reducer.test.js index 845b9111..ab297fd9 100644 --- a/test/unit/blob-mode-reducer.test.js +++ b/test/unit/blob-mode-reducer.test.js @@ -1,8 +1,6 @@ /* eslint-env jest */ -import brushReducer from '../../src/reducers/brush-mode'; -import {changeBrushSize} from '../../src/reducers/brush-mode'; -import eraserReducer from '../../src/reducers/eraser-mode'; -import {changeBrushSize as changeEraserSize} from '../../src/reducers/eraser-mode'; +import brushReducer, {changeBrushSize} from '../../src/reducers/brush-mode'; +import eraserReducer, {changeBrushSize as changeEraserSize} from '../../src/reducers/eraser-mode'; test('initialState', () => { let defaultState; diff --git a/test/unit/clipboard-reducer.test.js b/test/unit/clipboard-reducer.test.js index bb8e060b..efcc9467 100644 --- a/test/unit/clipboard-reducer.test.js +++ b/test/unit/clipboard-reducer.test.js @@ -1,6 +1,7 @@ /* eslint-env jest */ -import clipboardReducer from '../../src/reducers/clipboard'; -import {clearPasteOffset, incrementPasteOffset, setClipboardItems} from '../../src/reducers/clipboard'; +import clipboardReducer, { + clearPasteOffset, incrementPasteOffset, setClipboardItems +} from '../../src/reducers/clipboard'; test('initialState', () => { let defaultState; diff --git a/test/unit/format-reducer.test.js b/test/unit/format-reducer.test.js index 3c1c99c3..9ab955c0 100644 --- a/test/unit/format-reducer.test.js +++ b/test/unit/format-reducer.test.js @@ -1,7 +1,6 @@ /* eslint-env jest */ import Formats from '../../src/lib/format'; -import reducer from '../../src/reducers/format'; -import {changeFormat} from '../../src/reducers/format'; +import reducer, {changeFormat} from '../../src/reducers/format'; import {undo, redo} from '../../src/reducers/undo'; test('initialState', () => { diff --git a/test/unit/hover-reducer.test.js b/test/unit/hover-reducer.test.js index 58f469b8..98a60ec9 100644 --- a/test/unit/hover-reducer.test.js +++ b/test/unit/hover-reducer.test.js @@ -1,6 +1,5 @@ /* eslint-env jest */ -import reducer from '../../src/reducers/hover'; -import {clearHoveredItem, setHoveredItem} from '../../src/reducers/hover'; +import reducer, {clearHoveredItem, setHoveredItem} from '../../src/reducers/hover'; test('initialState', () => { let defaultState; diff --git a/test/unit/modes-reducer.test.js b/test/unit/modes-reducer.test.js index 88d0177e..adee5c89 100644 --- a/test/unit/modes-reducer.test.js +++ b/test/unit/modes-reducer.test.js @@ -1,7 +1,6 @@ /* eslint-env jest */ import Modes from '../../src/lib/modes'; -import reducer from '../../src/reducers/modes'; -import {changeMode} from '../../src/reducers/modes'; +import reducer, {changeMode} from '../../src/reducers/modes'; test('initialState', () => { let defaultState; diff --git a/test/unit/selected-items-reducer.test.js b/test/unit/selected-items-reducer.test.js index d4a30ba8..c3645eb7 100644 --- a/test/unit/selected-items-reducer.test.js +++ b/test/unit/selected-items-reducer.test.js @@ -1,6 +1,7 @@ /* eslint-env jest */ -import selectedItemsReducer from '../../src/reducers/selected-items'; -import {setSelectedItems, clearSelectedItems} from '../../src/reducers/selected-items'; +import selectedItemsReducer, { + setSelectedItems, clearSelectedItems +} from '../../src/reducers/selected-items'; test('initialState', () => { let defaultState; diff --git a/test/unit/stroke-width-reducer.test.js b/test/unit/stroke-width-reducer.test.js index 3218a4bf..601b5723 100644 --- a/test/unit/stroke-width-reducer.test.js +++ b/test/unit/stroke-width-reducer.test.js @@ -1,6 +1,7 @@ /* eslint-env jest */ -import strokeWidthReducer from '../../src/reducers/stroke-width'; -import {MAX_STROKE_WIDTH, changeStrokeWidth} from '../../src/reducers/stroke-width'; +import strokeWidthReducer, { + MAX_STROKE_WIDTH, changeStrokeWidth +} from '../../src/reducers/stroke-width'; import {setSelectedItems} from '../../src/reducers/selected-items'; import {mockPaperRootItem} from '../__mocks__/paperMocks'; diff --git a/test/unit/undo-reducer.test.js b/test/unit/undo-reducer.test.js index e5332e38..2701075f 100644 --- a/test/unit/undo-reducer.test.js +++ b/test/unit/undo-reducer.test.js @@ -1,6 +1,7 @@ /* eslint-env jest */ -import undoReducer from '../../src/reducers/undo'; -import {undoSnapshot, undo, redo, clearUndoState, MAX_STACK_SIZE} from '../../src/reducers/undo'; +import undoReducer, { + undoSnapshot, undo, redo, clearUndoState, MAX_STACK_SIZE +} from '../../src/reducers/undo'; test('initialState', () => { let defaultState;