| 1 | /**
|
|---|
| 2 | * Copyright (c) 2015-present, Facebook, Inc.
|
|---|
| 3 | *
|
|---|
| 4 | * This source code is licensed under the MIT license found in the
|
|---|
| 5 | * LICENSE file in the root directory of this source tree.
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | 'use strict';
|
|---|
| 9 |
|
|---|
| 10 | // Fix eslint shareable config (https://github.com/eslint/eslint/issues/3458)
|
|---|
| 11 | require('@rushstack/eslint-patch/modern-module-resolution');
|
|---|
| 12 |
|
|---|
| 13 | // We use eslint-loader so even warnings are very visible.
|
|---|
| 14 | // This is why we prefer to use "WARNING" level for potential errors,
|
|---|
| 15 | // and we try not to use "ERROR" level at all.
|
|---|
| 16 |
|
|---|
| 17 | module.exports = {
|
|---|
| 18 | plugins: ['jest', 'testing-library'],
|
|---|
| 19 | overrides: [
|
|---|
| 20 | {
|
|---|
| 21 | files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
|
|---|
| 22 | env: {
|
|---|
| 23 | 'jest/globals': true,
|
|---|
| 24 | },
|
|---|
| 25 | // A subset of the recommended rules:
|
|---|
| 26 | rules: {
|
|---|
| 27 | // https://github.com/jest-community/eslint-plugin-jest
|
|---|
| 28 | 'jest/no-conditional-expect': 'error',
|
|---|
| 29 | 'jest/no-identical-title': 'error',
|
|---|
| 30 | 'jest/no-interpolation-in-snapshots': 'error',
|
|---|
| 31 | 'jest/no-jasmine-globals': 'error',
|
|---|
| 32 | 'jest/no-jest-import': 'error',
|
|---|
| 33 | 'jest/no-mocks-import': 'error',
|
|---|
| 34 | 'jest/valid-describe-callback': 'error',
|
|---|
| 35 | 'jest/valid-expect': 'error',
|
|---|
| 36 | 'jest/valid-expect-in-promise': 'error',
|
|---|
| 37 | 'jest/valid-title': 'warn',
|
|---|
| 38 |
|
|---|
| 39 | // https://github.com/testing-library/eslint-plugin-testing-library
|
|---|
| 40 | 'testing-library/await-async-query': 'error',
|
|---|
| 41 | 'testing-library/await-async-utils': 'error',
|
|---|
| 42 | 'testing-library/no-await-sync-query': 'error',
|
|---|
| 43 | 'testing-library/no-container': 'error',
|
|---|
| 44 | 'testing-library/no-debugging-utils': 'error',
|
|---|
| 45 | 'testing-library/no-dom-import': ['error', 'react'],
|
|---|
| 46 | 'testing-library/no-node-access': 'error',
|
|---|
| 47 | 'testing-library/no-promise-in-fire-event': 'error',
|
|---|
| 48 | 'testing-library/no-render-in-setup': 'error',
|
|---|
| 49 | 'testing-library/no-unnecessary-act': 'error',
|
|---|
| 50 | 'testing-library/no-wait-for-empty-callback': 'error',
|
|---|
| 51 | 'testing-library/no-wait-for-multiple-assertions': 'error',
|
|---|
| 52 | 'testing-library/no-wait-for-side-effects': 'error',
|
|---|
| 53 | 'testing-library/no-wait-for-snapshot': 'error',
|
|---|
| 54 | 'testing-library/prefer-find-by': 'error',
|
|---|
| 55 | 'testing-library/prefer-presence-queries': 'error',
|
|---|
| 56 | 'testing-library/prefer-query-by-disappearance': 'error',
|
|---|
| 57 | 'testing-library/prefer-screen-queries': 'error',
|
|---|
| 58 | 'testing-library/render-result-naming-convention': 'error',
|
|---|
| 59 | },
|
|---|
| 60 | },
|
|---|
| 61 | ],
|
|---|
| 62 | };
|
|---|