Skip to content

Commit 9c70029

Browse files
committed
chore: eslint v9 compat
1 parent 30ad060 commit 9c70029

File tree

17 files changed

+398
-227
lines changed

17 files changed

+398
-227
lines changed

.eslintignore

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

.eslintrc.js

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

eslint.config.mjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import tseslint from 'typescript-eslint';
2+
import pooolint from '@poool/eslint-config-react';
3+
import globals from 'globals';
4+
5+
export default tseslint.config(
6+
{ ignores: [
7+
'dist',
8+
'**/dist',
9+
'coverage',
10+
'.yarn',
11+
'node_modules',
12+
'examples/next/.next/**',
13+
] },
14+
{
15+
languageOptions: {
16+
globals: {
17+
...globals.browser,
18+
globalThis: 'readonly',
19+
},
20+
parserOptions: {
21+
projectService: true,
22+
tsconfigRootDir: import.meta.dirname,
23+
},
24+
},
25+
},
26+
...pooolint.configs.recommended,
27+
);

examples/basic/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
useLocation,
1616
} from 'react-router-dom';
1717
import {
18+
type RestrictedContentRef,
1819
AccessContext,
1920
Paywall,
2021
Pixel,
@@ -24,7 +25,7 @@ import {
2425
} from '@poool/react-access';
2526

2627
const Premium = () => {
27-
const contentRef = useRef();
28+
const contentRef = useRef<RestrictedContentRef>(null);
2829
const [identity, setIdentity] = useState(null);
2930
const [ready, setReady] = useState(null);
3031
const [mounted, setMounted] = useState(0);
@@ -33,7 +34,7 @@ const Premium = () => {
3334
<div className="app">
3435
<RestrictedContent ref={contentRef}>
3536
<div className="articleBody">
36-
{ /* eslint-disable max-len */ }
37+
{ /* eslint-disable @stylistic/js/max-len,@stylistic/js/indent */ }
3738
<p>
3839
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam tortor leo, sollicitudin quis posuere sed, pharetra cursus mauris. Donec ultricies nibh sit amet quam feugiat, vel bibendum nisl pellentesque. In hac habitasse platea dictumst. Sed varius eget ante ac pulvinar. Suspendisse fringilla, quam ac imperdiet consequat, leo massa molestie mi, eget condimentum ligula enim ut mauris. Aliquam egestas malesuada vestibulum. Etiam ut nibh turpis. Fusce mattis blandit bibendum. Vestibulum sodales laoreet lacus ut sollicitudin. Donec tempus iaculis viverra. In congue felis quis sem porta iaculis.
3940
</p>
@@ -79,7 +80,7 @@ const Premium = () => {
7980
<p>
8081
Ut condimentum justo nec sapien convallis dictum. Pellentesque tempus rhoncus justo quis feugiat. Curabitur in sagittis elit. Nunc justo ligula, mattis ac tortor ut, interdum hendrerit risus. Aenean purus urna, pretium eu purus sit amet, suscipit ornare velit. Phasellus ut euismod nulla, nec tincidunt ex. Aliquam mattis nulla neque, ac dapibus magna fermentum eget. Nulla facilisis viverra odio ac viverra. Mauris cursus velit ex, quis pulvinar elit porttitor non. Vivamus consectetur leo at enim luctus, at convallis mi dapibus. Ut mauris neque, efficitur eu ante ac, scelerisque cursus tortor. Sed sed dolor sit amet velit finibus sodales. Duis tempor felis a sollicitudin pretium. Vestibulum ante eros, egestas a dapibus sit amet, suscipit ut ipsum.
8182
</p>
82-
{ /* eslint-enable max-len */ }
83+
{ /* eslint-enable @stylistic/js/max-len,@stylistic/js/indent */ }
8384
</div>
8485
</RestrictedContent>
8586

@@ -113,7 +114,7 @@ const Premium = () => {
113114
};
114115

115116
const Consent = () => {
116-
const contentRef = useRef();
117+
const contentRef = useRef<RestrictedContentRef>(null);
117118
const { setEnabled } = useContext(AppContext);
118119
const [ready, setReady] = useState(null);
119120
const [mounted, setMounted] = useState(0);

examples/next/app/premium/page.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
'use client';
22

33
import { useRef } from 'react';
4-
import { Pixel, Paywall, RestrictedContent } from '@poool/react-access';
4+
import {
5+
type RestrictedContentRef,
6+
Pixel,
7+
Paywall,
8+
RestrictedContent,
9+
} from '@poool/react-access';
510
import Link from 'next/link';
611

712
const Premium = () => {
8-
const contentRef = useRef();
13+
const contentRef = useRef<RestrictedContentRef>(null);
914

1015
return (
1116
<div className="app">
1217
<RestrictedContent ref={contentRef}>
1318
<div className="articleBody">
14-
{ /* eslint-disable max-len */ }
19+
{ /* eslint-disable @stylistic/js/max-len,@stylistic/js/indent */ }
1520
<p>
1621
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam tortor leo, sollicitudin quis posuere sed, pharetra cursus mauris. Donec ultricies nibh sit amet quam feugiat, vel bibendum nisl pellentesque. In hac habitasse platea dictumst. Sed varius eget ante ac pulvinar. Suspendisse fringilla, quam ac imperdiet consequat, leo massa molestie mi, eget condimentum ligula enim ut mauris. Aliquam egestas malesuada vestibulum. Etiam ut nibh turpis. Fusce mattis blandit bibendum. Vestibulum sodales laoreet lacus ut sollicitudin. Donec tempus iaculis viverra. In congue felis quis sem porta iaculis.
1722
</p>
@@ -57,7 +62,7 @@ const Premium = () => {
5762
<p>
5863
Ut condimentum justo nec sapien convallis dictum. Pellentesque tempus rhoncus justo quis feugiat. Curabitur in sagittis elit. Nunc justo ligula, mattis ac tortor ut, interdum hendrerit risus. Aenean purus urna, pretium eu purus sit amet, suscipit ornare velit. Phasellus ut euismod nulla, nec tincidunt ex. Aliquam mattis nulla neque, ac dapibus magna fermentum eget. Nulla facilisis viverra odio ac viverra. Mauris cursus velit ex, quis pulvinar elit porttitor non. Vivamus consectetur leo at enim luctus, at convallis mi dapibus. Ut mauris neque, efficitur eu ante ac, scelerisque cursus tortor. Sed sed dolor sit amet velit finibus sodales. Duis tempor felis a sollicitudin pretium. Vestibulum ante eros, egestas a dapibus sit amet, suscipit ut ipsum.
5964
</p>
60-
{ /* eslint-enable max-len */ }
65+
{ /* eslint-enable @stylistic/js/max-len,@stylistic/js/indent */ }
6166
</div>
6267
</RestrictedContent>
6368

examples/next/next-env.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript
6+
// for more information.

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,30 @@
2020
],
2121
"devDependencies": {
2222
"@babel/eslint-plugin": "7.25.9",
23-
"@poool/eslint-config": "3.0.1",
24-
"@poool/eslint-config-react": "3.0.1",
23+
"@poool/eslint-config": "4.1.0",
24+
"@poool/eslint-config-react": "4.1.1",
2525
"@poool/eslint-plugin": "3.0.0",
2626
"@swc/core": "1.12.14",
2727
"@swc/jest": "0.2.39",
2828
"@testing-library/dom": "10.4.0",
2929
"@testing-library/react": "16.3.0",
3030
"@types/jest": "30.0.0",
31-
"@types/node": "22.10.1",
31+
"@types/node": "24.0.14",
3232
"@types/react": "19.1.8",
3333
"@types/react-dom": "19.1.6",
3434
"@types/webpack": "5.28.5",
3535
"@types/webpack-dev-server": "4.7.2",
3636
"@typescript-eslint/eslint-plugin": "8.37.0",
3737
"@typescript-eslint/parser": "8.37.0",
3838
"commit-and-tag-version": "12.5.1",
39-
"eslint": "8.57.1",
39+
"eslint": "9.31.0",
4040
"eslint-config-standard": "17.1.0",
4141
"eslint-plugin-babel": "5.3.1",
4242
"eslint-plugin-import": "2.32.0",
4343
"eslint-plugin-n": "17.21.0",
4444
"eslint-plugin-promise": "7.2.1",
4545
"eslint-plugin-react": "7.37.5",
46+
"eslint-plugin-react-hooks": "^5.2.0",
4647
"html-webpack-plugin": "5.6.3",
4748
"jest": "30.0.4",
4849
"jest-dev-server": "11.0.0",
@@ -55,6 +56,7 @@
5556
"ts-node": "10.9.2",
5657
"tsup": "8.5.0",
5758
"typescript": "5.8.3",
59+
"typescript-eslint": "^8.37.0",
5860
"webpack": "5.100.2",
5961
"webpack-cli": "6.0.1",
6062
"webpack-dev-server": "5.2.2"
@@ -69,7 +71,7 @@
6971
"build:types": "tsc --project ./tsconfig.build.json",
7072
"prepack": "yarn build && yarn lint && yarn tsc && yarn test",
7173
"test": "NODE_ENV='test' jest",
72-
"lint": "eslint --max-warnings=0 .",
74+
"lint": "eslint --max-warnings=0 --cache .",
7375
"release": "commit-and-tag-version && git push --follow-tags",
7476
"example:basic": "yarn workspace poool-react-access-basic-example serve",
7577
"example:next": "yarn workspace poool-react-access-next-example dev"

src/AccessContext/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ const AccessContext = ({
5656

5757
useEffect(() => {
5858
init();
59+
// eslint-disable-next-line react-hooks/exhaustive-deps
5960
}, []);
6061

6162
const init = async () => {
6263
if (
63-
(!globalThis.Access || !globalThis.Access.isPoool) &&
64-
(!globalThis.PooolAccess || !globalThis.PooolAccess.isPoool)
64+
(!globalThis.Access?.isPoool) &&
65+
(!globalThis.PooolAccess?.isPoool)
6566
) {
6667
await loadScript(scriptUrl, 'poool-react-access-lib', {
6768
timeout: scriptLoadTimeout,
@@ -134,6 +135,7 @@ const AccessContext = ({
134135
lib: state.lib,
135136
createFactory,
136137
destroyFactory,
138+
// eslint-disable-next-line react-hooks/exhaustive-deps
137139
}), [state.lib, config?.cookies_enabled]);
138140

139141
const content = (

src/AuditContext/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ const AuditContext = ({
4747
return () => {
4848
deinit();
4949
};
50+
// eslint-disable-next-line react-hooks/exhaustive-deps
5051
}, [config?.cookies_enabled]);
5152

5253
const init = async () => {
5354
if (
54-
(!globalThis.Audit || !globalThis.Audit.isPoool) &&
55-
(!globalThis.PooolAudit || !globalThis.PooolAudit.isPoool)
55+
(!globalThis.Audit?.isPoool) &&
56+
(!globalThis.PooolAudit?.isPoool)
5657
) {
5758
await loadScript(scriptUrl, 'poool-react-audit-lib', {
5859
timeout: scriptLoadTimeout,
@@ -125,6 +126,7 @@ const AuditContext = ({
125126
events,
126127
scriptUrl,
127128
lib: state.lib,
129+
// eslint-disable-next-line react-hooks/exhaustive-deps
128130
}), [state.lib, config?.cookies_enabled]);
129131

130132
return (

src/Paywall/index.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import type { RefObject } from 'react';
44
import { render, waitFor } from '@testing-library/react';
55
import devServer from 'jest-dev-server';
66

7-
import type { RestrictedContentRef } from '../RestrictedContent';
87
import { withAccess, createBrowser, sleep } from '~/tests/utils';
8+
9+
import type { RestrictedContentRef } from '../RestrictedContent';
910
import Paywall from './index';
1011

1112
jest.setTimeout(30000);

0 commit comments

Comments
 (0)