Skip to content

Commit

Permalink
Docs: Fix spelling mistakes (#12861)
Browse files Browse the repository at this point in the history
I searched for typos / spelling mistake using cspell. I manually fixed the obvious typos that were reported (and ignored thousands of other false positive matches).
  • Loading branch information
bmish committed Feb 4, 2020
1 parent a5b3c5f commit 33efd71
Show file tree
Hide file tree
Showing 56 changed files with 91 additions and 91 deletions.
2 changes: 1 addition & 1 deletion conf/environments.js
Expand Up @@ -15,7 +15,7 @@ const globals = require("globals");
//------------------------------------------------------------------------------

/**
* Get the object that has differentce.
* Get the object that has difference.
* @param {Record<string,boolean>} current The newer object.
* @param {Record<string,boolean>} prev The older object.
* @returns {Record<string,boolean>} The difference object.
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/working-with-custom-parsers.md
Expand Up @@ -46,7 +46,7 @@ All nodes must have `range` property.
* `range` (`number[]`) is an array of two numbers. Both numbers are a 0-based index which is the position in the array of source code characters. The first is the start position of the node, the second is the end position of the node. `code.slice(node.range[0], node.range[1])` must be the text of the node. This range does not include spaces/parentheses which are around the node.
* `loc` (`SourceLocation`) must not be `null`. [The `loc` property is defined as nullable by ESTree](https://github.com/estree/estree/blob/25834f7247d44d3156030f8e8a2d07644d771fdb/es5.md#node-objects), but ESLint requires this property. On the other hand, `SourceLocation#source` property can be `undefined`. ESLint does not use the `SourceLocation#source` property.

The `parent` property of all nodes must be rewriteable. ESLint sets each node's `parent` property to its parent node while traversing, before any rules have access to the AST.
The `parent` property of all nodes must be rewritable. ESLint sets each node's `parent` property to its parent node while traversing, before any rules have access to the AST.

### The `Program` node:

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/no-implicit-globals.md
Expand Up @@ -88,7 +88,7 @@ Bar.prototype.baz = function () {

### Read-only global variables

This rule also disallows redeclarations of read-only global variables and assigments to read-only global variables.
This rule also disallows redeclarations of read-only global variables and assignments to read-only global variables.

A read-only global variable can be a built-in ES global (e.g. `Array`), an environment specific global
(e.g. `window` in the browser environment), or a global variable defined as `readonly` in the configuration file
Expand Down Expand Up @@ -180,7 +180,7 @@ Examples of **incorrect** code for this rule with `"lexicalBindings"` option set
```js
/*eslint no-implicit-globals: ["error", {"lexicalBindings": true}]*/

const MyGobalFunction = (function() {
const MyGlobalFunction = (function() {
const a = 1;
let b = 2;
return function() {
Expand All @@ -194,7 +194,7 @@ Examples of **correct** code for this rule with `"lexicalBindings"` option set t
```js
/*eslint no-implicit-globals: ["error", {"lexicalBindings": true}]*/

window.MyGobalFunction = (function() {
window.MyGlobalFunction = (function() {
const a = 1;
let b = 2;
return function() {
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-regex-literals.md
Expand Up @@ -85,7 +85,7 @@ new RegExp(prefix + "abc");

RegExp(`${prefix}abc`);

new RegExp(String.raw`^\d\. ${sufix}`);
new RegExp(String.raw`^\d\. ${suffix}`);
```

## Further Reading
Expand Down
2 changes: 1 addition & 1 deletion lib/cli-engine/config-array/config-array.js
Expand Up @@ -5,7 +5,7 @@
* config file, base config files that were extended, loaded parsers, and loaded
* plugins.
*
* `ConfigArray` class provies three properties and two methods.
* `ConfigArray` class provides three properties and two methods.
*
* - `pluginEnvironments`
* - `pluginProcessors`
Expand Down
4 changes: 2 additions & 2 deletions lib/cli-engine/file-enumerator.js
Expand Up @@ -6,7 +6,7 @@
* 1. Find target files by processing glob patterns.
* 2. Tie each target file and appropriate configuration.
*
* It provies a method:
* It provides a method:
*
* - `iterateFiles(patterns)`
* Iterate files which are matched by given patterns together with the
Expand Down Expand Up @@ -283,7 +283,7 @@ class FileEnumerator {
continue;
}

// Iterate files of this pttern.
// Iterate files of this pattern.
for (const { config, filePath, flag } of this._iterateFiles(pattern)) {
foundRegardlessOfIgnored = true;
if (flag === IGNORED_SILENTLY) {
Expand Down
2 changes: 1 addition & 1 deletion lib/init/npm-utils.js
Expand Up @@ -135,7 +135,7 @@ function check(packages, opt) {
*
* Convenience wrapper around check().
* @param {string[]} packages Array of node modules to check.
* @param {string} rootDir The directory contianing a package.json
* @param {string} rootDir The directory containing a package.json
* @returns {Object} An object whose keys are the module names
* and values are booleans indicating installation.
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/linter/code-path-analysis/debug-helpers.js
Expand Up @@ -70,7 +70,7 @@ module.exports = {

/**
* Dumps a DOT code of a given code path.
* The DOT code can be visialized with Graphvis.
* The DOT code can be visualized with Graphvis.
* @param {CodePath} codePath A code path to dump.
* @returns {void}
* @see http://www.graphviz.org
Expand Down Expand Up @@ -135,7 +135,7 @@ module.exports = {

/**
* Makes a DOT code of a given code path.
* The DOT code can be visialized with Graphvis.
* The DOT code can be visualized with Graphvis.
* @param {CodePath} codePath A code path to make DOT.
* @param {Object} traceMap Optional. A map to check whether or not segments had been done.
* @returns {string} A DOT code of the code path.
Expand Down
2 changes: 1 addition & 1 deletion lib/linter/code-path-analysis/fork-context.js
Expand Up @@ -211,7 +211,7 @@ class ForkContext {
}

/**
* Clears all secments in this context.
* Clears all segments in this context.
* @returns {void}
*/
clear() {
Expand Down
2 changes: 1 addition & 1 deletion lib/linter/linter.js
Expand Up @@ -1272,7 +1272,7 @@ class Linter {
* @param {string|SourceCode} textOrSourceCode The source code.
* @param {ConfigData|ExtractedConfig} config The config array.
* @param {VerifyOptions&ProcessorOptions} options The options.
* @param {ConfigArray} [configForRecursive] The `CofnigArray` object to apply multiple processors recursively.
* @param {ConfigArray} [configForRecursive] The `ConfigArray` object to apply multiple processors recursively.
* @returns {LintMessage[]} The found problems.
*/
_verifyWithProcessor(textOrSourceCode, config, options, configForRecursive) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/consistent-this.js
Expand Up @@ -114,7 +114,7 @@ module.exports = {
}

/**
* Check each alias to ensure that is was assinged to the correct value.
* Check each alias to ensure that is was assigned to the correct value.
* @returns {void}
*/
function ensureWasAssigned() {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/linebreak-style.js
Expand Up @@ -64,7 +64,7 @@ module.exports = {
//--------------------------------------------------------------------------

return {
Program: function checkForlinebreakStyle(node) {
Program: function checkForLinebreakStyle(node) {
const linebreakStyle = context.options[0] || "unix",
expectedLF = linebreakStyle === "unix",
expectedLFChars = expectedLF ? "\n" : "\r\n",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/max-len.js
Expand Up @@ -203,7 +203,7 @@ module.exports = {
* stripped.
* @param {string} line The source line with a trailing comment
* @param {ASTNode} comment The comment to remove
* @returns {string} Line without comment and trailing whitepace
* @returns {string} Line without comment and trailing whitespace
*/
function stripTrailingComment(line, comment) {

Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-confusing-arrow.js
@@ -1,6 +1,6 @@
/**
* @fileoverview A rule to warn against using arrow functions when they could be
* confused with comparisions
* confused with comparisons
* @author Jxck <https://github.com/Jxck>
*/

Expand Down Expand Up @@ -71,7 +71,7 @@ module.exports = {
messageId: "confusing",
fix(fixer) {

// if `allowParens` is not set to true dont bother wrapping in parens
// if `allowParens` is not set to true don't bother wrapping in parens
return allowParens && fixer.replaceText(node.body, `(${sourceCode.getText(node.body)})`);
}
});
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-control-regex.js
@@ -1,5 +1,5 @@
/**
* @fileoverview Rule to forbid control charactes from regular expressions.
* @fileoverview Rule to forbid control characters from regular expressions.
* @author Nicholas C. Zakas
*/

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-lonely-if.js
@@ -1,5 +1,5 @@
/**
* @fileoverview Rule to disallow if as the only statmenet in an else block
* @fileoverview Rule to disallow if as the only statement in an else block
* @author Brandon Mills
*/
"use strict";
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-regex-spaces.js
Expand Up @@ -109,7 +109,7 @@ module.exports = {
}
});

// Report only the first occurence of consecutive spaces
// Report only the first occurrence of consecutive spaces
return;
}
}
Expand Down
12 changes: 6 additions & 6 deletions lib/rules/no-unused-vars.js
Expand Up @@ -282,7 +282,7 @@ module.exports = {
function getRhsNode(ref, prevRhsNode) {
const id = ref.identifier;
const parent = id.parent;
const granpa = parent.parent;
const grandparent = parent.parent;
const refScope = ref.from.variableScope;
const varScope = ref.resolved.scope.variableScope;
const canBeUsedLater = refScope !== varScope || astUtils.isInLoop(id);
Expand All @@ -296,7 +296,7 @@ module.exports = {
}

if (parent.type === "AssignmentExpression" &&
granpa.type === "ExpressionStatement" &&
grandparent.type === "ExpressionStatement" &&
id === parent.left &&
!canBeUsedLater
) {
Expand Down Expand Up @@ -342,7 +342,7 @@ module.exports = {

/*
* If it encountered statements, this is a complex pattern.
* Since analyzeing complex patterns is hard, this returns `true` to avoid false positive.
* Since analyzing complex patterns is hard, this returns `true` to avoid false positive.
*/
return true;
}
Expand Down Expand Up @@ -389,20 +389,20 @@ module.exports = {
function isReadForItself(ref, rhsNode) {
const id = ref.identifier;
const parent = id.parent;
const granpa = parent.parent;
const grandparent = parent.parent;

return ref.isRead() && (

// self update. e.g. `a += 1`, `a++`
(// in RHS of an assignment for itself. e.g. `a = a + 1`
((
parent.type === "AssignmentExpression" &&
granpa.type === "ExpressionStatement" &&
grandparent.type === "ExpressionStatement" &&
parent.left === id
) ||
(
parent.type === "UpdateExpression" &&
granpa.type === "ExpressionStatement"
grandparent.type === "ExpressionStatement"
) || rhsNode &&
isInside(id, rhsNode) &&
!isInsideOfStorableFunction(id, rhsNode)))
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-useless-concat.js
@@ -1,5 +1,5 @@
/**
* @fileoverview disallow unncessary concatenation of template strings
* @fileoverview disallow unnecessary concatenation of template strings
* @author Henry Zhu
*/
"use strict";
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-useless-constructor.js
Expand Up @@ -115,7 +115,7 @@ function isPassingThrough(ctorParams, superArgs) {
* Checks whether the constructor body is a redundant super call.
* @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 (
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-useless-return.js
Expand Up @@ -32,7 +32,7 @@ function remove(array, element) {
/**
* Checks whether it can remove the given return statement or not.
* @param {ASTNode} node The return statement node to check.
* @returns {boolean} `true` if the node is removeable.
* @returns {boolean} `true` if the node is removable.
*/
function isRemovable(node) {
return astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type);
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/operator-assignment.js
Expand Up @@ -26,10 +26,10 @@ function isCommutativeOperatorWithShorthand(operator) {
}

/**
* Checks whether an operator is not commuatative and has an operator assignment
* Checks whether an operator is not commutative and has an operator assignment
* shorthand form.
* @param {string} operator Operator to check.
* @returns {boolean} True if the operator is not commuatative and has
* @returns {boolean} True if the operator is not commutative and has
* a shorthand form.
*/
function isNonCommutativeOperatorWithShorthand(operator) {
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/padded-blocks.js
Expand Up @@ -145,9 +145,9 @@ module.exports = {
}

/**
* Checks if the given token is preceeded by a blank line.
* Checks if the given token is preceded by a blank line.
* @param {Token} token The token to check
* @returns {boolean} Whether or not the token is preceeded by a blank line
* @returns {boolean} Whether or not the token is preceded by a blank line
*/
function getLastBlockToken(token) {
let last = token,
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-arrow-callback.js
Expand Up @@ -56,7 +56,7 @@ function getVariableOfArguments(scope) {
}

/**
* Checkes whether or not a given node is a callback.
* Checks whether or not a given node is a callback.
* @param {ASTNode} node A node to check.
* @returns {Object}
* {boolean} retv.isCallback - `true` if the node is a callback.
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-object-spread.js
Expand Up @@ -98,7 +98,7 @@ function argNeedsParens(node, sourceCode) {

/**
* Get the parenthesis tokens of a given ObjectExpression node.
* This incldues the braces of the object literal and enclosing parentheses.
* This includes the braces of the object literal and enclosing parentheses.
* @param {ASTNode} node The node to get.
* @param {Token} leftArgumentListParen The opening paren token of the argument list.
* @param {SourceCode} sourceCode The source code object to get tokens.
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/prefer-reflect.js
Expand Up @@ -65,7 +65,7 @@ module.exports = {
preventExtensions: "Object.preventExtensions"
};

const reflectSubsitutes = {
const reflectSubstitutes = {
apply: "Reflect.apply",
call: "Reflect.apply",
defineProperty: "Reflect.defineProperty",
Expand Down Expand Up @@ -101,11 +101,11 @@ module.exports = {
CallExpression(node) {
const methodName = (node.callee.property || {}).name;
const isReflectCall = (node.callee.object || {}).name === "Reflect";
const hasReflectSubsitute = Object.prototype.hasOwnProperty.call(reflectSubsitutes, methodName);
const hasReflectSubsitute = Object.prototype.hasOwnProperty.call(reflectSubstitutes, methodName);
const userConfiguredException = exceptions.indexOf(methodName) !== -1;

if (hasReflectSubsitute && !isReflectCall && !userConfiguredException) {
report(node, existingNames[methodName], reflectSubsitutes[methodName]);
report(node, existingNames[methodName], reflectSubstitutes[methodName]);
}
},
UnaryExpression(node) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/require-atomic-updates.js
Expand Up @@ -223,7 +223,7 @@ module.exports = {

/*
* Register the variable to verify after ESLint traversed the `writeExpr` node
* if this reference is an assignment to a variable which is referred from other clausure.
* if this reference is an assignment to a variable which is referred from other closure.
*/
if (writeExpr &&
writeExpr.parent.right === writeExpr && // ← exclude variable declarations.
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/semi.js
Expand Up @@ -135,7 +135,7 @@ module.exports = {
}

/**
* Check whether a given semicolon token is redandant.
* Check whether a given semicolon token is redundant.
* @param {Token} semiToken A semicolon token to check.
* @returns {boolean} `true` if the next token is `;` or `}`.
*/
Expand Down
10 changes: 5 additions & 5 deletions lib/rules/sort-keys.js
Expand Up @@ -41,7 +41,7 @@ function getPropertyName(node) {
* Functions which check that the given 2 names are in specific order.
*
* Postfix `I` is meant insensitive.
* Postfix `N` is meant natual.
* Postfix `N` is meant natural.
* @private
*/
const isValidOrders = {
Expand Down Expand Up @@ -118,10 +118,10 @@ module.exports = {
const order = context.options[0] || "asc";
const options = context.options[1];
const insensitive = options && options.caseSensitive === false;
const natual = options && options.natural;
const natural = options && options.natural;
const minKeys = options && options.minKeys;
const isValidOrder = isValidOrders[
order + (insensitive ? "I" : "") + (natual ? "N" : "")
order + (insensitive ? "I" : "") + (natural ? "N" : "")
];

// The stack to save the previous property's name for each object literals.
Expand Down Expand Up @@ -167,13 +167,13 @@ module.exports = {
context.report({
node,
loc: node.key.loc,
message: "Expected object keys to be in {{natual}}{{insensitive}}{{order}}ending order. '{{thisName}}' should be before '{{prevName}}'.",
message: "Expected object keys to be in {{natural}}{{insensitive}}{{order}}ending order. '{{thisName}}' should be before '{{prevName}}'.",
data: {
thisName,
prevName,
order,
insensitive: insensitive ? "insensitive " : "",
natual: natual ? "natural " : ""
natural: natural ? "natural " : ""
}
});
}
Expand Down

0 comments on commit 33efd71

Please sign in to comment.