@pplancq/react-template 1.9.1 → 2.0.1

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.
package/.env CHANGED
@@ -27,6 +27,12 @@
27
27
  # Default is false
28
28
  #DISABLE_ESLINT_PLUGIN=false
29
29
 
30
+ # Specify the type of configuration to use with ESLint.
31
+ # - 'eslintrc' is the classic configuration format available in most ESLint versions.
32
+ # - 'flat' is the new format introduced in ESLint 8.21.0.
33
+ # Default is 'eslintrc'
34
+ ESLINT_CONFIG_TYPE='flat'
35
+
30
36
  # Allows you to deactivate the sourcemap
31
37
  # Default is false
32
38
  #DISABLE_SOURCE_MAP=false
package/.lintstagedrc.js CHANGED
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
- '*.{js,jsx,ts,tsx}': 'eslint --fix',
2
+ '*.{js,jsx,mjs,ts,tsx}': 'eslint --fix',
3
3
  '*.{ts,tsx}': 'tsc-files --noEmit',
4
4
  '*.{scss,css}': 'stylelint --fix',
5
- '*.!(js|jsx|ts|tsx|scss|css)': 'prettier --write --ignore-unknown',
5
+ '*.!(js|jsx|mjs|ts|tsx|scss|css)': 'prettier --write --ignore-unknown',
6
6
  '(package|package-lock).json': 'npm run package:check',
7
7
  };
