From 4efa35309b37bab94267e3f422e5d3a293334d12 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Sun, 21 Aug 2022 14:50:18 -0400 Subject: [PATCH] [Docs] Fix typos --- docs/rules/jsx-pascal-case.md | 2 +- docs/rules/jsx-props-no-spreading.md | 2 +- docs/rules/no-arrow-function-lifecycle.md | 2 +- docs/rules/no-unstable-nested-components.md | 2 +- docs/rules/sort-prop-types.md | 2 +- lib/rules/jsx-curly-brace-presence.js | 8 ++++---- lib/rules/no-access-state-in-setstate.js | 2 +- lib/rules/no-danger.js | 2 +- lib/rules/no-direct-mutation-state.js | 2 +- lib/rules/no-unescaped-entities.js | 2 +- lib/rules/no-unstable-nested-components.js | 4 ++-- lib/rules/prefer-stateless-function.js | 2 +- lib/util/Components.js | 2 +- lib/util/ast.js | 2 +- lib/util/propTypesSort.js | 4 ++-- tests/lib/rules/no-typos.js | 8 ++++---- tests/lib/rules/no-unused-prop-types.js | 12 ++++++------ tests/lib/rules/prefer-stateless-function.js | 2 +- tests/lib/rules/prop-types.js | 4 ++-- tests/lib/rules/require-optimization.js | 2 +- tests/lib/rules/static-property-placement.js | 8 ++++---- tests/util/ast.js | 2 +- 22 files changed, 39 insertions(+), 39 deletions(-) diff --git a/docs/rules/jsx-pascal-case.md b/docs/rules/jsx-pascal-case.md index 57f7ab04c4..c46cc05566 100644 --- a/docs/rules/jsx-pascal-case.md +++ b/docs/rules/jsx-pascal-case.md @@ -79,7 +79,7 @@ Examples of **correct** code for this rule, when `allowLeadingUnderscore` is `tr ``` -**WARNING:** Adding a leading underscore to the name of a component does **NOT** affect the visibilty or accessibility of that component. Attempting to use leading underscores to enforce privacy of your components is an error. +**WARNING:** Adding a leading underscore to the name of a component does **NOT** affect the visibility or accessibility of that component. Attempting to use leading underscores to enforce privacy of your components is an error. ## When Not To Use It diff --git a/docs/rules/jsx-props-no-spreading.md b/docs/rules/jsx-props-no-spreading.md index 33ac1c3cd3..ce7c4e48b5 100644 --- a/docs/rules/jsx-props-no-spreading.md +++ b/docs/rules/jsx-props-no-spreading.md @@ -68,7 +68,7 @@ Examples of **incorrect** code for this rule, when `custom` is set to `ignore`: ### explicitSpread -`explicitSpread` set to `ignore` will ignore spread operators that are explicilty listing all object properties within that spread. Default is set to `enforce`. +`explicitSpread` set to `ignore` will ignore spread operators that are explicitly listing all object properties within that spread. Default is set to `enforce`. Examples of **correct** code for this rule, when `explicitSpread` is set to `ignore`: diff --git a/docs/rules/no-arrow-function-lifecycle.md b/docs/rules/no-arrow-function-lifecycle.md index de6eea65ae..dcfba4316d 100644 --- a/docs/rules/no-arrow-function-lifecycle.md +++ b/docs/rules/no-arrow-function-lifecycle.md @@ -2,7 +2,7 @@ 🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line. -It is not neccessary to use arrow function for lifecycle methods. This makes things harder to test, conceptually less performant (although in practice, performance will not be affected, since most engines will optimize efficiently), and can break hot reloading patterns. +It is not necessary to use arrow function for lifecycle methods. This makes things harder to test, conceptually less performant (although in practice, performance will not be affected, since most engines will optimize efficiently), and can break hot reloading patterns. ## Rule Details diff --git a/docs/rules/no-unstable-nested-components.md b/docs/rules/no-unstable-nested-components.md index d6fea98003..eb60731ebc 100644 --- a/docs/rules/no-unstable-nested-components.md +++ b/docs/rules/no-unstable-nested-components.md @@ -2,7 +2,7 @@ Creating components inside components without memoization leads to unstable components. The nested component and all its children are recreated during each re-render. Given stateful children of the nested component will lose their state on each re-render. -React reconcilation performs element type comparison with [reference equality](https://github.com/facebook/react/blob/v16.13.1/packages/react-reconciler/src/ReactChildFiber.js#L407). The reference to the same element changes on each re-render when defining components inside the render block. This leads to complete recreation of the current node and all its children. As a result the virtual DOM has to do extra unnecessary work and [possible bugs are introduced](https://codepen.io/ariperkkio/pen/vYLodLB). +React reconciliation performs element type comparison with [reference equality](https://github.com/facebook/react/blob/v16.13.1/packages/react-reconciler/src/ReactChildFiber.js#L407). The reference to the same element changes on each re-render when defining components inside the render block. This leads to complete recreation of the current node and all its children. As a result the virtual DOM has to do extra unnecessary work and [possible bugs are introduced](https://codepen.io/ariperkkio/pen/vYLodLB). ## Rule Details diff --git a/docs/rules/sort-prop-types.md b/docs/rules/sort-prop-types.md index 5b05645ec1..5009c1e493 100644 --- a/docs/rules/sort-prop-types.md +++ b/docs/rules/sort-prop-types.md @@ -1,6 +1,6 @@ # Enforce propTypes declarations alphabetical sorting (react/sort-prop-types) -Some developers prefer to sort prop type declaratioms alphabetically to be able to find necessary declaration easier at the later time. Others feel that it adds complexity and becomes burden to maintain. +Some developers prefer to sort prop type declarations alphabetically to be able to find necessary declaration easier at the later time. Others feel that it adds complexity and becomes burden to maintain. ## Rule Details diff --git a/lib/rules/jsx-curly-brace-presence.js b/lib/rules/jsx-curly-brace-presence.js index efe95e89d6..996aecc3de 100755 --- a/lib/rules/jsx-curly-brace-presence.js +++ b/lib/rules/jsx-curly-brace-presence.js @@ -138,8 +138,8 @@ module.exports = { )).join(HTML_ENTITY); const htmlEntities = text.match(HTML_ENTITY_REGEX()); - return htmlEntities.reduce((acc, htmlEntitiy) => ( - acc.replace(HTML_ENTITY, htmlEntitiy) + return htmlEntities.reduce((acc, htmlEntity) => ( + acc.replace(HTML_ENTITY, htmlEntity) ), withCurlyBraces); } @@ -244,8 +244,8 @@ module.exports = { } // Bail out if there is any character that needs to be escaped in JSX - // because escaping decreases readiblity and the original code may be more - // readible anyway or intentional for other specific reasons + // because escaping decreases readability and the original code may be more + // readable anyway or intentional for other specific reasons function lintUnnecessaryCurly(JSXExpressionNode) { const expression = JSXExpressionNode.expression; const expressionType = expression.type; diff --git a/lib/rules/no-access-state-in-setstate.js b/lib/rules/no-access-state-in-setstate.js index 4ff5a840bf..89d4976077 100644 --- a/lib/rules/no-access-state-in-setstate.js +++ b/lib/rules/no-access-state-in-setstate.js @@ -130,7 +130,7 @@ module.exports = { break; } - // Storing all variables containg this.state + // Storing all variables containing this.state if (current.type === 'VariableDeclarator') { vars.push({ node, diff --git a/lib/rules/no-danger.js b/lib/rules/no-danger.js index 3b54427cd9..a7cf8b59f8 100644 --- a/lib/rules/no-danger.js +++ b/lib/rules/no-danger.js @@ -29,7 +29,7 @@ const DANGEROUS_PROPERTIES = fromEntries(DANGEROUS_PROPERTY_NAMES.map((prop) => /** * Checks if a JSX attribute is dangerous. * @param {String} name - Name of the attribute to check. - * @returns {boolean} Whether or not the attribute is dnagerous. + * @returns {boolean} Whether or not the attribute is dangerous. */ function isDangerous(name) { return has(DANGEROUS_PROPERTIES, name); diff --git a/lib/rules/no-direct-mutation-state.js b/lib/rules/no-direct-mutation-state.js index 116f2e4bb9..8b6839f31e 100644 --- a/lib/rules/no-direct-mutation-state.js +++ b/lib/rules/no-direct-mutation-state.js @@ -56,7 +56,7 @@ module.exports = { } /** - * Walks throughs the MemberExpression to the top-most property. + * Walks through the MemberExpression to the top-most property. * @param {Object} node The node to process * @returns {Object} The outer-most MemberExpression */ diff --git a/lib/rules/no-unescaped-entities.js b/lib/rules/no-unescaped-entities.js index 6560a461f0..9aedd47658 100644 --- a/lib/rules/no-unescaped-entities.js +++ b/lib/rules/no-unescaped-entities.js @@ -81,7 +81,7 @@ module.exports = { const configuration = context.options[0] || {}; const entities = configuration.forbid || DEFAULTS; - // HTML entites are already escaped in node.value (as well as node.raw), + // HTML entities are already escaped in node.value (as well as node.raw), // so pull the raw text from context.getSourceCode() for (let i = node.loc.start.line; i <= node.loc.end.line; i++) { let rawLine = context.getSourceCode().lines[i - 1]; diff --git a/lib/rules/no-unstable-nested-components.js b/lib/rules/no-unstable-nested-components.js index af6d697f14..9b60e496bf 100644 --- a/lib/rules/no-unstable-nested-components.js +++ b/lib/rules/no-unstable-nested-components.js @@ -432,7 +432,7 @@ module.exports = { || isMapCall(node) || isMapCall(node.parent) - // Do not mark components declared inside hooks (or falsly '() => null' clean-up methods) + // Do not mark components declared inside hooks (or falsy '() => null' clean-up methods) || isReturnStatementOfHook(node, context) // Do not mark objects containing render methods @@ -441,7 +441,7 @@ module.exports = { // Prevent reporting nested class components twice || isInsideRenderMethod(node) - // Prevent falsely reporting deteceted "components" which do not return JSX + // Prevent falsely reporting detected "components" which do not return JSX || isStatelessComponentReturningNull(node) ) { return; diff --git a/lib/rules/prefer-stateless-function.js b/lib/rules/prefer-stateless-function.js index 7d39738e53..0fc027c879 100644 --- a/lib/rules/prefer-stateless-function.js +++ b/lib/rules/prefer-stateless-function.js @@ -168,7 +168,7 @@ module.exports = { * @see eslint no-useless-constructor rule * @param {Array} body - constructor body content. * @param {Array} ctorParams - The params to check against super call. - * @returns {boolean} true if the construtor body is redundant + * @returns {boolean} true if the constructor body is redundant */ function isRedundantSuperCall(body, ctorParams) { return ( diff --git a/lib/util/Components.js b/lib/util/Components.js index 273e424283..aa511ebdf3 100644 --- a/lib/util/Components.js +++ b/lib/util/Components.js @@ -386,7 +386,7 @@ function componentRule(rule, context) { }, /** - * It will check wheater memo/forwardRef is wrapping existing component or + * It will check whether memo/forwardRef is wrapping existing component or * creating a new one. * @param {object} node * @returns {boolean} diff --git a/lib/util/ast.js b/lib/util/ast.js index 747b448429..fd6019a3f2 100644 --- a/lib/util/ast.js +++ b/lib/util/ast.js @@ -44,7 +44,7 @@ function loopNodes(nodes) { } /** - * Find a return statment in the current node + * Find a return statement in the current node * * @param {ASTNode} node The AST node being checked * @returns {ASTNode | false} diff --git a/lib/util/propTypesSort.js b/lib/util/propTypesSort.js index 4bfb938e56..6b6096f340 100644 --- a/lib/util/propTypesSort.js +++ b/lib/util/propTypesSort.js @@ -66,7 +66,7 @@ function getShapeProperties(node) { * @param {Context} context The context of the two nodes. * @param {Boolean=} ignoreCase whether or not to ignore case when comparing the two elements. * @param {Boolean=} requiredFirst whether or not to sort required elements first. - * @param {Boolean=} callbacksLast whether or not to sort callbacks after everyting else. + * @param {Boolean=} callbacksLast whether or not to sort callbacks after everything else. * @returns {Number} the sort order of the two elements. */ function sorter(a, b, context, ignoreCase, requiredFirst, callbacksLast) { @@ -112,7 +112,7 @@ function sorter(a, b, context, ignoreCase, requiredFirst, callbacksLast) { * @param {Array} declarations The context of the two nodes. * @param {Boolean=} ignoreCase whether or not to ignore case when comparing the two elements. * @param {Boolean=} requiredFirst whether or not to sort required elements first. - * @param {Boolean=} callbacksLast whether or not to sort callbacks after everyting else. + * @param {Boolean=} callbacksLast whether or not to sort callbacks after everything else. * @param {Boolean=} sortShapeProp whether or not to sort propTypes defined in PropTypes.shape. * @returns {Object|*|{range, text}} the sort order of the two elements. */ diff --git a/tests/lib/rules/no-typos.js b/tests/lib/rules/no-typos.js index 6fccf13a02..e0c854d110 100644 --- a/tests/lib/rules/no-typos.js +++ b/tests/lib/rules/no-typos.js @@ -207,13 +207,13 @@ ruleTester.run('no-typos', rule, { const propTypes = "PROPTYPES" const contextTypes = "CONTEXTTYPES" const childContextTypes = "CHILDCONTEXTTYPES" - const defautProps = "DEFAULTPROPS" + const defaultProps = "DEFAULTPROPS" class First extends React.Component {} First[propTypes] = {}; First[contextTypes] = {}; First[childContextTypes] = {}; - First[defautProps] = {}; + First[defaultProps] = {}; `, parserOptions, }, @@ -563,10 +563,10 @@ ruleTester.run('no-typos', rule, { #somethingPrivate() { // ... } - + render() { const { value = '' } = this.props; - + return (