Skip to content

Commit d68e6fd

Browse files
authored
Merge pull request #351 from pmndrs/fix/01-deps-and-tooling
chore: update dependencies and migrate ESLint to flat config
2 parents 90d10d5 + 6e145ce commit d68e6fd

10 files changed

Lines changed: 2266 additions & 2139 deletions

‎.eslintignore‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎.eslintrc.json‎

Lines changed: 0 additions & 71 deletions
This file was deleted.

‎.gitignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ yarn-error.log
1717
pnpm-debug.log
1818
.parcel-cache
1919
pnpm-lock.yaml
20-
storybook-static
20+
storybook-static
21+
22+
*.tgz

‎.prettierrc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"tabWidth": 2,
66
"printWidth": 120,
77
"endOfLine": "auto"
8-
}
8+
}

‎eslint.config.mjs‎

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'
2+
import { FlatCompat } from '@eslint/eslintrc'
3+
import js from '@eslint/js'
4+
import typescriptEslint from '@typescript-eslint/eslint-plugin'
5+
import tsParser from '@typescript-eslint/parser'
6+
import _import from 'eslint-plugin-import'
7+
import prettier from 'eslint-plugin-prettier'
8+
import react from 'eslint-plugin-react'
9+
import reactHooks from 'eslint-plugin-react-hooks'
10+
import { defineConfig } from 'eslint/config'
11+
import globals from 'globals'
12+
import path from 'node:path'
13+
import { fileURLToPath } from 'node:url'
14+
15+
const __filename = fileURLToPath(import.meta.url)
16+
const __dirname = path.dirname(__filename)
17+
const compat = new FlatCompat({
18+
baseDirectory: __dirname,
19+
recommendedConfig: js.configs.recommended,
20+
allConfig: js.configs.all,
21+
})
22+
23+
export default defineConfig([
24+
{ ignores: ['dist', 'node_modules'] },
25+
{
26+
extends: fixupConfigRules(
27+
compat.extends(
28+
'prettier',
29+
'plugin:prettier/recommended',
30+
'plugin:react-hooks/recommended',
31+
'plugin:import/errors',
32+
'plugin:import/warnings'
33+
)
34+
),
35+
36+
plugins: {
37+
'@typescript-eslint': typescriptEslint,
38+
react,
39+
prettier: fixupPluginRules(prettier),
40+
'react-hooks': fixupPluginRules(reactHooks),
41+
import: fixupPluginRules(_import),
42+
},
43+
languageOptions: {
44+
globals: {
45+
...globals.browser,
46+
...globals['shared-node-browser'],
47+
...globals.node,
48+
},
49+
50+
parser: tsParser,
51+
ecmaVersion: 2018,
52+
sourceType: 'module',
53+
54+
parserOptions: {
55+
ecmaFeatures: {
56+
jsx: true,
57+
},
58+
59+
rules: {
60+
curly: ['warn', 'multi-line', 'consistent'],
61+
'no-console': 'off',
62+
'no-empty-pattern': 'warn',
63+
'no-duplicate-imports': 'error',
64+
65+
'import/no-unresolved': [
66+
'error',
67+
{
68+
commonjs: true,
69+
amd: true,
70+
},
71+
],
72+
73+
'import/export': 'error',
74+
'import/named': 'off',
75+
'import/namespace': 'off',
76+
'import/default': 'off',
77+
'@typescript-eslint/explicit-module-boundary-types': 'off',
78+
79+
'no-unused-vars': [
80+
'warn',
81+
{
82+
argsIgnorePattern: '^_',
83+
varsIgnorePattern: '^_',
84+
},
85+
],
86+
87+
'@typescript-eslint/no-unused-vars': [
88+
'warn',
89+
{
90+
argsIgnorePattern: '^_',
91+
varsIgnorePattern: '^_',
92+
},
93+
],
94+
95+
'@typescript-eslint/no-use-before-define': 'off',
96+
'@typescript-eslint/no-empty-function': 'off',
97+
'@typescript-eslint/no-empty-interface': 'off',
98+
'@typescript-eslint/no-explicit-any': 'off',
99+
},
100+
},
101+
},
102+
103+
settings: {
104+
react: {
105+
version: 'detect',
106+
},
107+
108+
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
109+
110+
'import/parsers': {
111+
'@typescript-eslint/parser': ['.js', '.jsx', '.ts', '.tsx'],
112+
},
113+
114+
'import/resolver': {
115+
node: {
116+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
117+
paths: ['src'],
118+
},
119+
120+
alias: {
121+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
122+
map: [['@react-three/postprocessing', './src/index.tsx']],
123+
},
124+
},
125+
},
126+
},
127+
{
128+
files: ['**/src'],
129+
130+
languageOptions: {
131+
ecmaVersion: 5,
132+
sourceType: 'script',
133+
134+
parserOptions: {
135+
project: './tsconfig.json',
136+
},
137+
},
138+
},
139+
])

