diff --git a/src/__snapshots__/index.spec.js.snap b/src/__snapshots__/index.spec.js.snap index a049213..cf81bab 100644 --- a/src/__snapshots__/index.spec.js.snap +++ b/src/__snapshots__/index.spec.js.snap @@ -1417,6 +1417,7 @@ Object { "jest-dom/prefer-focus": "error", "jest-dom/prefer-required": "error", "jest-dom/prefer-to-have-attribute": "error", + "jest-dom/prefer-to-have-style": "error", "jest-dom/prefer-to-have-text-content": "error", "jsx-a11y/accessible-emoji": "error", "jsx-a11y/alt-text": Array [ @@ -2417,7 +2418,6 @@ Object { "symbol-description": "error", "testing-library/await-async-query": "error", "testing-library/await-async-utils": "error", - "testing-library/await-fire-event": "error", "testing-library/no-await-sync-query": "error", "testing-library/no-debug": "error", "testing-library/no-dom-import": Array [ @@ -2425,7 +2425,9 @@ Object { "react", ], "testing-library/no-manual-cleanup": "error", + "testing-library/no-render-in-setup": "error", "testing-library/no-wait-for-empty-callback": "error", + "testing-library/no-wait-for-snapshot": "error", "testing-library/prefer-explicit-assert": "error", "testing-library/prefer-find-by": "error", "testing-library/prefer-presence-queries": "error", diff --git a/src/rules/plugin-cypress.js b/src/rules/plugin-cypress.js index 86cd9fd..66b0838 100644 --- a/src/rules/plugin-cypress.js +++ b/src/rules/plugin-cypress.js @@ -1,7 +1,9 @@ 'use strict' /** - * Rules for Cypress acceptance tests + * Plugin rules for writing effective Cypress tests + * + * 📝 https://github.com/cypress-io/eslint-plugin-cypress */ module.exports = { // Require an assertion before a screenshot to help ensure consistent screenshots diff --git a/src/rules/plugin-import.js b/src/rules/plugin-import.js index f79fed9..e58613b 100644 --- a/src/rules/plugin-import.js +++ b/src/rules/plugin-import.js @@ -1,18 +1,20 @@ 'use strict' /** - * Import plugin rules - * https://github.com/benmosher/eslint-plugin-import + * Plugin rules for linting imports + * + * 📝 https://github.com/benmosher/eslint-plugin-import * * ## Cookbook * * - Restrict importing a specific module by setting a `no-restricted-imports` - * value. This can be useful for things like preventing React Router's Link component - * from being used instead of an application Link component. - * - Restrict where modules can be imported by setting an `import/no-restricted-paths` value. - * This can be useful for enforcing boundaries between modules, like separating Electron - * client code from main code, or for enforcing that an index file is used for a Design - * System directory + * value. This can be useful for things like preventing React Router's Link + * component from being used instead of an application Link component. + * - Restrict where modules can be imported by setting an + * `import/no-restricted-paths` value. This can be useful for enforcing + * boundaries between modules, like separating Electron client code from main + * code, or for enforcing that an index file is used for a Design System + * directory */ module.exports = { // -------------------------------------------------------- diff --git a/src/rules/plugin-jest-dom.js b/src/rules/plugin-jest-dom.js index e1d4f6f..b88d035 100644 --- a/src/rules/plugin-jest-dom.js +++ b/src/rules/plugin-jest-dom.js @@ -1,5 +1,12 @@ 'use strict' +/** + * Plugin rules for writing effective test queries using the custom Jest DOM + * matchers + * + * 📝 https://github.com/testing-library/jest-dom + * 📝 https://github.com/testing-library/eslint-plugin-jest-dom + */ module.exports = { 'jest-dom/prefer-checked': 'error', 'jest-dom/prefer-empty': 'error', @@ -7,5 +14,6 @@ module.exports = { 'jest-dom/prefer-focus': 'error', 'jest-dom/prefer-required': 'error', 'jest-dom/prefer-to-have-attribute': 'error', + 'jest-dom/prefer-to-have-style': 'error', 'jest-dom/prefer-to-have-text-content': 'error', } diff --git a/src/rules/plugin-node.js b/src/rules/plugin-node.js index 2e5c4fc..8029d31 100644 --- a/src/rules/plugin-node.js +++ b/src/rules/plugin-node.js @@ -1,8 +1,9 @@ 'use strict' /** - * Node.js rules from `eslint-plugin-node` - * https://github.com/mysticatea/eslint-plugin-node + * Plugin rules for Node.js codebases + * + * 📝 https://github.com/mysticatea/eslint-plugin-node */ module.exports = { // Disable duplicated no-process-exit included by ESLint Node plugin diff --git a/src/rules/plugin-react-a11y.js b/src/rules/plugin-react-a11y.js index 04bde19..cacb2bc 100644 --- a/src/rules/plugin-react-a11y.js +++ b/src/rules/plugin-react-a11y.js @@ -1,5 +1,10 @@ 'use strict' +/** + * Plugin for linting accessibility of React applications + * + * 📝 https://github.com/jsx-eslint/eslint-plugin-jsx-a11y + */ module.exports = { // Enforce that anchors have content // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md diff --git a/src/rules/plugin-react-hooks.js b/src/rules/plugin-react-hooks.js index f7e53f9..8e0cd5a 100644 --- a/src/rules/plugin-react-hooks.js +++ b/src/rules/plugin-react-hooks.js @@ -1,9 +1,12 @@ 'use strict' -// https://reactjs.org/docs/hooks-rules.html +/** + * Plugin rules for React hooks + * + * 📝 https://reactjs.org/docs/hooks-rules.html + */ module.exports = { - // Enforce that deps used in effects are included in watched deps - // https://github.com/facebook/react/issues/14920 + // Enforce that references used in hooks are included in hook dependency arrays 'react-hooks/exhaustive-deps': 'error', // Enforce that hooks are only called inside components or other hooks, and diff --git a/src/rules/plugin-react.js b/src/rules/plugin-react.js index 8d9eaf9..e07f266 100644 --- a/src/rules/plugin-react.js +++ b/src/rules/plugin-react.js @@ -1,8 +1,9 @@ 'use strict' /** - * React linting rules - * https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules + * Plugin rules for React codebases + * + * 📝 https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules */ module.exports = { // Don't enforce .jsx file extension, it doesn't provide a clear benefit and diff --git a/src/rules/plugin-testing-library.js b/src/rules/plugin-testing-library.js index ad33941..29cfc28 100644 --- a/src/rules/plugin-testing-library.js +++ b/src/rules/plugin-testing-library.js @@ -1,14 +1,20 @@ 'use strict' +/** + * Plugin for effectively writing React Testing Library tests + * + * 📝 https://github.com/testing-library/eslint-plugin-testing-library + */ module.exports = { 'testing-library/await-async-query': 'error', 'testing-library/await-async-utils': 'error', - 'testing-library/await-fire-event': 'error', 'testing-library/no-await-sync-query': 'error', 'testing-library/no-debug': 'error', 'testing-library/no-dom-import': ['error', 'react'], 'testing-library/no-manual-cleanup': 'error', + 'testing-library/no-render-in-setup': 'error', 'testing-library/no-wait-for-empty-callback': 'error', + 'testing-library/no-wait-for-snapshot': 'error', 'testing-library/prefer-explicit-assert': 'error', // Prefer using `findBy*` instead of `waitFor`+`getBy` diff --git a/src/rules/plugin-typescript.js b/src/rules/plugin-typescript.js index c28a801..c7b5fa1 100644 --- a/src/rules/plugin-typescript.js +++ b/src/rules/plugin-typescript.js @@ -1,5 +1,10 @@ 'use strict' +/** + * Plugin rules for TypeScript + * + * 📝 https://github.com/typescript-eslint/typescript-eslint + */ module.exports = { // --- Disabled ESLint rules ---------------------- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/eslint-recommended.ts diff --git a/src/rules/target-node.js b/src/rules/target-node.js index 1db5ef5..9ef26be 100644 --- a/src/rules/target-node.js +++ b/src/rules/target-node.js @@ -1,5 +1,8 @@ 'use strict' +/** + * Node.js specific rules + */ module.exports = (esm) => ({ // Extensions must be provided for ESM usage 'import/extensions': [ diff --git a/src/rules/target-react.js b/src/rules/target-react.js index d4a405b..e5729fc 100644 --- a/src/rules/target-react.js +++ b/src/rules/target-react.js @@ -1,5 +1,8 @@ 'use strict' +/** + * React specific rules + */ module.exports = { // ℹī¸ webpack bundled React projects don't need extensions defined like Node // ESM projects so extensions must be consistently omitted. diff --git a/src/rules/target-typescript.js b/src/rules/target-typescript.js index 804b80d..be2c5c9 100644 --- a/src/rules/target-typescript.js +++ b/src/rules/target-typescript.js @@ -1,5 +1,8 @@ 'use strict' +/** + * TypeScript specific rules + */ module.exports = { // --- prettier/@typescript-eslint '@typescript-eslint/quotes': 'off',