react-router-pagination 3.2.244 → 3.2.245

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,261 @@
1
+ import globals from 'globals'
2
+ import standard from '@sequencemedia/eslint-config-standard/configs/recommended/merge'
3
+ import typescript from '@sequencemedia/eslint-config-typescript/configs/recommended/merge'
4
+ import babelParser from '@babel/eslint-parser'
5
+ import typescriptParser from '@typescript-eslint/parser'
6
+ import reactPlugin from 'eslint-plugin-react'
7
+ import storybookPlugin from 'eslint-plugin-storybook'
8
+
9
+ const reactParserOptions = {
10
+ ecmaFeatures: {
11
+ jsx: true
12
+ }
13
+ }
14
+
15
+ const reactPlugins = {
16
+ react: reactPlugin
17
+ }
18
+
19
+ const storybookPlugins = {
20
+ storybook: storybookPlugin
21
+ }
22
+
23
+ const reactRules = {
24
+ 'no-unused-vars': [
25
+ 'error',
26
+ {
27
+ varsIgnorePattern: 'React'
28
+ }
29
+ ],
30
+ quotes: [
31
+ 'error',
32
+ 'single'
33
+ ],
34
+ 'jsx-quotes': [
35
+ 'error',
36
+ 'prefer-single'
37
+ ],
38
+ 'react/jsx-indent': [
39
+ 'error',
40
+ 2,
41
+ {
42
+ checkAttributes: true,
43
+ indentLogicalExpressions: true
44
+ }
45
+ ]
46
+ }
47
+
48
+ const reactSettings = {
49
+ react: {
50
+ version: 'detect'
51
+ }
52
+ }
53
+
54
+ export default [
55
+ {
56
+ ignores: [
57
+ '.coverage'
58
+ ]
59
+ },
60
+ /**
61
+ * React config for all `jsx` and `tsx` files
62
+ */
63
+ {
64
+ ...reactPlugin.configs.flat.recommended,
65
+ settings: {
66
+ ...reactPlugin.configs.flat.recommended.settings,
67
+ ...reactSettings
68
+ }
69
+ },
70
+ /**
71
+ * Storybook config
72
+ */
73
+ ...storybookPlugin.configs['flat/recommended'],
74
+ /**
75
+ * Standard config
76
+ */
77
+ standard({
78
+ files: [
79
+ '**/*.{mjs,cjs,mts,cts}'
80
+ ],
81
+ ignores: [
82
+ 'src',
83
+ 'stories'
84
+ ],
85
+ languageOptions: {
86
+ globals: {
87
+ ...globals.node
88
+ }
89
+ }
90
+ }),
91
+ standard({
92
+ files: [
93
+ 'src/**/*.{mjs,cjs,mts,cts}',
94
+ 'stories/**/*.{mjs,cjs,mts,cts}'
95
+ ],
96
+ languageOptions: {
97
+ globals: {
98
+ ...globals.browser
99
+ }
100
+ }
101
+ }),
102
+ /**
103
+ * Standard config for all `jsx` and `tsx` files
104
+ */
105
+ standard({
106
+ files: [
107
+ 'src/**/*.{mts,tsx}',
108
+ 'stories/**/*.{mjs,jsx}'
109
+ ],
110
+ ignores: [
111
+ 'src/__tests__/**/*.{mts,tsx}',
112
+ 'stories/**/__tests__/**/*.{mjs,jsx}'
113
+ ],
114
+ languageOptions: {
115
+ parser: babelParser,
116
+ parserOptions: {
117
+ ...reactParserOptions,
118
+ project: null
119
+ },
120
+ globals: {
121
+ ...globals.browser
122
+ }
123
+ },
124
+ plugins: {
125
+ ...reactPlugins,
126
+ ...storybookPlugins
127
+ },
128
+ rules: {
129
+ ...reactRules
130
+ },
131
+ settings: {
132
+ ...reactSettings,
133
+ 'import/resolver': {
134
+ 'babel-module': {}
135
+ }
136
+ }
137
+ }),
138
+ standard({
139
+ files: [
140
+ 'src/**/__tests__/**/*.{mts,tsx}',
141
+ 'stories/**/__tests__/**/*.{mjs,jsx}'
142
+ ],
143
+ languageOptions: {
144
+ parser: babelParser,
145
+ parserOptions: {
146
+ ...reactParserOptions,
147
+ project: null
148
+ },
149
+ globals: {
150
+ ...globals.browser,
151
+ ...globals.jest
152
+ }
153
+ },
154
+ plugins: {
155
+ ...reactPlugins,
156
+ ...storybookPlugins
157
+ },
158
+ rules: {
159
+ ...reactRules
160
+ },
161
+ settings: {
162
+ ...reactSettings,
163
+ 'import/resolver': {
164
+ 'babel-module': {}
165
+ }
166
+ }
167
+ }),
168
+ /**
169
+ * TypeScript config
170
+ */
171
+ typescript({
172
+ files: [
173
+ '**/*.{mts,cts}'
174
+ ],
175
+ ignores: [
176
+ 'src',
177
+ 'stories'
178
+ ],
179
+ languageOptions: {
180
+ globals: {
181
+ ...globals.node,
182
+ CogsTypes: 'readonly'
183
+ }
184
+ }
185
+ }),
186
+ typescript({
187
+ files: [
188
+ 'src/**/*.{mts,cts}'
189
+ ],
190
+ languageOptions: {
191
+ globals: {
192
+ ...globals.browser
193
+ }
194
+ }
195
+ }),
196
+ /**
197
+ * TypeScript config for only `tsx` files
198
+ */
199
+ typescript({
200
+ files: [
201
+ 'src/**/*.{mts,tsx}'
202
+ ],
203
+ ignores: [
204
+ 'src/**/__tests__/**/*.{mts,tsx}'
205
+ ],
206
+ languageOptions: {
207
+ parser: typescriptParser,
208
+ parserOptions: {
209
+ ...reactParserOptions,
210
+ projectService: true,
211
+ project: 'tsconfig.json'
212
+ },
213
+ globals: {
214
+ ...globals.browser
215
+ }
216
+ },
217
+ plugins: {
218
+ ...reactPlugins
219
+ },
220
+ rules: {
221
+ ...reactRules,
222
+ '@typescript-eslint/no-magic-numbers': 'off',
223
+ '@typescript-eslint/prefer-destructuring': 'off',
224
+ '@typescript-eslint/class-methods-use-this': 'off',
225
+ '@typescript-eslint/no-empty-function': 'off'
226
+ },
227
+ settings: {
228
+ ...reactSettings
229
+ }
230
+ }),
231
+ typescript({
232
+ files: [
233
+ 'src/**/__tests__/**/*.{mts,tsx}'
234
+ ],
235
+ languageOptions: {
236
+ parser: typescriptParser,
237
+ parserOptions: {
238
+ ...reactParserOptions,
239
+ projectService: true,
240
+ project: 'tsconfig.json'
241
+ },
242
+ globals: {
243
+ ...globals.browser,
244
+ ...globals.jest
245
+ }
246
+ },
247
+ plugins: {
248
+ ...reactPlugins
249
+ },
250
+ rules: {
251
+ ...reactRules,
252
+ '@typescript-eslint/no-magic-numbers': 'off',
253
+ '@typescript-eslint/prefer-destructuring': 'off',
254
+ '@typescript-eslint/class-methods-use-this': 'off',
255
+ '@typescript-eslint/no-empty-function': 'off'
256
+ },
257
+ settings: {
258
+ ...reactSettings
259
+ }
260
+ })
261
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-router-pagination",
3
- "version": "3.2.244",
3
+ "version": "3.2.245",
4
4
  "description": "A React Router Pagination component",
5
5
  "main": "./src/index.mjs",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "scripts": {
22
22
  "build-storybook": "storybook build",
23
- "lint": "eslint . .storybook --ext .mjs,.cjs,.jsx,.mts,.cts,.tsx",
23
+ "lint": "eslint",
24
24
  "lint:fix": "npm run lint -- --fix",
25
25
  "prepare": "husky",
26
26
  "storybook": "storybook dev -p 6006",
@@ -39,6 +39,8 @@
39
39
  "@babel/preset-typescript": "^7.26.0",
40
40
  "@babel/register": "^7.25.9",
41
41
  "@chromatic-com/storybook": "^3.2.3",
42
+ "@sequencemedia/eslint-config-standard": "^0.2.12",
43
+ "@sequencemedia/eslint-config-typescript": "^0.1.17",
42
44
  "@storybook/addon-essentials": "^8.4.7",
43
45
  "@storybook/addon-links": "^8.4.7",
44
46
  "@storybook/addon-webpack5-compiler-babel": "^3.0.5",
@@ -48,19 +50,20 @@
48
50
  "@storybook/theming": "^8.4.7",
49
51
  "@types/debug": "^4.1.12",
50
52
  "@types/jest": "^29.5.14",
51
- "@types/react": "18.3.1",
53
+ "@types/react": "^19.0.5",
52
54
  "@types/react-router": "^5.1.20",
53
55
  "@types/react-router-dom": "^5.3.3",
54
56
  "@types/react-test-renderer": "18.3.1",
55
- "@typescript-eslint/eslint-plugin": "7.18.0",
56
- "@typescript-eslint/parser": "7.18.0",
57
+ "@typescript-eslint/eslint-plugin": "^8.19.1",
58
+ "@typescript-eslint/parser": "^8.19.1",
59
+ "babel-plugin-module-resolver": "^5.0.2",
57
60
  "core-js": "^3.40.0",
58
61
  "cross-env": "^7.0.3",
59
- "eslint": "8.57.1",
60
- "eslint-config-love": "47.0.0",
61
- "eslint-config-standard": "^17.1.0",
62
+ "eslint": "^9.18.0",
63
+ "eslint-import-resolver-babel-module": "^5.3.2",
62
64
  "eslint-plugin-react": "^7.37.3",
63
65
  "eslint-plugin-storybook": "^0.11.2",
66
+ "globals": "^15.14.0",
64
67
  "husky": "^9.1.7",
65
68
  "jest": "^29.7.0",
66
69
  "prop-types": "^15.8.1",
@@ -24,7 +24,7 @@ export class Centered extends AbstractPagination<CenteredProps, CenteredState> {
24
24
  static defaultProps = {
25
25
  ...AbstractPagination.defaultProps,
26
26
  spread: 3,
27
- onChange () {}
27
+ onChange ():void {}
28
28
  }
29
29
 
30
30
  state = {
@@ -81,7 +81,7 @@ export class Centered extends AbstractPagination<CenteredProps, CenteredState> {
81
81
  return super.shouldComponentUpdate(props) || (props.spread !== this.props.spread)
82
82
  }
83
83
 
84
- handlePageNumberSelect = (pageNumber: number): any => {
84
+ handlePageNumberSelect = (pageNumber: number): void => {
85
85
  const { onClick } = this.props
86
86
 
87
87
  try {
@@ -39,7 +39,7 @@ type AbstractPaginationProps = ReactRouterPaginationTypes.AbstractPaginationProp
39
39
 
40
40
  type AbstractPaginationState = ReactRouterPaginationTypes.AbstractPaginationState
41
41
 
42
- export default abstract class AbstractPagination<P, S> extends Component<P & AbstractPaginationProps, S & AbstractPaginationState> {
42
+ export default abstract class AbstractPagination<P, S> extends Component<P & AbstractPaginationProps, S & AbstractPaginationState> { // eslint-disable-line @typescript-eslint/no-unnecessary-type-parameters -- Base
43
43
  static defaultProps = {
44
44
  onClick () {},
45
45
  pageNumber: 0,
@@ -63,11 +63,11 @@ export default abstract class AbstractPagination<P, S> extends Component<P & Abs
63
63
  return 0
64
64
  }
65
65
 
66
- zeroIndex (pageNumber: string | number, totalPages: string | number): number {
66
+ zeroIndex (pageNumber: string | number, totalPages: string | number): number { // eslint-disable-line no-unused-vars -- Base
67
67
  return 0
68
68
  }
69
69
 
70
- lastIndex (pageNumber: string | number, totalPages: string | number): number {
70
+ lastIndex (pageNumber: string | number, totalPages: string | number): number { // eslint-disable-line no-unused-vars -- Base
71
71
  return 0
72
72
  }
73
73
 
@@ -98,7 +98,7 @@ export default abstract class AbstractPagination<P, S> extends Component<P & Abs
98
98
  const n = this.zeroIndex(pageNumber, totalPages)
99
99
  return (
100
100
  <li key={getListItemKey('reverse')} className='reverse-page'>
101
- <Link to={getLinkTo(match, n)} onClick={() => this.handlePageNumberSelect(n)}>
101
+ <Link to={getLinkTo(match, n)} onClick={() => { this.handlePageNumberSelect(n) }}>
102
102
  <span className='reverse'>
103
103
  {'\u2039'}
104
104
  </span>
@@ -114,7 +114,7 @@ export default abstract class AbstractPagination<P, S> extends Component<P & Abs
114
114
  const n = this.lastIndex(pageNumber, totalPages) + 1
115
115
  return (
116
116
  <li key={getListItemKey('forward')} className='forward-page'>
117
- <Link to={getLinkTo(match, n)} onClick={() => this.handlePageNumberSelect(n)}>
117
+ <Link to={getLinkTo(match, n)} onClick={() => { this.handlePageNumberSelect(n) }}>
118
118
  <span className='forward'>
119
119
  {'\u203A'}
120
120
  </span>
@@ -130,7 +130,7 @@ export default abstract class AbstractPagination<P, S> extends Component<P & Abs
130
130
  const n = 1
131
131
  return (
132
132
  <li key={getListItemKey(n)} className='zero-page'>
133
- <Link to={getLinkTo(match, n)} onClick={() => this.handlePageNumberSelect(n)}>
133
+ <Link to={getLinkTo(match, n)} onClick={() => { this.handlePageNumberSelect(n) }}>
134
134
  <span className='page-number'>
135
135
  {n}
136
136
  </span>
@@ -146,7 +146,7 @@ export default abstract class AbstractPagination<P, S> extends Component<P & Abs
146
146
  const n = toInteger(totalPages)
147
147
  return (
148
148
  <li key={getListItemKey(n)} className='last-page'>
149
- <Link to={getLinkTo(match, n)} onClick={() => this.handlePageNumberSelect(n)}>
149
+ <Link to={getLinkTo(match, n)} onClick={() => { this.handlePageNumberSelect(n) }}>
150
150
  <span className='page-number'>
151
151
  {n}
152
152
  </span>
@@ -165,7 +165,7 @@ export default abstract class AbstractPagination<P, S> extends Component<P & Abs
165
165
  const n = (i + 1)
166
166
  a.push((
167
167
  <li key={getListItemKey(n)} className={getListItemClassName(pageNumber, n)}>
168
- <Link to={getLinkTo(match, n)} onClick={() => this.handlePageNumberSelect(n)}>
168
+ <Link to={getLinkTo(match, n)} onClick={() => { this.handlePageNumberSelect(n) }}>
169
169
  <span className='page-number'>
170
170
  {n}
171
171
  </span>
@@ -191,7 +191,7 @@ export default abstract class AbstractPagination<P, S> extends Component<P & Abs
191
191
  )
192
192
  }
193
193
 
194
- handlePageNumberSelect = (pageNumber: number): any => {
194
+ handlePageNumberSelect = (pageNumber: number): void => {
195
195
  this.props.onClick(pageNumber)
196
196
  }
197
197
 
@@ -64,7 +64,7 @@ export class Standard extends AbstractPagination<StandardProps, StandardState> {
64
64
  return super.shouldComponentUpdate(props) || (props.spread !== this.props.spread)
65
65
  }
66
66
 
67
- handlePageNumberSelect = (pageNumber: number): any => {
67
+ handlePageNumberSelect = (pageNumber: number): void => {
68
68
  const { onClick } = this.props
69
69
 
70
70
  try {