package/CHANGELOG.md CHANGED
@@ -1,3 +1,44 @@
1
+ ## @pplancq/react-template [2.0.1](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@2.0.0...@pplancq/react-template@2.0.1) (2024-11-11)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **deps:** update dependency react-router-dom to ^6.28.0 ([5b0ed65](https://github.com/pplancq/dev-tools/commit/5b0ed656f6fbe1fbcbcee4a33636841ebc16e646))
6
+ * **deps:** update react-query mono repo to ^5.59.20 ([f147aba](https://github.com/pplancq/dev-tools/commit/f147aba053a9921888639870ac5d47933a4054d6))
7
+
8
+
9
+ ### Dependencies
10
+
11
+ * **@pplancq/eslint-config:** upgraded to 4.0.1
12
+ * **@pplancq/postcss-config:** upgraded to 2.1.3
13
+ * **@pplancq/webpack-config:** upgraded to 1.6.1
14
+
15
+ ## @pplancq/react-template [2.0.0](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@1.9.1...@pplancq/react-template@2.0.0) (2024-11-08)
16
+
17
+ ### ⚠ BREAKING CHANGES
18
+
19
+ * **eslint-config:** this version support only eslint v9 with new flat configuration.\ Please refer to the Migration Guide for detailed instructions: [Migration Guide](./MIGRATION.md#migration-guide-pplancqeslint-config-v3-to-v4)
20
+
21
+ ### Features
22
+
23
+ * **react-template:** set eslint flat config for eslint webpack plugin ([d7ef000](https://github.com/pplancq/dev-tools/commit/d7ef00091c0f03d4f3a4dfc69d626f6e230ab55e))
24
+ * **eslint-config:** update eslint v8 to v9 ([5cf5721](https://github.com/pplancq/dev-tools/commit/5cf57215c74172fd0f611c8425522d927752026e))
25
+ * **react-template:** use eslint flat config ([a145c2a](https://github.com/pplancq/dev-tools/commit/a145c2a7690b8c6fb9f0f8e2765d1fb02c0fd6c0))
26
+
27
+ ### Bug Fixes
28
+
29
+ * **deps:** update dependency @hookform/resolvers to ^3.9.1 ([a881b6a](https://github.com/pplancq/dev-tools/commit/a881b6a07fe9835318939e44d89f76053027876d))
30
+ * **deps:** update dependency react-hook-form to ^7.53.1 ([98fe84f](https://github.com/pplancq/dev-tools/commit/98fe84f9742f9fa43050fe81c53b5675e6912a83))
31
+ * **deps:** update dependency react-router-dom to ^6.27.0 ([ecb8b37](https://github.com/pplancq/dev-tools/commit/ecb8b372d060bd17f64f2366608dc1aea4b57721))
32
+ * **deps:** update react-query mono repo to ^5.59.15 ([47bf3b4](https://github.com/pplancq/dev-tools/commit/47bf3b42b54e5018dff960ed6171b736c1738fe8))
33
+
34
+
35
+ ### Dependencies
36
+
37
+ * **@pplancq/babel-config:** upgraded to 1.1.2
38
+ * **@pplancq/eslint-config:** upgraded to 4.0.0
39
+ * **@pplancq/postcss-config:** upgraded to 2.1.2
40
+ * **@pplancq/webpack-config:** upgraded to 1.6.0
41
+
1
42
  ## @pplancq/react-template [1.9.1](https://github.com/pplancq/dev-tools/compare/@pplancq/react-template@1.9.0...@pplancq/react-template@1.9.1) (2024-10-15)
2
43
 
3
44
  ### Bug Fixes
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from '@pplancq/eslint-config';
2
+
3
+ export default defineConfig({
4
+ enableReact: true,
5
+ enablePrettier: 'on',
6
+ enableVitest: true,
7
+ extendConfig: [
8
+ {
9
+ files: ['mocks/**/*'],
10
+ rules: {
11
+ 'import/no-extraneous-dependencies': 'off',
12
+ },
13
+ },
14
+ ],
15
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pplancq/react-template",
3
- "version": "1.9.1",
3
+ "version": "2.0.1",
4
4
  "license": "MIT",
5
5
  "description": "react template",
6
6
  "author": "pplancq <paul.plancq@outlook.fr>",
@@ -16,12 +16,12 @@
16
16
  "test": "vitest run",
17
17
  "test:watch": "vitest",
18
18
  "lint": "node scripts/lint.js",
19
- "lint:eslint": "eslint \"{mocks,public,src}/**/*.{js,jsx,ts,tsx}\"",
20
- "lint:eslint:fix": "eslint \"{mocks,public,src}/**/*.{js,jsx,ts,tsx}\" --fix",
19
+ "lint:eslint": "eslint \"{mocks,public,src}/**/*.{js,jsx,mjs,ts,tsx}\"",
20
+ "lint:eslint:fix": "eslint \"{mocks,public,src}/**/*.{js,jsx,mjs,ts,tsx}\" --fix",
21
21
  "lint:stylelint": "stylelint \"src/**/*.{scss,css}\"",
22
22
  "lint:stylelint:fix": "stylelint \"src/**/*.{scss,css}\" --fix",
23
- "lint:prettier": "prettier \"{mocks,public,src}/**/*.!(js|jsx|ts|tsx|scss|css)\" --check --ignore-unknown",
24
- "lint:prettier:fix": "prettier \"{mocks,public,src}/**/*.!(js|jsx|ts|tsx|scss|css)\" --write --ignore-unknown",
23
+ "lint:prettier": "prettier \"{mocks,public,src}/**/*.!(js|jsx|mjs|ts|tsx|scss|css)\" --check --ignore-unknown",
24
+ "lint:prettier:fix": "prettier \"{mocks,public,src}/**/*.!(js|jsx|mjs|ts|tsx|scss|css)\" --write --ignore-unknown",
25
25
  "lint:tsc": "tsc --noEmit",
26
26
  "package:check": "npm exec --yes package-lock-utd@1.1.3",
27
27
  "remove:demo": "node ./scripts/removeDemo.js",
@@ -36,13 +36,13 @@
36
36
  "template"
37
37
  ],
38
38
  "dependencies": {
39
- "@hookform/resolvers": "^3.9.0",
40
- "@tanstack/react-query": "^5.59.9",
41
- "@tanstack/react-query-devtools": "^5.59.9",
39
+ "@hookform/resolvers": "^3.9.1",
40
+ "@tanstack/react-query": "^5.59.20",
41
+ "@tanstack/react-query-devtools": "^5.59.20",
42
42
  "react": "^18.3.1",
43
43
  "react-dom": "^18.3.1",
44
- "react-hook-form": "^7.53.0",
45
- "react-router-dom": "^6.26.2",
44
+ "react-hook-form": "^7.53.1",
45
+ "react-router-dom": "^6.28.0",
46
46
  "yup": "^1.4.0"
47
47
  },
48
48
  "devDependencies": {
@@ -54,31 +54,31 @@
54
54
  "@pplancq/prettier-config": "*",
55
55
  "@pplancq/stylelint-config": "*",
56
56
  "@pplancq/webpack-config": "*",
57
- "@testing-library/jest-dom": "^6.5.0",
57
+ "@testing-library/jest-dom": "^6.6.3",
58
58
  "@testing-library/react": "^16.0.1",
59
59
  "@testing-library/user-event": "^14.5.2",
60
- "@types/react": "^18.3.11",
61
- "@types/react-dom": "^18.3.0",
62
- "@vitejs/plugin-react": "^4.3.2",
63
- "@vitest/coverage-v8": "^2.1.2",
64
- "concurrently": "^9.0.1",
65
- "eslint": "^8.57.1",
60
+ "@types/react": "^18.3.12",
61
+ "@types/react-dom": "^18.3.1",
62
+ "@vitejs/plugin-react": "^4.3.3",
63
+ "@vitest/coverage-v8": "^2.1.4",
64
+ "concurrently": "^9.1.0",
65
+ "eslint": "^9.14.0",
66
66
  "eslint-plugin-prettier": "^5.2.1",
67
67
  "husky": "^9.1.6",
68
68
  "jsdom": "^25.0.1",
69
69
  "lint-staged": "^15.2.10",
70
- "msw": "^2.4.9",
70
+ "msw": "^2.6.2",
71
71
  "prettier": "^3.3.3",
72
- "stylelint": "^16.9.0",
72
+ "stylelint": "^16.10.0",
73
73
  "stylelint-prettier": "^5.0.2",
74
74
  "tsc-files": "^1.1.4",
75
75
  "typescript": "^5.6.3",
76
- "vite-plugin-svgr": "^4.2.0",
77
- "vite-tsconfig-paths": "^5.0.1",
78
- "vitest": "^2.1.2",
76
+ "vite-plugin-svgr": "^4.3.0",
77
+ "vite-tsconfig-paths": "^5.1.0",
78
+ "vitest": "^2.1.4",
79
79
  "vitest-axe": "^1.0.0-pre.3",
80
80
  "vitest-sonar-reporter": "^2.0.0",
81
- "webpack": "^5.95.0",
81
+ "webpack": "^5.96.1",
82
82
  "webpack-cli": "^5.1.4",
83
83
  "webpack-dev-server": "^5.1.0"
84
84
  },
@@ -86,7 +86,7 @@
86
86
  "node": ">=20.12.2"
87
87
  },
88
88
  "volta": {
89
- "node": "20.18.0",
89
+ "node": "22.11.0",
90
90
  "npm": "10.9.0"
91
91
  },
92
92
  "browserslist": {
@@ -8,8 +8,8 @@
8
8
  * - Please do NOT serve this file on production.
9
9
  */
10
10
 
11
- const PACKAGE_VERSION = '2.3.1'
12
- const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
11
+ const PACKAGE_VERSION = '2.6.4'
12
+ const INTEGRITY_CHECKSUM = 'ca7800994cc8bfb5eb961e037c877074'
13
13
  const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
14
14
  const activeClientIds = new Set()
15
15
 
@@ -62,7 +62,12 @@ self.addEventListener('message', async function (event) {
62
62
 
63
63
  sendToClient(client, {
64
64
  type: 'MOCKING_ENABLED',
65
- payload: true,
65
+ payload: {
66
+ client: {
67
+ id: client.id,
68
+ frameType: client.frameType,
69
+ },
70
+ },
66
71
  })
67
72
  break
68
73
  }
@@ -155,6 +160,10 @@ async function handleRequest(event, requestId) {
155
160
  async function resolveMainClient(event) {
156
161
  const client = await self.clients.get(event.clientId)
157
162
 
163
+ if (activeClientIds.has(event.clientId)) {
164
+ return client
165
+ }
166
+
158
167
  if (client?.frameType === 'top-level') {
159
168
  return client
160
169
  }
@@ -183,12 +192,14 @@ async function getResponse(event, client, requestId) {
183
192
  const requestClone = request.clone()
184
193
 
185
194
  function passthrough() {
186
- const headers = Object.fromEntries(requestClone.headers.entries())
187
-
188
- // Remove internal MSW request header so the passthrough request
189
- // complies with any potential CORS preflight checks on the server.
190
- // Some servers forbid unknown request headers.
191
- delete headers['x-msw-intention']
195
+ // Cast the request headers to a new Headers instance
196
+ // so the headers can be manipulated with.
197
+ const headers = new Headers(requestClone.headers)
198
+
199
+ // Remove the "accept" header value that marked this request as passthrough.
200
+ // This prevents request alteration and also keeps it compliant with the
201
+ // user-defined CORS policies.
202
+ headers.delete('accept', 'msw/passthrough')
192
203
 
193
204
  return fetch(requestClone, { headers })
194
205
  }
package/.eslintrc.js DELETED
@@ -1,11 +0,0 @@
1
- module.exports = {
2
- extends: ['@pplancq/eslint-config/react', '@pplancq/eslint-config/vitest', '@pplancq/eslint-config/prettier'],
3
- overrides: [
4
- {
5
- files: ['mocks/**/*'],
6
- rules: {
7
- 'import/no-extraneous-dependencies': 'off',
8
- },
9
- },
10
- ],
11
- };