@wistia/eslint-config 2.5.2 → 2.7.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/.yarnrc.yml CHANGED
@@ -1,7 +1,12 @@
1
+ approvedGitRepositories:
2
+ - "**"
3
+
1
4
  enableGlobalCache: false
2
5
 
6
+ enableScripts: true
7
+
3
8
  nodeLinker: node-modules
4
9
 
5
- yarnPath: .yarn/releases/yarn-4.13.0.cjs
10
+ npmMinimalAgeGate: 7d
6
11
 
7
- npmMinimalAgeGate: '7d'
12
+ yarnPath: .yarn/releases/yarn-4.14.1.cjs
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @wistia/eslint-config
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#468](https://github.com/wistia/eslint-config/pull/468) [`9d23cc3`](https://github.com/wistia/eslint-config/commit/9d23cc3dbcdeea1454e5a13d851313f1106dc11c) Thanks [@okize](https://github.com/okize)! - feat: remove `react-ssr-compatibility` config & rules
8
+
9
+ ## 2.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#481](https://github.com/wistia/eslint-config/pull/481) [`a913ef5`](https://github.com/wistia/eslint-config/commit/a913ef59f542b8d43dabeabe251eb6fde0dccacc) Thanks [@okize](https://github.com/okize)! - feat: restore jest config & rules
14
+
3
15
  ## 2.5.2
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@wistia/eslint-config",
3
- "version": "2.5.2",
3
+ "version": "2.7.0",
4
4
  "description": "Wistia's ESLint configurations",
5
- "packageManager": "yarn@4.13.0",
5
+ "packageManager": "yarn@4.14.1",
6
6
  "type": "module",
7
7
  "main": "index.mjs",
8
8
  "engines": {
@@ -12,10 +12,10 @@
12
12
  "./package.json": "./package.json",
13
13
  ".": "./src/configs/javascript.mjs",
14
14
  "./javascript": "./src/configs/javascript.mjs",
15
+ "./jest": "./src/configs/jest.mjs",
15
16
  "./node": "./src/configs/node.mjs",
16
17
  "./playwright": "./src/configs/playwright.mjs",
17
18
  "./react": "./src/configs/react.mjs",
18
- "./react-ssr-compatibility": "./src/configs/react-ssr-compatibility.mjs",
19
19
  "./storybook": "./src/configs/storybook.mjs",
20
20
  "./styled-components": "./src/configs/styled-components.mjs",
21
21
  "./testing-library": "./src/configs/testing-library.mjs",
@@ -39,46 +39,45 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@eslint-react/eslint-plugin": "^4.2.3",
42
- "@eslint/compat": "^2.0.3",
42
+ "@eslint/compat": "^2.0.5",
43
43
  "@eslint/js": "^10.0.1",
44
44
  "@stylistic/eslint-plugin": "^5.10.0",
45
- "@typescript-eslint/eslint-plugin": "^8.58.0",
46
- "@typescript-eslint/parser": "^8.58.0",
47
- "@vitest/eslint-plugin": "^1.6.13",
45
+ "@typescript-eslint/eslint-plugin": "^8.59.0",
46
+ "@typescript-eslint/parser": "^8.59.0",
47
+ "@vitest/eslint-plugin": "^1.6.16",
48
48
  "confusing-browser-globals": "^1.0.11",
49
49
  "eslint-import-resolver-typescript": "^4.4.4",
50
50
  "eslint-plugin-barrel-files": "^3.0.1",
51
51
  "eslint-plugin-filenames": "^1.3.2",
52
52
  "eslint-plugin-import-x": "^4.16.2",
53
+ "eslint-plugin-jest": "^29.15.2",
53
54
  "eslint-plugin-jest-dom": "^5.5.0",
55
+ "eslint-plugin-jest-formatting": "^3.1.0",
54
56
  "eslint-plugin-jsx-a11y": "^6.10.2",
55
57
  "eslint-plugin-n": "^17.24.0",
56
58
  "eslint-plugin-no-only-tests": "^3.3.0",
57
- "eslint-plugin-no-typeof-window-undefined": "^0.0.2",
58
- "eslint-plugin-playwright": "^2.10.1",
59
+ "eslint-plugin-playwright": "^2.10.2",
59
60
  "eslint-plugin-prettier": "^5.5.5",
60
61
  "eslint-plugin-promise": "^7.2.1",
61
- "eslint-plugin-react-hooks-ssr": "^0.1.5",
62
- "eslint-plugin-ssr-friendly": "^1.3.0",
63
- "eslint-plugin-storybook": "^10.3.3",
62
+ "eslint-plugin-storybook": "^10.3.5",
64
63
  "eslint-plugin-styled-components-a11y": "^2.2.1",
65
64
  "eslint-plugin-testing-library": "^7.16.2",
66
- "globals": "^17.4.0",
67
- "globals-vitest": "^4.1.2"
65
+ "globals": "^17.5.0",
66
+ "globals-vitest": "^4.1.5"
68
67
  },
