/** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; // Fix eslint shareable config (https://github.com/eslint/eslint/issues/3458) require('@rushstack/eslint-patch/modern-module-resolution'); // We use eslint-loader so even warnings are very visible. // This is why we prefer to use "WARNING" level for potential errors, // and we try not to use "ERROR" level at all. module.exports = { plugins: ['jest', 'testing-library'], overrides: [ { files: ['**/__tests__/**/*', '**/*.{spec,test}.*'], env: { 'jest/globals': true, }, // A subset of the recommended rules: rules: { // https://github.com/jest-community/eslint-plugin-jest 'jest/no-conditional-expect': 'error', 'jest/no-identical-title': 'error', 'jest/no-interpolation-in-snapshots': 'error', 'jest/no-jasmine-globals': 'error', 'jest/no-jest-import': 'error', 'jest/no-mocks-import': 'error', 'jest/valid-describe-callback': 'error', 'jest/valid-expect': 'error', 'jest/valid-expect-in-promise': 'error', 'jest/valid-title': 'warn', // https://github.com/testing-library/eslint-plugin-testing-library 'testing-library/await-async-query': 'error', 'testing-library/await-async-utils': 'error', 'testing-library/no-await-sync-query': 'error', 'testing-library/no-container': 'error', 'testing-library/no-debugging-utils': 'error', 'testing-library/no-dom-import': ['error', 'react'], 'testing-library/no-node-access': 'error', 'testing-library/no-promise-in-fire-event': 'error', 'testing-library/no-render-in-setup': 'error', 'testing-library/no-unnecessary-act': 'error', 'testing-library/no-wait-for-empty-callback': 'error', 'testing-library/no-wait-for-multiple-assertions': 'error', 'testing-library/no-wait-for-side-effects': 'error', 'testing-library/no-wait-for-snapshot': 'error', 'testing-library/prefer-find-by': 'error', 'testing-library/prefer-presence-queries': 'error', 'testing-library/prefer-query-by-disappearance': 'error', 'testing-library/prefer-screen-queries': 'error', 'testing-library/render-result-naming-convention': 'error', }, }, ], };