Skip to content

Commit e179ac8

Browse files
committed
Merge multiple .eslintrc.js files into one
This is going to help us upgrade the eslint version to 9.
1 parent 142890d commit e179ac8

File tree

2 files changed

+63
-60
lines changed

2 files changed

+63
-60
lines changed

.eslintrc.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,67 @@ module.exports = {
144144
globals: {
145145
AVAILABLE_STAGING_LOCALES: true,
146146
},
147+
overrides: [
148+
{
149+
files: ['src/test/**/*'],
150+
env: {
151+
jest: true,
152+
},
153+
plugins: ['jest', 'testing-library', 'jest-formatting', 'jest-dom'],
154+
extends: [
155+
'plugin:jest/recommended',
156+
'plugin:testing-library/react',
157+
'plugin:jest-dom/recommended',
158+
],
159+
rules: {
160+
'react/jsx-no-bind': 0,
161+
// This rule isn't useful because use Flow.
162+
'jest/valid-title': 0,
163+
164+
// Allow require(), for example for importing JSON files.
165+
'@typescript-eslint/no-require-imports': 'off',
166+
167+
// Override the project-wide config to allow @ts-nocheck.
168+
// We really just need this for our mocks.
169+
'@typescript-eslint/ban-ts-comment': [
170+
'error',
171+
{
172+
// Allow @ts-expect-error and @ts-no-check annotations with descriptions.
173+
'ts-expect-error': 'allow-with-description',
174+
'ts-nocheck': 'allow-with-description',
175+
// Don't allow @ts-ignore because we want to be notified
176+
// when the error goes away so we can remove the annotation - use
177+
// @ts-expect-error instead
178+
'ts-ignore': true,
179+
'ts-check': false,
180+
},
181+
],
182+
183+
// Adding more errors now
184+
'testing-library/no-manual-cleanup': 'error',
185+
'testing-library/no-wait-for-snapshot': 'error',
186+
'testing-library/prefer-explicit-assert': [
187+
'error',
188+
{ includeFindQueries: false },
189+
],
190+
'testing-library/prefer-presence-queries': 'error',
191+
192+
// Disable some rules that are in the "recommended" part.
193+
// This is a purely stylistic rule
194+
'testing-library/render-result-naming-convention': 'off',
195+
// This disallows using `container`, but this is still useful for us sometimes
196+
'testing-library/no-container': 'off',
197+
// This disallows using direct Node properties (eg: firstChild), but we have
198+
// legitimate uses:
199+
'testing-library/no-node-access': 'off',
200+
// Disable until https://github.com/testing-library/eslint-plugin-testing-library/issues/359
201+
// is fixed.
202+
'testing-library/await-async-query': 'off',
203+
204+
// Individual jest-formatting rules so that we format only test and describe blocks
205+
'jest-formatting/padding-around-describe-blocks': 2,
206+
'jest-formatting/padding-around-test-blocks': 2,
207+
},
208+
},
209+
],
147210
};

src/test/.eslintrc.js

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

0 commit comments

Comments
 (0)