‎package.json‎

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,44 +24,46 @@
2424
"url": "git+https://github.com/pmndrs/react-postprocessing.git"
2525
},
2626
"scripts": {
27-
"build": "rimraf dist && vite build && tsc",
28-
"eslint": "eslint . --fix --ext=js,ts,jsx,tsx",
29-
"eslint:ci": "eslint . --ext=js,ts,jsx,tsx",
27+
"build": "vite build && tsc",
28+
"eslint": "eslint . --fix",
29+
"eslint:ci": "eslint .",
3030
"test": "vitest run",
3131
"typecheck": "tsc --noEmit"
3232
},
3333
"dependencies": {
34-
"maath": "^0.6.0",
35-
"n8ao": "^1.9.4",
36-
"postprocessing": "^6.36.6"
34+
"maath": "^0.10.8",
35+
"n8ao": "^2.0.0"
3736
},
3837
"devDependencies": {
39-
"@react-three/fiber": "^9.0.4",
40-
"@types/node": "^22.10.7",
41-
"@types/react": "^19.0.2",
42-
"@types/react-dom": "^19.0.2",
43-
"@types/three": "^0.156.0",
44-
"@typescript-eslint/eslint-plugin": "^5.59.1",
45-
"@typescript-eslint/parser": "^5.59.1",
46-
"eslint": "^8.39.0",
47-
"eslint-config-prettier": "^8.8.0",
38+
"@eslint/compat": "^2.1.0",
39+
"@eslint/eslintrc": "^3.3.6",
40+
"@eslint/js": "^9.39.5",
41+
"@react-three/fiber": "^9.6.1",
42+
"@types/node": "^26.1.1",
43+
"@types/react": "^19.2.17",
44+
"@types/three": "^0.182.0",
45+
"@typescript-eslint/eslint-plugin": "^8.64.0",
46+
"@typescript-eslint/parser": "^8.64.0",
47+
"eslint": "^9.0.0",
48+
"eslint-config-prettier": "^10.1.8",
4849
"eslint-import-resolver-alias": "^1.1.2",
49-
"eslint-plugin-import": "^2.27.5",
50-
"eslint-plugin-prettier": "^4.2.1",
51-
"eslint-plugin-react": "^7.32.2",
52-
"eslint-plugin-react-hooks": "^4.6.0",
53-
"prettier": "^2.8.8",
54-
"react": "^19.0.0",
55-
"react-dom": "^19.0.0",
56-
"rimraf": "^6.0.1",
57-
"three": "^0.156.0",
58-
"typescript": "^5.0.4",
59-
"vite": "^4.3.5",
60-
"vitest": "^2.1.8"
50+
"eslint-plugin-import": "^2.32.0",
51+
"eslint-plugin-prettier": "^5.5.6",
52+
"eslint-plugin-react": "^7.37.5",
53+
"eslint-plugin-react-hooks": "^7.1.1",
54+
"globals": "^17.7.0",
55+
"postprocessing": "^6.39.3",
56+
"prettier": "^3.9.5",
57+
"react": "^19.2.7",
58+
"three": "^0.182.0",
59+
"typescript": "^6.0.0",
60+
"vite": "^8.1.4",
61+
"vitest": "^4.1.10"
6162
},
6263
"peerDependencies": {
63-
"@react-three/fiber": "^9.0.0",
64-
"react": "^19.0",
65-
"three": ">= 0.156.0"
64+
"@react-three/fiber": ">=9.5.0",
65+
"postprocessing": "^6.36.0",
66+
"react": "^19.2.0",
67+
"three": ">= 0.182.0"
6668
}
6769
}

‎src/EffectComposer.test.tsx‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react'
22
import * as THREE from 'three'
3-
import { vi, describe, it, expect } from 'vitest'
4-
import { extend, createRoot, act } from '@react-three/fiber'
3+
import { describe, it, expect } from 'vitest'
4+
import { extend, createRoot } from '@react-three/fiber'
55
import { EffectComposer } from './EffectComposer'
66
import { EffectComposer as EffectComposerImpl, RenderPass, Pass, Effect, EffectPass } from 'postprocessing'
77

@@ -57,7 +57,7 @@ describe('EffectComposer', () => {
5757
const passB = new Pass()
5858

5959
// Forward order
60-
await act(async () =>
60+
await React.act(async () =>
6161
root.render(
6262
<EffectComposer ref={composerRef}>
6363
{/* EffectPass(effectA, effectB) */}
@@ -87,10 +87,10 @@ describe('EffectComposer', () => {
8787
expect(composerRef.current!.passes[4]).toBe(passB)
8888

8989
// NOTE: instance children ordering is unstable until R3F v9, so we remount from scratch
90-
await act(async () => root.render(null))
90+
await React.act(async () => root.render(null))
9191

9292
// Reverse order
93-
await act(async () =>
93+
await React.act(async () =>
9494
root.render(
9595
<EffectComposer ref={composerRef}>
9696
{/* PassB */}
@@ -121,6 +121,6 @@ describe('EffectComposer', () => {
121121
})
122122

123123
it.skip('should split convolution effects', async () => {
124-
await act(async () => root.render(null))
124+
await React.act(async () => root.render(null))
125125
})
126126
})

‎tsconfig.json‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
{
22
"compilerOptions": {
3+
"target": "ES6",
4+
"module": "ESNext",
35
"outDir": "dist",
4-
"target": "esnext",
5-
"module": "esnext",
6-
"lib": ["esnext", "dom"],
6+
"rootDir": "src",
7+
"lib": ["ESNext", "DOM"],
78
"moduleResolution": "bundler",
89
"strict": true,
910
"jsx": "react-jsx",
1011
"pretty": true,
1112
"declaration": true,
1213
"emitDeclarationOnly": true,
14+
"skipLibCheck": true,
1315
"forceConsistentCasingInFileNames": true,
1416
"paths": {
1517
"@react-three/postprocessing": ["./src"]
1618
}
1719
},
1820
"include": ["src/**/*"],
1921
"exclude": ["src/**/*.test.*"]
20-
}
22+
}

0 commit comments

Comments
 (0)