@wistia/eslint-config 0.29.0 → 0.30.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"packageManager": "yarn@4.0.2",
|
|
5
5
|
"description": "Wistia's ESLint configurations",
|
|
6
6
|
"main": "react.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"./node": "./configs/eslint/node.cjs",
|
|
19
19
|
"./prettier": "./configs/eslint/prettier.cjs",
|
|
20
20
|
"./react": "./configs/eslint/react.cjs",
|
|
21
|
+
"./ssr-compatibility": "./configs/eslint/ssr-compatibility.cjs",
|
|
21
22
|
"./storybook": "./configs/eslint/storybook.cjs",
|
|
22
23
|
"./strict": "./configs/eslint/strict.cjs",
|
|
23
24
|
"./styled-components": "./configs/eslint/styled-components.cjs",
|
|
@@ -61,13 +62,16 @@
|
|
|
61
62
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
62
63
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
63
64
|
"eslint-plugin-no-snapshot-testing": "^1.0.61",
|
|
65
|
+
"eslint-plugin-no-typeof-window-undefined": "^0.0.2",
|
|
64
66
|
"eslint-plugin-node": "^11.1.0",
|
|
65
67
|
"eslint-plugin-observers": "^1.0.1",
|
|
66
68
|
"eslint-plugin-prettier": "^5.1.3",
|
|
67
69
|
"eslint-plugin-promise": "^6.1.1",
|
|
68
70
|
"eslint-plugin-react": "^7.33.2",
|
|
69
71
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
72
|
+
"eslint-plugin-react-hooks-ssr": "^0.1.5",
|
|
70
73
|
"eslint-plugin-sonarjs": "^0.23.0",
|
|
74
|
+
"eslint-plugin-ssr-friendly": "^1.3.0",
|
|
71
75
|
"eslint-plugin-storybook": "^0.6.15",
|
|
72
76
|
"eslint-plugin-styled-components-a11y": "^2.1.31",
|
|
73
77
|
"eslint-plugin-testing-library": "^6.2.0",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// only add rules related to maintaining SSR compatibility
|
|
2
|
+
// see:
|
|
3
|
+
// - https://github.com/kopiro/eslint-plugin-ssr-friendly
|
|
4
|
+
// - https://github.com/correttojs/eslint-plugin-react-hooks-ssr
|
|
5
|
+
// - https://github.com/nirtamir2/eslint-plugin-no-typeof-window-undefined
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
plugins: [
|
|
9
|
+
'eslint-plugin-ssr-friendly',
|
|
10
|
+
'eslint-plugin-react-hooks-ssr',
|
|
11
|
+
'eslint-plugin-no-typeof-window-undefined',
|
|
12
|
+
],
|
|
13
|
+
|
|
14
|
+
rules: {
|
|
15
|
+
// Disallow use of DOM globals in module and global scope, as this will break any import/require in a NodeJS environment.
|
|
16
|
+
// https://github.com/kopiro/eslint-plugin-ssr-friendly#no-dom-globals-in-module-scope
|
|
17
|
+
'ssr-friendly/no-dom-globals-in-module-scope': 'error',
|
|
18
|
+
|
|
19
|
+
// Disallow use of DOM globals in class constructors, as this will break SSR if you're instantiating this class as singleton or you're rendering this component.
|
|
20
|
+
// https://github.com/kopiro/eslint-plugin-ssr-friendly#no-dom-globals-in-constructor
|
|
21
|
+
'ssr-friendly/no-dom-globals-in-constructor': 'error',
|
|
22
|
+
|
|
23
|
+
// Disallow use of DOM globals in render() method of a React class-component, as this will break SSR if you're rendering this component.
|
|
24
|
+
// https://github.com/kopiro/eslint-plugin-ssr-friendly#no-dom-globals-in-react-cc-render
|
|
25
|
+
'ssr-friendly/no-dom-globals-in-react-cc-render': 'error',
|
|
26
|
+
|
|
27
|
+
// Disallow use of DOM globals in the render-cycle of a React FC, as this will break SSR if you're rendering this component.
|
|
28
|
+
// https://github.com/kopiro/eslint-plugin-ssr-friendly#no-dom-globals-in-react-fc
|
|
29
|
+
'ssr-friendly/no-dom-globals-in-react-fc': 'error',
|
|
30
|
+
|
|
31
|
+
// forbid DOM globals within react server side rendering
|
|
32
|
+
// a global within `useEffect` or custom hook is allowed
|
|
33
|
+
// a global within a function prefixed by `async` (eg. `asyncMyFunc`) is allowed
|
|
34
|
+
// a global within a `useState`, `useReducer` and `useMemo` callback is forbidden
|
|
35
|
+
// a global within a React `Component` is forbidden
|
|
36
|
+
'react-hooks-ssr/react-hooks-global-ssr': 'error',
|
|
37
|
+
|
|
38
|
+
// avoid checking for window since it is supported by Deno
|
|
39
|
+
// prefer `typeof document === "undefined"` instead
|
|
40
|
+
// https://github.com/nirtamir2/eslint-plugin-no-typeof-window-undefined#no-typeof-window-undefined
|
|
41
|
+
'no-typeof-window-undefined/no-typeof-window-undefined': 'error',
|
|
42
|
+
},
|
|
43
|
+
};
|