Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Add JSDoc module to target files 馃摑 #242

Merged
merged 2 commits into from Sep 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/__snapshots__/index.spec.js.snap
Expand Up @@ -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 [
Expand Down Expand Up @@ -2417,15 +2418,16 @@ 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 [
"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",
"testing-library/prefer-find-by": "error",
"testing-library/prefer-presence-queries": "error",
Expand Down
4 changes: 3 additions & 1 deletion 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
Expand Down
18 changes: 10 additions & 8 deletions 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 = {
// --------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions src/rules/plugin-jest-dom.js
@@ -1,11 +1,19 @@
'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',
'jest-dom/prefer-enabled-disabled': 'error',
'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',
}
5 changes: 3 additions & 2 deletions 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
Expand Down
5 changes: 5 additions & 0 deletions 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
Expand Down
9 changes: 6 additions & 3 deletions 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
Expand Down
5 changes: 3 additions & 2 deletions 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
Expand Down
8 changes: 7 additions & 1 deletion 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`
Expand Down
5 changes: 5 additions & 0 deletions 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
Expand Down
3 changes: 3 additions & 0 deletions 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': [
Expand Down
3 changes: 3 additions & 0 deletions 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.
Expand Down
3 changes: 3 additions & 0 deletions src/rules/target-typescript.js
@@ -1,5 +1,8 @@
'use strict'

/**
* TypeScript specific rules
*/
module.exports = {
// --- prettier/@typescript-eslint
'@typescript-eslint/quotes': 'off',
Expand Down