Skip to content

Commit 11306e1

Browse files
bmishljharb
authored andcommitted
[Docs] Fix typos
1 parent 9836d3a commit 11306e1

23 files changed

+41
-39
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
3939
* [Docs] document which rules provide suggestions ([#3359][], [#3365][] @bmish)
4040
* [Docs] Consistent rule descriptions and doc sections ([#3361][] @bmish)
4141
* [Docs] Standardize deprecated rule notice ([#3364][] @bmish)
42+
* [Docs] Fix typos ([#3366][] @bmish)
4243

44+
[#3366]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3366
4345
[#3365]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3365
4446
[#3364]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3364
4547
[#3361]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3361

docs/rules/jsx-pascal-case.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Examples of **correct** code for this rule, when `allowLeadingUnderscore` is `tr
7979
</_AllowedComponent>
8080
```
8181

82-
**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.
82+
**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.
8383

8484
## When Not To Use It
8585

docs/rules/jsx-props-no-spreading.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Examples of **incorrect** code for this rule, when `custom` is set to `ignore`:
6868

6969
### explicitSpread
7070

71-
`explicitSpread` set to `ignore` will ignore spread operators that are explicilty listing all object properties within that spread. Default is set to `enforce`.
71+
`explicitSpread` set to `ignore` will ignore spread operators that are explicitly listing all object properties within that spread. Default is set to `enforce`.
7272

7373
Examples of **correct** code for this rule, when `explicitSpread` is set to `ignore`:
7474

docs/rules/no-arrow-function-lifecycle.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.
44

5-
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.
5+
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.
66

77
## Rule Details
88

docs/rules/no-unstable-nested-components.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
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.
44

5-
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).
5+
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).
66

77
## Rule Details
88

docs/rules/sort-prop-types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Enforce propTypes declarations alphabetical sorting (react/sort-prop-types)
22

3-
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.
3+
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.
44

55
## Rule Details
66

lib/rules/jsx-curly-brace-presence.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ module.exports = {
138138
)).join(HTML_ENTITY);
139139

140140
const htmlEntities = text.match(HTML_ENTITY_REGEX());
141-
return htmlEntities.reduce((acc, htmlEntitiy) => (
142-
acc.replace(HTML_ENTITY, htmlEntitiy)
141+
return htmlEntities.reduce((acc, htmlEntity) => (
142+
acc.replace(HTML_ENTITY, htmlEntity)
143143
), withCurlyBraces);
144144
}
145145

@@ -244,8 +244,8 @@ module.exports = {
244244
}
245245

246246
// Bail out if there is any character that needs to be escaped in JSX
247-
// because escaping decreases readiblity and the original code may be more
248-
// readible anyway or intentional for other specific reasons
247+
// because escaping decreases readability and the original code may be more
248+
// readable anyway or intentional for other specific reasons
249249
function lintUnnecessaryCurly(JSXExpressionNode) {
250250
const expression = JSXExpressionNode.expression;
251251
const expressionType = expression.type;

lib/rules/no-access-state-in-setstate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ module.exports = {
130130
break;
131131
}
132132

133-
// Storing all variables containg this.state
133+
// Storing all variables containing this.state
134134
if (current.type === 'VariableDeclarator') {
135135
vars.push({
136136
node,

lib/rules/no-danger.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const DANGEROUS_PROPERTIES = fromEntries(DANGEROUS_PROPERTY_NAMES.map((prop) =>
2929
/**
3030
* Checks if a JSX attribute is dangerous.
3131
* @param {String} name - Name of the attribute to check.
32-
* @returns {boolean} Whether or not the attribute is dnagerous.
32+
* @returns {boolean} Whether or not the attribute is dangerous.
3333
*/
3434
function isDangerous(name) {
3535
return has(DANGEROUS_PROPERTIES, name);

lib/rules/no-direct-mutation-state.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module.exports = {
5656
}
5757

5858
/**
59-
* Walks throughs the MemberExpression to the top-most property.
59+
* Walks through the MemberExpression to the top-most property.
6060
* @param {Object} node The node to process
6161
* @returns {Object} The outer-most MemberExpression
6262
*/

lib/rules/no-unescaped-entities.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module.exports = {
8181
const configuration = context.options[0] || {};
8282
const entities = configuration.forbid || DEFAULTS;
8383

84-
// HTML entites are already escaped in node.value (as well as node.raw),
84+
// HTML entities are already escaped in node.value (as well as node.raw),
8585
// so pull the raw text from context.getSourceCode()
8686
for (let i = node.loc.start.line; i <= node.loc.end.line; i++) {
8787
let rawLine = context.getSourceCode().lines[i - 1];

lib/rules/no-unstable-nested-components.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ module.exports = {
432432
|| isMapCall(node)
433433
|| isMapCall(node.parent)
434434

435-
// Do not mark components declared inside hooks (or falsly '() => null' clean-up methods)
435+
// Do not mark components declared inside hooks (or falsy '() => null' clean-up methods)
436436
|| isReturnStatementOfHook(node, context)
437437

438438
// Do not mark objects containing render methods
@@ -441,7 +441,7 @@ module.exports = {
441441
// Prevent reporting nested class components twice
442442
|| isInsideRenderMethod(node)
443443

444-
// Prevent falsely reporting deteceted "components" which do not return JSX
444+
// Prevent falsely reporting detected "components" which do not return JSX
445445
|| isStatelessComponentReturningNull(node)
446446
) {
447447
return;

lib/rules/prefer-stateless-function.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ module.exports = {
168168
* @see eslint no-useless-constructor rule
169169
* @param {Array} body - constructor body content.
170170
* @param {Array} ctorParams - The params to check against super call.
171-
* @returns {boolean} true if the construtor body is redundant
171+
* @returns {boolean} true if the constructor body is redundant
172172
*/
173173
function isRedundantSuperCall(body, ctorParams) {
174174
return (

lib/util/Components.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ function componentRule(rule, context) {
386386
},
387387

388388
/**
389-
* It will check wheater memo/forwardRef is wrapping existing component or
389+
* It will check whether memo/forwardRef is wrapping existing component or
390390
* creating a new one.
391391
* @param {object} node
392392
* @returns {boolean}

lib/util/ast.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function loopNodes(nodes) {
4444
}
4545

4646
/**
47-
* Find a return statment in the current node
47+
* Find a return statement in the current node
4848
*
4949
* @param {ASTNode} node The AST node being checked
5050
* @returns {ASTNode | false}

lib/util/propTypesSort.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function getShapeProperties(node) {
6666
* @param {Context} context The context of the two nodes.
6767
* @param {Boolean=} ignoreCase whether or not to ignore case when comparing the two elements.
6868
* @param {Boolean=} requiredFirst whether or not to sort required elements first.
69-
* @param {Boolean=} callbacksLast whether or not to sort callbacks after everyting else.
69+
* @param {Boolean=} callbacksLast whether or not to sort callbacks after everything else.
7070
* @returns {Number} the sort order of the two elements.
7171
*/
7272
function sorter(a, b, context, ignoreCase, requiredFirst, callbacksLast) {
@@ -112,7 +112,7 @@ function sorter(a, b, context, ignoreCase, requiredFirst, callbacksLast) {
112112
* @param {Array} declarations The context of the two nodes.
113113
* @param {Boolean=} ignoreCase whether or not to ignore case when comparing the two elements.
114114
* @param {Boolean=} requiredFirst whether or not to sort required elements first.
115-
* @param {Boolean=} callbacksLast whether or not to sort callbacks after everyting else.
115+
* @param {Boolean=} callbacksLast whether or not to sort callbacks after everything else.
116116
* @param {Boolean=} sortShapeProp whether or not to sort propTypes defined in PropTypes.shape.
117117
* @returns {Object|*|{range, text}} the sort order of the two elements.
118118
*/

tests/lib/rules/no-typos.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,13 @@ ruleTester.run('no-typos', rule, {
207207
const propTypes = "PROPTYPES"
208208
const contextTypes = "CONTEXTTYPES"
209209
const childContextTypes = "CHILDCONTEXTTYPES"
210-
const defautProps = "DEFAULTPROPS"
210+
const defaultProps = "DEFAULTPROPS"
211211
212212
class First extends React.Component {}
213213
First[propTypes] = {};
214214
First[contextTypes] = {};
215215
First[childContextTypes] = {};
216-
First[defautProps] = {};
216+
First[defaultProps] = {};
217217
`,
218218
parserOptions,
219219
},
@@ -563,10 +563,10 @@ ruleTester.run('no-typos', rule, {
563563
#somethingPrivate() {
564564
// ...
565565
}
566-
566+
567567
render() {
568568
const { value = '' } = this.props;
569-
569+
570570
return (
571571
<textarea>
572572
{value}

tests/lib/rules/no-unused-prop-types.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -2363,7 +2363,7 @@ ruleTester.run('no-unused-prop-types', rule, {
23632363
features: ['class fields'],
23642364
},
23652365
{
2366-
// Destrucuted props inside of async class method
2366+
// Destructured props inside of async class method
23672367
code: `
23682368
export class Example extends Component {
23692369
static propTypes = {
@@ -3825,7 +3825,7 @@ ruleTester.run('no-unused-prop-types', rule, {
38253825
},
38263826
},
38273827
};
3828-
3828+
38293829
export const Daily = ({ history, match: {
38303830
params: {
38313831
date = moment().toISOString(),
@@ -3855,7 +3855,7 @@ ruleTester.run('no-unused-prop-types', rule, {
38553855
test: string,
38563856
callback: () => void,
38573857
};
3858-
3858+
38593859
export default function Foo(props: Props) {
38603860
return (
38613861
<div>
@@ -3900,13 +3900,13 @@ ruleTester.run('no-unused-prop-types', rule, {
39003900
selectedId: '',
39013901
};
39023902
}
3903-
3903+
39043904
onChange = ({id}: {id: string}) => { // This will say: 'id' PropType is defined but prop is never used (react/no-unused-prop-types)
39053905
this.setState({
39063906
selectedId: id,
39073907
});
39083908
};
3909-
3909+
39103910
render() {
39113911
const {selectedId} = this.state;
39123912
return (
@@ -3926,7 +3926,7 @@ ruleTester.run('no-unused-prop-types', rule, {
39263926
code: `
39273927
function Foo (props) {
39283928
return <div>{ renderPhoto() }</div>;
3929-
3929+
39303930
function renderPhoto () {
39313931
return <div>{ props.renderPhotoTools() }</div>;
39323932
}

tests/lib/rules/prefer-stateless-function.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ ruleTester.run('prefer-stateless-function', rule, {
7676
options: [{ ignorePureComponents: true }],
7777
},
7878
{
79-
// Has a lifecyle method
79+
// Has a lifecycle method
8080
code: `
8181
class Foo extends React.Component {
8282
shouldComponentUpdate() {

tests/lib/rules/prop-types.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2112,7 +2112,7 @@ ruleTester.run('prop-types', rule, {
21122112
},
21132113
{
21142114
code: `
2115-
const withOverlayState = <P: {foo: string}>(WrappedComponent: ComponentType<P>): CpmponentType<P> => (
2115+
const withOverlayState = <P: {foo: string}>(WrappedComponent: ComponentType<P>): ComponentType<P> => (
21162116
class extends React.Component<P> {
21172117
constructor(props) {
21182118
super(props);
@@ -6552,7 +6552,7 @@ ruleTester.run('prop-types', rule, {
65526552
},
65536553
{
65546554
code: `
6555-
const withOverlayState = <P: {foo: string}>(WrappedComponent: ComponentType<P>): CpmponentType<P> => (
6555+
const withOverlayState = <P: {foo: string}>(WrappedComponent: ComponentType<P>): ComponentType<P> => (
65566556
class extends React.Component<P> {
65576557
constructor(props) {
65586558
super(props);

tests/lib/rules/require-optimization.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ruleTester.run('react-require-optimization', rule, {
4747
import React, {Component} from "react";
4848
@reactMixin.decorate(PureRenderMixin)
4949
class YourComponent extends Component {
50-
componetnDidMount () {}
50+
componentDidMount () {}
5151
render() {}
5252
}
5353
`,

tests/lib/rules/static-property-placement.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const ruleTester = new RuleTester(ruleTesterConfig);
4444
ruleTester.run('static-property-placement', rule, {
4545
valid: parsers.all([
4646
// ------------------------------------------------------------------------------
47-
// Ignore creatClass/createReactClass and Static Functional Components
47+
// Ignore createClass/createReactClass and Static Functional Components
4848
// ------------------------------------------------------------------------------
4949
{
5050
// Do not error on createReactClass pragma
@@ -1149,7 +1149,7 @@ ruleTester.run('static-property-placement', rule, {
11491149

11501150
invalid: parsers.all([
11511151
// ------------------------------------------------------------------------------
1152-
// expected static field when got property assigment
1152+
// expected static field when got property assignment
11531153
// ------------------------------------------------------------------------------
11541154
{
11551155
// Error if multiple properties are incorrectly positioned according to config
@@ -1929,7 +1929,7 @@ ruleTester.run('static-property-placement', rule, {
19291929
// combined - mixed
19301930
// ------------------------------------------------------------------------------
19311931
{
1932-
// Error if mixed property positions but dont match config
1932+
// Error if mixed property positions but don't match config
19331933
code: `
19341934
class MyComponent extends React.Component {
19351935
static childContextTypes = {
@@ -1992,7 +1992,7 @@ ruleTester.run('static-property-placement', rule, {
19921992
],
19931993
},
19941994
{
1995-
// Error if mixed property positions but dont match config
1995+
// Error if mixed property positions but don't match config
19961996
code: `
19971997
class MyComponent extends React.Component {
19981998
static childContextTypes = {

tests/util/ast.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('ast', () => {
5858
spy.resetHistory();
5959

6060
traverseReturns(parseCode(`
61-
({prop}) => 'someething'
61+
({prop}) => 'something'
6262
`).expression, mockContext, spy);
6363

6464
assert(spy.calledOnce);

0 commit comments

Comments
 (0)