Skip to content

Commit

Permalink
Sort all imports with the prettier plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelts3 authored and nerdyman committed Oct 5, 2022
1 parent 3bf385f commit 0e7ea85
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 34 deletions.
8 changes: 1 addition & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@
"jsx": true
}
},
"plugins": [
"testing-library",
"@typescript-eslint",
"react",
"jest",
"jest-dom"
],
"plugins": ["testing-library", "@typescript-eslint", "react", "jest", "jest-dom"],
"extends": [
"eslint:recommended",
"plugin:jest/recommended",
Expand Down
2 changes: 1 addition & 1 deletion .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { withConsole } from '@storybook/addon-console';
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
import { addDecorator, addParameters } from '@storybook/react';
import { withConsole } from '@storybook/addon-console';

import { theme } from './theme';

Expand Down
3 changes: 1 addition & 2 deletions docs/demos/00-props.story.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint no-console: 0 */
import React from 'react';
import { Story } from '@storybook/react';

import React from 'react';
import { ReactCompareSlider, ReactCompareSliderImage } from 'react-compare-slider';

import * as config from './config';
Expand Down
1 change: 0 additions & 1 deletion docs/demos/02-handles.story.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint no-console: 0 */
import React from 'react';

import {
ReactCompareSlider,
ReactCompareSliderHandle,
Expand Down
3 changes: 1 addition & 2 deletions docs/demos/03-custom-components.story.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint no-console: 0 */
import { GoogleApiWrapper, Map } from 'google-maps-react';
import React from 'react';
import { Map, GoogleApiWrapper } from 'google-maps-react';

import { ReactCompareSlider } from 'react-compare-slider';

import * as config from './config';
Expand Down
5 changes: 1 addition & 4 deletions example/demo-blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ export const DemoSection: React.FC<DemoSectionProps> = ({
}) => (
<section className="c-demo-section" {...props}>
<div className="c-demo-section__info">
<h1
className="c-demo-section__title"
dangerouslySetInnerHTML={{ __html: title }}
/>
<h1 className="c-demo-section__title" dangerouslySetInnerHTML={{ __html: title }} />
<p
className="c-demo-section__description"
dangerouslySetInnerHTML={{ __html: description }}
Expand Down
3 changes: 1 addition & 2 deletions example/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* eslint no-console: 0 */

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { ReactCompareSlider, ReactCompareSliderImage, styleFitContainer } from '../src';

import { ReactCompareSlider, ReactCompareSliderImage, styleFitContainer } from '../src';
import { DemoSection } from './demo-blocks';

const App = () => {
Expand Down
27 changes: 16 additions & 11 deletions src/ReactCompareSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { useEffect, useCallback, useRef, useState } from 'react';
import React, { useCallback, useEffect, useRef, useState } from 'react';

import { ContainerClip, ContainerHandle } from './Container';
import { ReactCompareSliderHandle } from './ReactCompareSliderHandle';
import { ReactCompareSliderCommonProps, ReactCompareSliderPropPosition } from './types';
import {
useEventListener,
usePrevious,
UseResizeObserverHandlerParams,
useResizeObserver,
UseResizeObserverHandlerParams,
} from './utils';

/** Comparison slider properties. */
Expand Down Expand Up @@ -93,9 +93,12 @@ export const ReactCompareSlider: React.FC<
portrait: _portrait,
boundsPadding: _boundsPadding,
}: UpdateInternalPositionProps) {
const { top, left, width, height } = (
rootContainerRef.current as HTMLDivElement
).getBoundingClientRect();
const {
top,
left,
width,
height,
} = (rootContainerRef.current as HTMLDivElement).getBoundingClientRect();

// Early out if width or height are zero, can't calculate values
// from zeros.
Expand Down Expand Up @@ -184,9 +187,10 @@ export const ReactCompareSlider: React.FC<

// Update internal position when other user controllable props change.
useEffect(() => {
const { width, height } = (
rootContainerRef.current as HTMLDivElement
).getBoundingClientRect();
const {
width,
height,
} = (rootContainerRef.current as HTMLDivElement).getBoundingClientRect();

// Use current internal position if `position` hasn't changed.
const nextPosition =
Expand Down Expand Up @@ -240,9 +244,10 @@ export const ReactCompareSlider: React.FC<
/** Resync internal position on resize. */
const handleResize: (resizeProps: UseResizeObserverHandlerParams) => void = useCallback(
({ width, height }) => {
const { width: scaledWidth, height: scaledHeight } = (
rootContainerRef.current as HTMLDivElement
).getBoundingClientRect();
const {
width: scaledWidth,
height: scaledHeight,
} = (rootContainerRef.current as HTMLDivElement).getBoundingClientRect();

updateInternalPosition({
portrait,
Expand Down
2 changes: 1 addition & 1 deletion test/ReactCompareSlider.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { cleanup, fireEvent, render } from '@testing-library/react';
import React from 'react';

import { ReactCompareSlider, ReactCompareSliderHandle } from '../src';

Expand Down
2 changes: 1 addition & 1 deletion test/ReactCompareSliderImage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cleanup, render } from '@testing-library/react';
import React from 'react';
import { render, cleanup } from '@testing-library/react';

import { ReactCompareSliderImage } from '../src';

Expand Down
3 changes: 1 addition & 2 deletions test/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/**
* @jest-environment node
*/

import React from 'react';
import { cleanup } from '@testing-library/react';
import React from 'react';

import { styleFitContainer } from '../src/';
import { useIsomorphicLayoutEffect } from '../src/utils';
Expand Down

0 comments on commit 0e7ea85

Please sign in to comment.