69
68
  "devDependencies": {
70
69
  "@changesets/changelog-github": "^0.6.0",
71
- "@changesets/cli": "^2.30.0",
70
+ "@changesets/cli": "^2.31.0",
72
71
  "@commitlint/cli": "^20.5.0",
73
72
  "@commitlint/config-conventional": "^20.5.0",
74
73
  "check-export-map": "^1.3.1",
75
- "eslint": "^10.1.0",
74
+ "eslint": "^10.2.1",
76
75
  "glob": "^13.0.6",
77
76
  "husky": "^9.1.7",
78
- "prettier": "^3.8.1",
79
- "storybook": "^10.3.3",
80
- "typescript": "^6.0.2",
81
- "vitest": "^4.1.2"
77
+ "prettier": "^3.8.3",
78
+ "storybook": "^10.3.5",
79
+ "typescript": "^6.0.3",
80
+ "vitest": "^4.1.5"
82
81
  },
83
82
  "peerDependencies": {
84
83
  "eslint": ">= 10",
@@ -0,0 +1,22 @@
1
+ import jestPlugin from 'eslint-plugin-jest';
2
+ import jestFormattingPlugin from 'eslint-plugin-jest-formatting';
3
+ import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
4
+ import jestRules from '../rules/jest.mjs';
5
+ import jestFormattingRules from '../rules/jest-formatting.mjs';
6
+
7
+ export default [
8
+ {
9
+ languageOptions: {
10
+ globals: jestPlugin.environments.globals.globals,
11
+ },
12
+ plugins: {
13
+ jest: jestPlugin,
14
+ 'jest-formatting': jestFormattingPlugin,
15
+ 'no-only-tests': noOnlyTestsPlugin,
16
+ },
17
+ rules: {
18
+ ...jestRules,
19
+ ...jestFormattingRules,
20
+ },
21
+ },
22
+ ];
@@ -0,0 +1,36 @@
1
+ // only add jest-formatting rules (plugin works for vitest as well as jest)
2
+ // see: https://github.com/dangreenisrael/eslint-plugin-jest-formatting#rule-documentation
3
+
4
+ export default {
5
+ // This rule enforces a line of padding before and after 1 or more `afterAll` statements.
6
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-after-all-blocks.md
7
+ 'jest-formatting/padding-around-after-all-blocks': 'error',
8
+
9
+ // This rule enforces a line of padding before and after 1 or more `afterEach` statements.
10
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-after-each-blocks.md
11
+ 'jest-formatting/padding-around-after-each-blocks': 'error',
12
+
13
+ // This rule enforces a line of padding before and after `beforeAll` statements.
14
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-before-all-blocks.md
15
+ 'jest-formatting/padding-around-before-all-blocks': 'error',
16
+
17
+ // This rule enforces a line of padding before and after 1 or more `beforeEach` statements
18
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-before-each-blocks.md
19
+ 'jest-formatting/padding-around-before-each-blocks': 'error',
20
+
21
+ // This rule enforces a line of padding before and after 1 or more `expect` statements
22
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-expect-groups.md
23
+ 'jest-formatting/padding-around-expect-groups': 'error',
24
+
25
+ // This rule enforces a line of padding before and after 1 or more `describe` statements
26
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-describe-blocks.md
27
+ 'jest-formatting/padding-around-describe-blocks': 'error',
28
+
29
+ // This rule enforces a line of padding before and after 1 or more `test`/`it` statements
30
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-test-blocks.md
31
+ 'jest-formatting/padding-around-test-blocks': 'error',
32
+
33
+ // This is a meta rule that simply enables all of the previous rules
34
+ // https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules/padding-around-all.md
35
+ 'jest-formatting/padding-around-all': 'off',
36
+ };
@@ -0,0 +1,203 @@
1
+ // only add jest rules
2
+ // see: https://github.com/jest-community/eslint-plugin-jest#rules
3
+
4
+ export default {
5
+ // Prevent focused tests (.only)
6
+ // https://github.com/levibuzolic/eslint-plugin-no-only-tests#usage
7
+ 'no-only-tests/no-only-tests': 'error',
8
+
9
+ // Have control over `test` and `it` usages
10
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/consistent-test-it.md
11
+ 'jest/consistent-test-it': 'error',
12
+
13
+ // Enforce assertion to be made in a test body
14
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/expect-expect.md
15
+ 'jest/expect-expect': 'error',
16
+
17
+ // Enforces a maximum number assertion calls in a test body
18
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/max-expects.md
19
+ 'jest/max-expects': [
20
+ 'error',
21
+ {
22
+ max: 15,
23
+ },
24
+ ],
25
+
26
+ // Enforces a maximum depth to nested describe calls
27
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/max-nested-describe.md
28
+ 'jest/max-nested-describe': 'error',
29
+
30
+ // Disallow alias methods
31
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-alias-methods.md
32
+ 'jest/no-alias-methods': 'error',
33
+
34
+ // Disallow commented out tests
35
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-commented-out-tests.md
36
+ 'jest/no-commented-out-tests': 'error',
37
+
38
+ // Prevent calling `expect` conditionally
39
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-conditional-expect.md
40
+ 'jest/no-conditional-expect': 'error',
41
+
42
+ // Disallow conditional logic in tests
43
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-conditional-in-test.md
44
+ 'jest/no-conditional-in-test': 'error',
45
+
46
+ // Disallow use of deprecated functions
47
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-deprecated-functions.md
48
+ 'jest/no-deprecated-functions': 'error',
49
+
50
+ // Disallow disabled tests
51
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-disabled-tests.md
52
+ // decision: it is often useful to be allowed to add a .skip
53
+ 'jest/no-disabled-tests': 'off',
54
+
55
+ // Avoid using a callback in asynchronous tests and hooks
56
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-done-callback.md
57
+ 'jest/no-done-callback': 'error',
58
+
59
+ // Disallow duplicate setup and teardown hooks
60
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-duplicate-hooks.md
61
+ 'jest/no-duplicate-hooks': 'error',
62
+
63
+ // Disallow using `exports` in files containing tests
64
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-export.md
65
+ 'jest/no-export': 'error',
66
+
67
+ // Disallow focused tests
68
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-focused-tests.md
69
+ // decision: turned off in favor of the `no-only-tests` rule
70
+ 'jest/no-focused-tests': 'off',
71
+
72
+ // Disallow setup and teardown hooks
73
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-hooks.md
74
+ // decision: hooks are useful even though they *potentially* promote shared state between tests
75
+ 'jest/no-hooks': 'off',
76
+
77
+ // Disallow identical titles
78
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-identical-title.md
79
+ 'jest/no-identical-title': 'error',
80
+
81
+ // Disallow string interpolation inside snapshots
82
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-interpolation-in-snapshots.md
83
+ 'jest/no-interpolation-in-snapshots': 'error',
84
+
85
+ // Disallow Jasmine globals
86
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-jasmine-globals.md
87
+ 'jest/no-jasmine-globals': 'error',
88
+
89
+ // disallow large snapshots
90
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-large-snapshots.md
91
+ // decision: arbitrary but reasonable size limit; although we suggest not writing snapshot tests with the
92
+ // `no-snapshot-testing` rule, in cases where we decide to allow them, this rule is beneficial
93
+ 'jest/no-large-snapshots': ['error', { maxSize: 500 }],
94
+
95
+ // Disallow manually importing from `__mocks__`
96
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-mocks-import.md
97
+ 'jest/no-mocks-import': 'error',
98
+
99
+ // Disallow specific matchers & modifiers
100
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-restricted-matchers.md
101
+ 'jest/no-restricted-matchers': ['error', {}],
102
+
103
+ // Disallow using `expect` outside of `it` or `test` blocks
104
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-standalone-expect.md
105
+ 'jest/no-standalone-expect': 'error',
106
+
107
+ // Use `.only` and `.skip` over `f` and `x`
108
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-test-prefixes.md
109
+ 'jest/no-test-prefixes': 'error',
110
+
111
+ // Disallow explicitly returning from tests
112
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-test-return-statement.md
113
+ 'jest/no-test-return-statement': 'error',
114
+
115
+ // Suggest using `toBeCalledWith()` or `toHaveBeenCalledWith()`
116
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-called-with.md
117
+ 'jest/prefer-called-with': 'error',
118
+
119
+ // Suggest using the built-in comparison matchers
120
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-comparison-matcher.md
121
+ 'jest/prefer-comparison-matcher': 'error',
122
+
123
+ // Suggest using the built-in equality matchers
124
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-equality-matcher.md
125
+ 'jest/prefer-equality-matcher': 'error',
126
+
127
+ // Suggest using `expect.assertions()` OR `expect.hasAssertions()`
128
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-expect-assertions.md
129
+ 'jest/prefer-expect-assertions': 'off',
130
+
131
+ // Prefer `await expect(...).resolves` over `expect(await ...)` syntax
132
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-expect-resolves.md
133
+ 'jest/prefer-expect-resolves': 'error',
134
+
135
+ // Prefer having hooks in a consistent order
136
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-hooks-in-order.md
137
+ 'jest/prefer-hooks-in-order': 'error',
138
+
139
+ // Suggest having hooks before any test cases
140
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-hooks-on-top.md
141
+ 'jest/prefer-hooks-on-top': 'error',
142
+
143
+ // Enforce lowercase test names
144
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-lowercase-title.md
145
+ // decision: descriptions are often named after React components which are capitalized
146
+ 'jest/prefer-lowercase-title': 'off',
147
+
148
+ // Prefer including a hint with external snapshots
149
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-snapshot-hint.md
150
+ 'jest/prefer-snapshot-hint': 'error',
151
+
152
+ // Suggest using `jest.spyOn()`
153
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-spy-on.md
154
+ 'jest/prefer-spy-on': 'error',
155
+
156
+ // Suggest using `toStrictEqual()`
157
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-strict-equal.md
158
+ 'jest/prefer-strict-equal': 'error',
159
+
160
+ // Suggest using `toBe()` for primitive literals
161
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-be.md
162
+ 'jest/prefer-to-be': 'error',
163
+
164
+ // Suggest using `toContain()`
165
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-contain.md
166
+ 'jest/prefer-to-contain': 'error',
167
+
168
+ // Suggest using `toHaveLength()`
169
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-have-length.md
170
+ 'jest/prefer-to-have-length': 'error',
171
+
172
+ // Suggest using `test.todo`
173
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-todo.md
174
+ 'jest/prefer-todo': 'error',
175
+
176
+ // Require setup and teardown code to be within a hook
177
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-hook.md
178
+ 'jest/require-hook': 'error',
179
+
180
+ // Require a message for `toThrow()`
181
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-to-throw-message.md
182
+ 'jest/require-to-throw-message': 'error',
183
+
184
+ // Require test cases and hooks to be inside a `describe` block
185
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-top-level-describe.md
186
+ 'jest/require-top-level-describe': 'error',
187
+
188
+ // Enforce valid `describe()` callback
189
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-describe-callback.md
190
+ 'jest/valid-describe-callback': 'error',
191
+
192
+ // Enforce valid `expect()` usage
193
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-expect.md
194
+ 'jest/valid-expect': 'error',
195
+
196
+ // Ensure promises that have expectations in their chain are valid
197
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-expect-in-promise.md
198
+ 'jest/valid-expect-in-promise': 'error',
199
+
200
+ // Enforce valid titles
201
+ // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-title.md
202
+ 'jest/valid-title': 'error',
203
+ };
@@ -64,7 +64,7 @@
64
64
  "undefined": false,
65
65
  "unescape": false,
66
66
  },
