Skip to content

Commit

Permalink
fix: remove React import
Browse files Browse the repository at this point in the history
  • Loading branch information
mkosir committed Dec 4, 2024
1 parent 2ffbd29 commit 04bd670
Show file tree
Hide file tree
Showing 67 changed files with 52 additions and 137 deletions.
11 changes: 10 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ const storybookConfig: StorybookConfig = {
name: '@storybook/react-webpack5',
options: {},
},

// JSX transform no longer requires importing React explicitly in every file.
swc: () => ({
jsc: {
transform: {
react: {
runtime: 'automatic',
},
},
},
}),
webpackFinal: (config) => {
// Resolve absolute imports
config.resolve?.modules?.push(path.resolve(process.cwd(), 'src'));
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ npm install react-parallax-tilt
## Example

```jsx
import React from 'react';
import ReactDOM from 'react-dom';
import Tilt from 'react-parallax-tilt';

Expand Down
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export default tseslint.config(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
...eslintPluginReactHooks.configs.recommended.rules,

'react/react-in-jsx-scope': 'off',

'prefer-template': 'error',
'no-nested-ternary': 'error',
'no-unneeded-ternary': 'error',
Expand Down
2 changes: 1 addition & 1 deletion scripts/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
".": ["."]
},
"importHelpers": true,
"jsx": "react",
"jsx": "react-jsx",
"lib": ["ESNext", "DOM"],
"module": "ESNext",
"moduleResolution": "Bundler",
Expand Down
1 change: 0 additions & 1 deletion src/features/glare/test/glare.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { screen, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';

import type { OnMove, OnMoveParams } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/glare/test/glareStyle.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen, render, fireEvent } from '@testing-library/react';
import React from 'react';

import type { OnMove } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/tilt/test/tiltAxis.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { screen, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';

import type { OnMove, OnMoveParams } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/tilt/test/tiltDisable.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen, render, fireEvent } from '@testing-library/react';
import React from 'react';

import type { OnMove, OnMoveParams } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/tilt/test/tiltManualAngle.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { screen, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';

import type { OnMove, OnMoveParams } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/tilt/test/tiltMaxAngle.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { screen, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';

import type { OnMove, OnMoveParams } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/tilt/test/tiltOnEnter.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen, render, fireEvent } from '@testing-library/react';
import React from 'react';

import type { OnEnter } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/tilt/test/tiltOnLeave.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen, render, fireEvent } from '@testing-library/react';
import React from 'react';

import type { OnLeave } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/tilt/test/tiltOnPropChange.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { screen, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';

import type { OnMove, OnMoveParams } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/tilt/test/tiltOnTouchMove.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen, render, fireEvent } from '@testing-library/react';
import React from 'react';

import type { OnMove, OnMoveParams } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/tilt/test/tiltReset.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen, render, fireEvent } from '@testing-library/react';
import React from 'react';

import type { OnEnter, OnLeave, OnMove, OnMoveParams } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/tilt/test/tiltReverse.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { screen, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';

import type { OnMove, OnMoveParams } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/tilt/test/tiltStyle.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen, render, fireEvent } from '@testing-library/react';
import React from 'react';

import type { OnMove } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
1 change: 0 additions & 1 deletion src/features/tilt/test/tiltTrackOnWindow.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { screen, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';

import type { OnMove, OnMoveParams } from 'index';
import { TiltTest } from 'utils/TiltTest';
Expand Down
2 changes: 1 addition & 1 deletion src/react-parallax-tilt/ReactParallaxTilt.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';

import { Glare } from 'features/glare/Glare';
import { Tilt } from 'features/tilt/Tilt';
Expand Down
2 changes: 0 additions & 2 deletions src/utils/TiltTest.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import type { ReactParallaxTiltProps } from 'index';
import Tilt from 'index';

Expand Down
2 changes: 0 additions & 2 deletions stories/Default/Default.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import Tilt from 'index';

import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
5 changes: 1 addition & 4 deletions stories/Default/_Default.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';
import { DemoTab } from 'react-demo-tab';

import Demo from './Default.demozap';

const code = `import React from 'react';
import Tilt from 'index';
const code = `import Tilt from 'index';
import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
2 changes: 1 addition & 1 deletion stories/EventParams/EventParams.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ChangeEvent } from 'react';
import React, { useState } from 'react';
import { useState } from 'react';

import type { OnEnterParams, OnLeaveParams, OnMoveParams } from 'index';
import Tilt from 'index';
Expand Down
7 changes: 4 additions & 3 deletions stories/EventParams/_EventParams.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';
import { DemoTab } from 'react-demo-tab';

import Demo from './EventParams.demozap';

const code = `import React, { useState, ChangeEvent } from 'react';
const code = `import type { ChangeEvent } from 'react';
import { useState } from 'react';
import Tilt, { OnEnterParams, OnLeaveParams, OnMoveParams } from 'index';
import type { OnEnterParams, OnLeaveParams, OnMoveParams } from 'index';
import Tilt from 'index';
import './EventParams.demozap.css';
Expand Down
2 changes: 1 addition & 1 deletion stories/EventTiltAngle/EventTiltAngle.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';

import type { OnMoveParams } from 'index';
import Tilt from 'index';
Expand Down
6 changes: 3 additions & 3 deletions stories/EventTiltAngle/_EventTiltAngle.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { DemoTab } from 'react-demo-tab';

import Demo from './EventTiltAngle.demozap';

const code = `import React, { PureComponent } from 'react';
const code = `import { PureComponent } from 'react';
import Tilt, { OnMoveParams } from 'index';
import type { OnMoveParams } from 'index';
import Tilt from 'index';
import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
import './EventTiltAngle.demozap.css';
Expand Down
2 changes: 1 addition & 1 deletion stories/FlipPage/FlipPage.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import { useState } from 'react';

import Tilt from 'index';

Expand Down
2 changes: 0 additions & 2 deletions stories/FlipPage/Page/Page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import './Page.css';
import sampleImg from './lorem-picsum.png';

Expand Down
3 changes: 1 addition & 2 deletions stories/FlipPage/_FlipPage.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react';
import { DemoTab } from 'react-demo-tab';

import Demo from './FlipPage.demozap';

const code = `import React, { useState } from 'react';
const code = `import { useState } from 'react';
import Tilt from 'index';
Expand Down
2 changes: 1 addition & 1 deletion stories/FlipVH/FlipVH.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import { useState } from 'react';

import Tilt from 'index';
import './FlipVH.demozap.css';
Expand Down
3 changes: 1 addition & 2 deletions stories/FlipVH/_FlipVH.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react';
import { DemoTab } from 'react-demo-tab';

import Demo from './FlipVH.demozap';

const code = `import React, { useState } from 'react';
const code = `import { useState } from 'react';
import Tilt from 'index';
import './FlipVH.demozap.css';
Expand Down
2 changes: 0 additions & 2 deletions stories/GlareEffect/GlareEffect.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import Tilt from 'index';

import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
5 changes: 1 addition & 4 deletions stories/GlareEffect/_GlareEffect.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';
import { DemoTab } from 'react-demo-tab';

import Demo from './GlareEffect.demozap';

const code = `import React from 'react';
import Tilt from 'index';
const code = `import Tilt from 'index';
import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
2 changes: 0 additions & 2 deletions stories/GlareEffect360/GlareEffect360.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import Tilt from 'index';

import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
5 changes: 1 addition & 4 deletions stories/GlareEffect360/_GlareEffect360.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';
import { DemoTab } from 'react-demo-tab';

import Demo from './GlareEffect360.demozap';

const code = `import React from 'react';
import Tilt from 'index';
const code = `import Tilt from 'index';
import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
2 changes: 0 additions & 2 deletions stories/GlareEffectNoTilt/GlareEffectNoTilt.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import Tilt from 'index';

import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
5 changes: 1 addition & 4 deletions stories/GlareEffectNoTilt/_GlareEffectNoTilt.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';
import { DemoTab } from 'react-demo-tab';

import Demo from './GlareEffectNoTilt.demozap';

const code = `import React from 'react';
import Tilt from 'index';
const code = `import Tilt from 'index';
import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
2 changes: 0 additions & 2 deletions stories/InitialTilt/InitialTilt.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import Tilt from 'index';

import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
5 changes: 1 addition & 4 deletions stories/InitialTilt/_InitialTilt.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';
import { DemoTab } from 'react-demo-tab';

import Demo from './InitialTilt.demozap';

const code = `import React from 'react';
import Tilt from 'index';
const code = `import Tilt from 'index';
import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
2 changes: 0 additions & 2 deletions stories/KeepFloating/KeepFloating.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import Tilt from 'index';

import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
5 changes: 1 addition & 4 deletions stories/KeepFloating/_KeepFloating.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';
import { DemoTab } from 'react-demo-tab';

import Demo from './KeepFloating.demozap';

const code = `import React from 'react';
import Tilt from 'index';
const code = `import Tilt from 'index';
import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
2 changes: 0 additions & 2 deletions stories/MultipleTilt/MultipleTilt.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import Tilt from 'index';

import './MultipleTilt.demozap.css';
Expand Down
5 changes: 1 addition & 4 deletions stories/MultipleTilt/_MultipleTilt.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';
import { DemoTab } from 'react-demo-tab';

import Demo from './MultipleTilt.demozap';

const code = `import React from 'react';
import Tilt from 'index';
const code = `import Tilt from 'index';
import './MultipleTilt.demozap.css';
import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
2 changes: 0 additions & 2 deletions stories/MultipleTiltScroll/MultipleTiltScroll.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import Tilt from 'index';

import './MultipleTiltScroll.demozap.css';
Expand Down
5 changes: 1 addition & 4 deletions stories/MultipleTiltScroll/_MultipleTiltScroll.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react';
import { DemoTab } from 'react-demo-tab';

import Demo from './MultipleTiltScroll.demozap';

const code = `import React from 'react';
import Tilt from 'index';
const code = `import Tilt from 'index';
import './MultipleTiltScroll.demozap.css';
import { DefaultComponent } from '../_DefaultComponent/DefaultComponent';
Expand Down
2 changes: 0 additions & 2 deletions stories/ParallaxEffect/ParallaxEffect.demozap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import Tilt from 'index';
import './ParallaxEffect.demozap.css';

Expand Down
Loading

0 comments on commit 04bd670

Please sign in to comment.