67
- "parser": "typescript-eslint/parser@8.58.0",
67
+ "parser": "typescript-eslint/parser@8.59.0",
68
68
  "parserOptions": {
69
69
  "requireConfigFile": false,
70
70
  },
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "plugins": [
30
30
  "@",
31
- "jest:eslint-plugin-jest@29.15.0",
31
+ "jest:eslint-plugin-jest@29.15.2",
32
32
  "jest-formatting",
33
33
  "no-only-tests",
34
34
  ],
@@ -31,6 +31,7 @@
31
31
  "AudioNode": false,
32
32
  "AudioParam": false,
33
33
  "AudioParamMap": false,
34
+ "AudioPlaybackStats": false,
34
35
  "AudioProcessingEvent": false,
35
36
  "AudioScheduledSourceNode": false,
36
37
  "AudioSinkInfo": false,
@@ -719,6 +720,7 @@
719
720
  "SVGUnitTypes": false,
720
721
  "SVGUseElement": false,
721
722
  "SVGViewElement": false,
723
+ "Sanitizer": false,
722
724
  "Scheduler": false,
723
725
  "Scheduling": false,
724
726
  "Screen": false,
@@ -798,6 +800,9 @@
798
800
  "TextUpdateEvent": false,
799
801
  "TimeEvent": false,
800
802
  "TimeRanges": false,
803
+ "TimelineTrigger": false,
804
+ "TimelineTriggerRange": false,
805
+ "TimelineTriggerRangeList": false,
801
806
  "ToggleEvent": false,
802
807
  "Touch": false,
803
808
  "TouchEvent": false,
@@ -64,7 +64,7 @@
64
64
  "undefined": false,
65
65
  "unescape": false,
66
66
  },
67
- "parser": "typescript-eslint/parser@8.58.0",
67
+ "parser": "typescript-eslint/parser@8.59.0",
68
68
  "parserOptions": {
69
69
  "ecmaVersion": 2024,
70
70
  "project": "./tsconfig.json",
@@ -78,7 +78,7 @@
78
78
  "plugins": [
79
79
  "@",
80
80
  "@stylistic:@stylistic/eslint-plugin@5.10.0",
81
- "@typescript-eslint:@typescript-eslint/eslint-plugin@8.58.0",
81
+ "@typescript-eslint:@typescript-eslint/eslint-plugin@8.59.0",
82
82
  "barrel-files:eslint-plugin-barrel-files@3.0.1",
83
83
  "filenames",
84
84
  "import-x:eslint-plugin-import-x@4.16.2",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "plugins": [
37
37
  "@",
38
- "vitest:vitest@1.6.13",
38
+ "vitest:vitest@1.6.16",
39
39
  "no-only-tests",
40
40
  ],
41
41
  "rules": {
@@ -1,18 +0,0 @@
1
- import { fixupPluginRules } from '@eslint/compat';
2
- import ssrFriendlyPlugin from 'eslint-plugin-ssr-friendly';
3
- import reactHooksSSRPlugin from 'eslint-plugin-react-hooks-ssr';
4
- import noTypeofWindowUndefinedPlugin from 'eslint-plugin-no-typeof-window-undefined';
5
- import reactSSRCompatibilityRules from '../rules/react-ssr-compatibility.mjs';
6
-
7
- export default [
8
- {
9
- plugins: {
10
- 'ssr-friendly': fixupPluginRules(ssrFriendlyPlugin),
11
- 'react-hooks-ssr': fixupPluginRules(reactHooksSSRPlugin),
12
- 'no-typeof-window-undefined': fixupPluginRules(noTypeofWindowUndefinedPlugin),
13
- },
14
- rules: {
15
- ...reactSSRCompatibilityRules,
16
- },
17
- },
18
- ];
@@ -1,35 +0,0 @@
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
- export default {
8
- // Disallow use of DOM globals in module and global scope, as this will break any import/require in a NodeJS environment.
9
- // https://github.com/kopiro/eslint-plugin-ssr-friendly#no-dom-globals-in-module-scope
10
- 'ssr-friendly/no-dom-globals-in-module-scope': 'error',
11
-
12
- // 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.
13
- // https://github.com/kopiro/eslint-plugin-ssr-friendly#no-dom-globals-in-constructor
14
- 'ssr-friendly/no-dom-globals-in-constructor': 'error',
15
-
16
- // Disallow use of DOM globals in render() method of a React class-component, as this will break SSR if you're rendering this component.
17
- // https://github.com/kopiro/eslint-plugin-ssr-friendly#no-dom-globals-in-react-cc-render
18
- 'ssr-friendly/no-dom-globals-in-react-cc-render': 'error',
19
-
20
- // Disallow use of DOM globals in the render-cycle of a React FC, as this will break SSR if you're rendering this component.
21
- // https://github.com/kopiro/eslint-plugin-ssr-friendly#no-dom-globals-in-react-fc
22
- 'ssr-friendly/no-dom-globals-in-react-fc': 'error',
23
-
24
- // forbid DOM globals within react server side rendering
25
- // a global within `useEffect` or custom hook is allowed
26
- // a global within a function prefixed by `async` (eg. `asyncMyFunc`) is allowed
27
- // a global within a `useState`, `useReducer` and `useMemo` callback is forbidden
28
- // a global within a React `Component` is forbidden
29
- 'react-hooks-ssr/react-hooks-global-ssr': 'error',
30
-
31
- // avoid checking for window since it is supported by Deno
32
- // prefer `typeof document === "undefined"` instead
33
- // https://github.com/nirtamir2/eslint-plugin-no-typeof-window-undefined#no-typeof-window-undefined
34
- 'no-typeof-window-undefined/no-typeof-window-undefined': 'error',
35
- };