From c94f258ead297bd6b9b80ccd8c14cda46a32c57b Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Mon, 3 Feb 2020 21:28:49 -0800 Subject: [PATCH] Docs: Fix spelling mistakes 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). --- conf/environments.js | 2 +- docs/developer-guide/working-with-custom-parsers.md | 2 +- docs/rules/no-implicit-globals.md | 6 +++--- docs/rules/prefer-regex-literals.md | 2 +- lib/cli-engine/config-array/config-array.js | 2 +- lib/cli-engine/file-enumerator.js | 4 ++-- lib/init/npm-utils.js | 2 +- lib/linter/code-path-analysis/debug-helpers.js | 4 ++-- lib/linter/code-path-analysis/fork-context.js | 2 +- lib/linter/linter.js | 2 +- lib/rules/consistent-this.js | 2 +- lib/rules/linebreak-style.js | 2 +- lib/rules/max-len.js | 2 +- lib/rules/no-confusing-arrow.js | 4 ++-- lib/rules/no-control-regex.js | 2 +- lib/rules/no-lonely-if.js | 2 +- lib/rules/no-regex-spaces.js | 2 +- lib/rules/no-unused-vars.js | 12 ++++++------ lib/rules/no-useless-concat.js | 2 +- lib/rules/no-useless-constructor.js | 2 +- lib/rules/no-useless-return.js | 2 +- lib/rules/operator-assignment.js | 4 ++-- lib/rules/padded-blocks.js | 4 ++-- lib/rules/prefer-arrow-callback.js | 2 +- lib/rules/prefer-object-spread.js | 2 +- lib/rules/prefer-reflect.js | 6 +++--- lib/rules/require-atomic-updates.js | 2 +- lib/rules/semi.js | 2 +- lib/rules/sort-keys.js | 10 +++++----- lib/rules/space-in-parens.js | 4 ++-- lib/rules/space-infix-ops.js | 6 +++--- lib/shared/config-validator.js | 2 +- lib/shared/naming.js | 2 +- lib/source-code/source-code.js | 2 +- lib/source-code/token-store/utils.js | 2 +- tests/bin/eslint.js | 2 +- tests/lib/_utils.js | 2 +- tests/lib/cli-engine/cli-engine.js | 6 +++--- tests/lib/cli-engine/config-array-factory.js | 2 +- tests/lib/linter/linter.js | 2 +- tests/lib/options.js | 2 +- tests/lib/rules/camelcase.js | 2 +- tests/lib/rules/max-lines-per-function.js | 4 ++-- tests/lib/rules/no-extra-parens.js | 2 +- tests/lib/rules/no-implicit-globals.js | 12 ++++++------ tests/lib/rules/no-multi-assign.js | 2 +- tests/lib/rules/no-regex-spaces.js | 2 +- tests/lib/rules/no-unused-vars.js | 2 +- tests/lib/rules/no-useless-concat.js | 2 +- tests/lib/rules/one-var-declaration-per-line.js | 2 +- tests/lib/rules/padded-blocks.js | 2 +- tests/lib/rules/prefer-destructuring.js | 4 ++-- tests/lib/rules/prefer-regex-literals.js | 6 +++--- tests/lib/rules/quotes.js | 2 +- tests/lib/shared/naming.js | 6 +++--- tools/internal-testers/event-generator-tester.js | 4 ++-- 56 files changed, 91 insertions(+), 91 deletions(-) diff --git a/conf/environments.js b/conf/environments.js index 10e6fdaa70fc..ee5ee1b4e5b2 100644 --- a/conf/environments.js +++ b/conf/environments.js @@ -15,7 +15,7 @@ const globals = require("globals"); //------------------------------------------------------------------------------ /** - * Get the object that has differentce. + * Get the object that has difference. * @param {Record} current The newer object. * @param {Record} prev The older object. * @returns {Record} The difference object. diff --git a/docs/developer-guide/working-with-custom-parsers.md b/docs/developer-guide/working-with-custom-parsers.md index a7aa58f5eb7d..6387b848584c 100644 --- a/docs/developer-guide/working-with-custom-parsers.md +++ b/docs/developer-guide/working-with-custom-parsers.md @@ -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: diff --git a/docs/rules/no-implicit-globals.md b/docs/rules/no-implicit-globals.md index 7bf4caaae00f..04a3cd3fdbbf 100644 --- a/docs/rules/no-implicit-globals.md +++ b/docs/rules/no-implicit-globals.md @@ -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 @@ -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() { @@ -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() { diff --git a/docs/rules/prefer-regex-literals.md b/docs/rules/prefer-regex-literals.md index 396aaab89e0f..fea589d3412b 100644 --- a/docs/rules/prefer-regex-literals.md +++ b/docs/rules/prefer-regex-literals.md @@ -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 diff --git a/lib/cli-engine/config-array/config-array.js b/lib/cli-engine/config-array/config-array.js index 02f73b43e654..b3f7c1e73500 100644 --- a/lib/cli-engine/config-array/config-array.js +++ b/lib/cli-engine/config-array/config-array.js @@ -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` diff --git a/lib/cli-engine/file-enumerator.js b/lib/cli-engine/file-enumerator.js index 16e5182ad8a4..7c433d32f44b 100644 --- a/lib/cli-engine/file-enumerator.js +++ b/lib/cli-engine/file-enumerator.js @@ -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 @@ -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) { diff --git a/lib/init/npm-utils.js b/lib/init/npm-utils.js index 28c198fc8ada..555ea2b2b28c 100644 --- a/lib/init/npm-utils.js +++ b/lib/init/npm-utils.js @@ -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. */ diff --git a/lib/linter/code-path-analysis/debug-helpers.js b/lib/linter/code-path-analysis/debug-helpers.js index 35a4cb2dacb1..bde4e0a38ad2 100644 --- a/lib/linter/code-path-analysis/debug-helpers.js +++ b/lib/linter/code-path-analysis/debug-helpers.js @@ -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 @@ -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. diff --git a/lib/linter/code-path-analysis/fork-context.js b/lib/linter/code-path-analysis/fork-context.js index eb1d2de5a7db..2e872b5c0dbf 100644 --- a/lib/linter/code-path-analysis/fork-context.js +++ b/lib/linter/code-path-analysis/fork-context.js @@ -211,7 +211,7 @@ class ForkContext { } /** - * Clears all secments in this context. + * Clears all segments in this context. * @returns {void} */ clear() { diff --git a/lib/linter/linter.js b/lib/linter/linter.js index 76d35b49eefb..1d021d1e82e7 100644 --- a/lib/linter/linter.js +++ b/lib/linter/linter.js @@ -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) { diff --git a/lib/rules/consistent-this.js b/lib/rules/consistent-this.js index 16f53b5374cd..e5bc9678daef 100644 --- a/lib/rules/consistent-this.js +++ b/lib/rules/consistent-this.js @@ -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() { diff --git a/lib/rules/linebreak-style.js b/lib/rules/linebreak-style.js index 97d552ea07c9..078eaf2cd268 100644 --- a/lib/rules/linebreak-style.js +++ b/lib/rules/linebreak-style.js @@ -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", diff --git a/lib/rules/max-len.js b/lib/rules/max-len.js index 82229c3be489..995e0c520263 100644 --- a/lib/rules/max-len.js +++ b/lib/rules/max-len.js @@ -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) { diff --git a/lib/rules/no-confusing-arrow.js b/lib/rules/no-confusing-arrow.js index b9a0e6ed0a70..9009b64fa155 100644 --- a/lib/rules/no-confusing-arrow.js +++ b/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 */ @@ -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)})`); } }); diff --git a/lib/rules/no-control-regex.js b/lib/rules/no-control-regex.js index 24e6b197be0b..b39f731c3cdf 100644 --- a/lib/rules/no-control-regex.js +++ b/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 */ diff --git a/lib/rules/no-lonely-if.js b/lib/rules/no-lonely-if.js index 53f9445f835e..6552adc57528 100644 --- a/lib/rules/no-lonely-if.js +++ b/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"; diff --git a/lib/rules/no-regex-spaces.js b/lib/rules/no-regex-spaces.js index 7581e9271fdf..1b937ae0de89 100644 --- a/lib/rules/no-regex-spaces.js +++ b/lib/rules/no-regex-spaces.js @@ -109,7 +109,7 @@ module.exports = { } }); - // Report only the first occurence of consecutive spaces + // Report only the first occurrence of consecutive spaces return; } } diff --git a/lib/rules/no-unused-vars.js b/lib/rules/no-unused-vars.js index 63e6e048ef1e..7476ef20e398 100644 --- a/lib/rules/no-unused-vars.js +++ b/lib/rules/no-unused-vars.js @@ -282,7 +282,7 @@ module.exports = { function getRhsNode(ref, prevRhsNode) { const id = ref.identifier; const parent = id.parent; - const granpa = parent.parent; + const grandpa = parent.parent; const refScope = ref.from.variableScope; const varScope = ref.resolved.scope.variableScope; const canBeUsedLater = refScope !== varScope || astUtils.isInLoop(id); @@ -296,7 +296,7 @@ module.exports = { } if (parent.type === "AssignmentExpression" && - granpa.type === "ExpressionStatement" && + grandpa.type === "ExpressionStatement" && id === parent.left && !canBeUsedLater ) { @@ -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; } @@ -389,7 +389,7 @@ module.exports = { function isReadForItself(ref, rhsNode) { const id = ref.identifier; const parent = id.parent; - const granpa = parent.parent; + const grandpa = parent.parent; return ref.isRead() && ( @@ -397,12 +397,12 @@ module.exports = { (// in RHS of an assignment for itself. e.g. `a = a + 1` (( parent.type === "AssignmentExpression" && - granpa.type === "ExpressionStatement" && + grandpa.type === "ExpressionStatement" && parent.left === id ) || ( parent.type === "UpdateExpression" && - granpa.type === "ExpressionStatement" + grandpa.type === "ExpressionStatement" ) || rhsNode && isInside(id, rhsNode) && !isInsideOfStorableFunction(id, rhsNode))) diff --git a/lib/rules/no-useless-concat.js b/lib/rules/no-useless-concat.js index cdaca273eb00..50e039c2ce9a 100644 --- a/lib/rules/no-useless-concat.js +++ b/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"; diff --git a/lib/rules/no-useless-constructor.js b/lib/rules/no-useless-constructor.js index 2920328c6f39..4c34aeda7159 100644 --- a/lib/rules/no-useless-constructor.js +++ b/lib/rules/no-useless-constructor.js @@ -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 ( diff --git a/lib/rules/no-useless-return.js b/lib/rules/no-useless-return.js index 942d4eede996..ecdd44240c9e 100644 --- a/lib/rules/no-useless-return.js +++ b/lib/rules/no-useless-return.js @@ -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); diff --git a/lib/rules/operator-assignment.js b/lib/rules/operator-assignment.js index c35d23e2a92f..c4c8671f327a 100644 --- a/lib/rules/operator-assignment.js +++ b/lib/rules/operator-assignment.js @@ -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) { diff --git a/lib/rules/padded-blocks.js b/lib/rules/padded-blocks.js index dafa88115edd..bfdcf76f24fb 100644 --- a/lib/rules/padded-blocks.js +++ b/lib/rules/padded-blocks.js @@ -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, diff --git a/lib/rules/prefer-arrow-callback.js b/lib/rules/prefer-arrow-callback.js index 08126e5b1a54..1fdd7f2c8771 100644 --- a/lib/rules/prefer-arrow-callback.js +++ b/lib/rules/prefer-arrow-callback.js @@ -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. diff --git a/lib/rules/prefer-object-spread.js b/lib/rules/prefer-object-spread.js index 00f5fb6d4c89..1344433f52fa 100644 --- a/lib/rules/prefer-object-spread.js +++ b/lib/rules/prefer-object-spread.js @@ -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. diff --git a/lib/rules/prefer-reflect.js b/lib/rules/prefer-reflect.js index 796bbdf05fd4..261abce0dedc 100644 --- a/lib/rules/prefer-reflect.js +++ b/lib/rules/prefer-reflect.js @@ -65,7 +65,7 @@ module.exports = { preventExtensions: "Object.preventExtensions" }; - const reflectSubsitutes = { + const reflectSubstitutes = { apply: "Reflect.apply", call: "Reflect.apply", defineProperty: "Reflect.defineProperty", @@ -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) { diff --git a/lib/rules/require-atomic-updates.js b/lib/rules/require-atomic-updates.js index bdd6d81ebc47..4f6acceab804 100644 --- a/lib/rules/require-atomic-updates.js +++ b/lib/rules/require-atomic-updates.js @@ -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. diff --git a/lib/rules/semi.js b/lib/rules/semi.js index 3491f4765c77..d2f0670427b3 100644 --- a/lib/rules/semi.js +++ b/lib/rules/semi.js @@ -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 `}`. */ diff --git a/lib/rules/sort-keys.js b/lib/rules/sort-keys.js index a5ce445f71ae..f03325609eac 100644 --- a/lib/rules/sort-keys.js +++ b/lib/rules/sort-keys.js @@ -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 = { @@ -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. @@ -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 " : "" } }); } diff --git a/lib/rules/space-in-parens.js b/lib/rules/space-in-parens.js index 85ee74210d60..b0a604d955d7 100644 --- a/lib/rules/space-in-parens.js +++ b/lib/rules/space-in-parens.js @@ -169,7 +169,7 @@ module.exports = { } /** - * Determines if a closing paren is immediately preceeded by a required space + * Determines if a closing paren is immediately preceded by a required space * @param {Object} tokenBeforeClosingParen The token before the paren * @param {Object} closingParenToken The paren token * @returns {boolean} True if the closing paren is missing a required space @@ -190,7 +190,7 @@ module.exports = { } /** - * Determines if a closer paren is immediately preceeded by a disallowed space + * Determines if a closer paren is immediately preceded by a disallowed space * @param {Object} tokenBeforeClosingParen The token before the paren * @param {Object} closingParenToken The paren token * @returns {boolean} True if the closing paren has a disallowed space diff --git a/lib/rules/space-infix-ops.js b/lib/rules/space-infix-ops.js index bd2c0ae0e1d3..5a380ad1db21 100644 --- a/lib/rules/space-infix-ops.js +++ b/lib/rules/space-infix-ops.js @@ -123,11 +123,11 @@ module.exports = { * @private */ function checkConditional(node) { - const nonSpacedConsequesntNode = getFirstNonSpacedToken(node.test, node.consequent, "?"); + const nonSpacedConsequentNode = getFirstNonSpacedToken(node.test, node.consequent, "?"); const nonSpacedAlternateNode = getFirstNonSpacedToken(node.consequent, node.alternate, ":"); - if (nonSpacedConsequesntNode) { - report(node, nonSpacedConsequesntNode); + if (nonSpacedConsequentNode) { + report(node, nonSpacedConsequentNode); } else if (nonSpacedAlternateNode) { report(node, nonSpacedAlternateNode); } diff --git a/lib/shared/config-validator.js b/lib/shared/config-validator.js index 70eaf0a96705..458bd2a802b9 100644 --- a/lib/shared/config-validator.js +++ b/lib/shared/config-validator.js @@ -190,7 +190,7 @@ function validateRules( /** * Validates a `globals` section of a config file - * @param {Object} globalsConfig The `glboals` section + * @param {Object} globalsConfig The `globals` section * @param {string|null} source The name of the configuration source to report in the event of an error. * @returns {void} */ diff --git a/lib/shared/naming.js b/lib/shared/naming.js index b99155f15caf..32cff94538af 100644 --- a/lib/shared/naming.js +++ b/lib/shared/naming.js @@ -78,7 +78,7 @@ function getShorthandName(fullname, prefix) { /** * Gets the scope (namespace) of a term. * @param {string} term The term which may have the namespace. - * @returns {string} The namepace of the term if it has one. + * @returns {string} The namespace of the term if it has one. */ function getNamespaceFromTerm(term) { const match = term.match(NAMESPACE_REGEX); diff --git a/lib/source-code/source-code.js b/lib/source-code/source-code.js index 30b4e9ab5c26..591d5a7e454e 100644 --- a/lib/source-code/source-code.js +++ b/lib/source-code/source-code.js @@ -121,7 +121,7 @@ function isSpaceBetween(sourceCode, first, second, checkInsideOfJSXText) { currentToken.range[1] !== nextToken.range[0] || /* - * For backward compatibility, check speces in JSXText. + * For backward compatibility, check spaces in JSXText. * https://github.com/eslint/eslint/issues/12614 */ ( diff --git a/lib/source-code/token-store/utils.js b/lib/source-code/token-store/utils.js index 444684b52f1b..21e1d6ff7c3b 100644 --- a/lib/source-code/token-store/utils.js +++ b/lib/source-code/token-store/utils.js @@ -1,5 +1,5 @@ /** - * @fileoverview Define utilify functions for token store. + * @fileoverview Define utility functions for token store. * @author Toru Nagashima */ "use strict"; diff --git a/tests/bin/eslint.js b/tests/bin/eslint.js index 774a1ace5c39..8b771dc5bf54 100644 --- a/tests/bin/eslint.js +++ b/tests/bin/eslint.js @@ -23,7 +23,7 @@ function awaitExit(exitingProcess) { * Asserts that the exit code of a given child process will equal the given value. * @param {ChildProcess} exitingProcess The child process * @param {number} expectedExitCode The expected exit code of the child process - * @returns {Promise} A Promise that fufills if the exit code ends up matching, and rejects otherwise. + * @returns {Promise} A Promise that fulfills if the exit code ends up matching, and rejects otherwise. */ function assertExitCode(exitingProcess, expectedExitCode) { return awaitExit(exitingProcess).then(exitCode => { diff --git a/tests/lib/_utils.js b/tests/lib/_utils.js index 0662415103cb..76e973cc6676 100644 --- a/tests/lib/_utils.js +++ b/tests/lib/_utils.js @@ -1,5 +1,5 @@ /** - * @fileoverview uitls for rule tests. + * @fileoverview utils for rule tests. * @author 唯然 */ diff --git a/tests/lib/cli-engine/cli-engine.js b/tests/lib/cli-engine/cli-engine.js index 03a0a79f6ae5..058f4755bc47 100644 --- a/tests/lib/cli-engine/cli-engine.js +++ b/tests/lib/cli-engine/cli-engine.js @@ -3898,7 +3898,7 @@ describe("CLIEngine", () => { it("should return false for files outside of the cwd (with no ignore file provided)", () => { - // Default ignore patterns should not inadvertantly ignore files in parent directories + // Default ignore patterns should not inadvertently ignore files in parent directories const engine = new CLIEngine({ cwd: getFixturePath("ignored-paths", "no-ignore-file") }); assert(!engine.isPathIgnored(getFixturePath("ignored-paths", "undef.js"))); @@ -4745,7 +4745,7 @@ describe("CLIEngine", () => { describe("mutability", () => { describe("plugins", () => { - it("Loading plugin in one instance doesnt mutate to another instance", () => { + it("Loading plugin in one instance doesn't mutate to another instance", () => { const filePath = getFixturePath("single-quoted.js"); const engine1 = cliEngineWithPlugins({ cwd: path.join(fixtureDir, ".."), @@ -4767,7 +4767,7 @@ describe("CLIEngine", () => { }); describe("rules", () => { - it("Loading rules in one instance doesnt mutate to another instance", () => { + it("Loading rules in one instance doesn't mutate to another instance", () => { const filePath = getFixturePath("single-quoted.js"); const engine1 = new CLIEngine({ cwd: path.join(fixtureDir, ".."), diff --git a/tests/lib/cli-engine/config-array-factory.js b/tests/lib/cli-engine/config-array-factory.js index 15823ca67994..2e1d230a574b 100644 --- a/tests/lib/cli-engine/config-array-factory.js +++ b/tests/lib/cli-engine/config-array-factory.js @@ -1706,7 +1706,7 @@ describe("ConfigArrayFactory", () => { .toCompatibleObjectAsConfigFileContent(); } - it("should throw error if file doesnt exist", () => { + it("should throw error if file doesn't exist", () => { const { ConfigArrayFactory } = defineConfigArrayFactoryWithInMemoryFileSystem(); const factory = new ConfigArrayFactory(); diff --git a/tests/lib/linter/linter.js b/tests/lib/linter/linter.js index 71bfd262a790..9906193ebdad 100644 --- a/tests/lib/linter/linter.js +++ b/tests/lib/linter/linter.js @@ -4753,7 +4753,7 @@ describe("Linter", () => { assert.sameDeepMembers(Array.from(linter1.getRules().keys()), Array.from(linter2.getRules().keys())); }); - it("loading rule in one doesnt change the other", () => { + it("loading rule in one doesn't change the other", () => { linter1.defineRule("mock-rule", () => ({})); assert.isTrue(linter1.getRules().has("mock-rule"), "mock rule is present"); diff --git a/tests/lib/options.js b/tests/lib/options.js index 6e369635948a..940804aeeefe 100644 --- a/tests/lib/options.js +++ b/tests/lib/options.js @@ -265,7 +265,7 @@ describe("options", () => { assert.strictEqual(currentOptions.plugin[0], "single"); }); - it("should return an array when passed a comma-delimiated string", () => { + it("should return an array when passed a comma-delimited string", () => { const currentOptions = options.parse("--plugin foo,bar"); assert.isArray(currentOptions.plugin); diff --git a/tests/lib/rules/camelcase.js b/tests/lib/rules/camelcase.js index 1181561efa8f..b3d95f93ea62 100644 --- a/tests/lib/rules/camelcase.js +++ b/tests/lib/rules/camelcase.js @@ -148,7 +148,7 @@ ruleTester.run("camelcase", rule, { parserOptions: { ecmaVersion: 6, sourceType: "module" } }, { - code: "import { no_camelcased as camelCased, anoterCamelCased } from \"external-module\";", + code: "import { no_camelcased as camelCased, anotherCamelCased } from \"external-module\";", parserOptions: { ecmaVersion: 6, sourceType: "module" } }, { diff --git a/tests/lib/rules/max-lines-per-function.js b/tests/lib/rules/max-lines-per-function.js index 05fe40017a56..9107cd69f0f3 100644 --- a/tests/lib/rules/max-lines-per-function.js +++ b/tests/lib/rules/max-lines-per-function.js @@ -25,7 +25,7 @@ ruleTester.run("max-lines-per-function", rule, { options: [1] }, - // Test single line standlone function + // Test single line standalone function { code: "function name() {}", options: [1] @@ -91,7 +91,7 @@ ruleTester.run("max-lines-per-function", rule, { options: [{ max: 5, skipComments: true, skipBlankLines: false }] }, - // Multiple params on seperate lines test + // Multiple params on separate lines test { code: `function foo( aaa = 1, diff --git a/tests/lib/rules/no-extra-parens.js b/tests/lib/rules/no-extra-parens.js index 8d20ba7cd1c0..46de155fbb00 100644 --- a/tests/lib/rules/no-extra-parens.js +++ b/tests/lib/rules/no-extra-parens.js @@ -1403,7 +1403,7 @@ ruleTester.run("no-extra-parens", rule, { invalid("const [a = (b)] = []", "const [a = b] = []", "Identifier"), invalid("const {a = (b)} = {}", "const {a = b} = {}", "Identifier"), - // LHS of assigments/Assignment targets + // LHS of assignments/Assignment targets invalid("(a) = b", "a = b", "Identifier"), invalid("(a.b) = c", "a.b = c", "MemberExpression"), invalid("(a) += b", "a += b", "Identifier"), diff --git a/tests/lib/rules/no-implicit-globals.js b/tests/lib/rules/no-implicit-globals.js index 58926537ad31..348ef6feb559 100644 --- a/tests/lib/rules/no-implicit-globals.js +++ b/tests/lib/rules/no-implicit-globals.js @@ -105,12 +105,12 @@ ruleTester.run("no-implicit-globals", rule, { env: { browser: true } }, - // Another way to create a global variable. Not the best practice, but that isn't the reposibility of this rule. + // Another way to create a global variable. Not the best practice, but that isn't the responsibility of this rule. "this.foo = 1;", "this.foo = function() {};", "this.foo = function bar() {};", - // Test that the rule does'n report global comments + // Test that the rule doesn't report global comments "/*global foo:readonly*/", "/*global foo:writable*/", "/*global Array:readonly*/", @@ -322,7 +322,7 @@ ruleTester.run("no-implicit-globals", rule, { // leaks //------------------------------------------------------------------------------ - // This rule doesn't report all undeclared variables, just leaks (assigments to an undeclared variable) + // This rule doesn't report all undeclared variables, just leaks (assignments to an undeclared variable) "foo", "foo + bar", "foo(bar)", @@ -409,7 +409,7 @@ ruleTester.run("no-implicit-globals", rule, { }, - // This rule doesn't dissalow assignments to properties of readonly globals + // This rule doesn't disallow assignments to properties of readonly globals "Array.from = 1;", "Object['assign'] = 1;", "/*global foo:readonly*/ foo.bar = 1;" @@ -850,7 +850,7 @@ ruleTester.run("no-implicit-globals", rule, { // globals //------------------------------------------------------------------------------ - // Basic assigment tests + // Basic assignment tests { code: "Array = 1", errors: [ @@ -991,7 +991,7 @@ ruleTester.run("no-implicit-globals", rule, { ] }, - // Multiple and mixed assigments + // Multiple and mixed assignments { code: "/*global foo:readonly, bar: readonly*/ foo = bar = 1", errors: [ diff --git a/tests/lib/rules/no-multi-assign.js b/tests/lib/rules/no-multi-assign.js index afc6795a5491..dc907465c60b 100644 --- a/tests/lib/rules/no-multi-assign.js +++ b/tests/lib/rules/no-multi-assign.js @@ -22,7 +22,7 @@ const rule = require("../../../lib/rules/no-multi-assign"), * @param {int} line line number * @param {int} column column number * @param {string} type Type of node - * @returns {Oject} Error object + * @returns {Object} Error object */ function errorAt(line, column, type) { return { diff --git a/tests/lib/rules/no-regex-spaces.js b/tests/lib/rules/no-regex-spaces.js index 60f9dccdfcf0..0fc7e751a654 100644 --- a/tests/lib/rules/no-regex-spaces.js +++ b/tests/lib/rules/no-regex-spaces.js @@ -298,7 +298,7 @@ ruleTester.run("no-regex-spaces", rule, { ] }, - // report only the first occurence of consecutive spaces + // report only the first occurrence of consecutive spaces { code: "var foo = / foo /;", output: "var foo = / {2}foo /;", diff --git a/tests/lib/rules/no-unused-vars.js b/tests/lib/rules/no-unused-vars.js index 0883685aa9f9..dc69a1bee0b8 100644 --- a/tests/lib/rules/no-unused-vars.js +++ b/tests/lib/rules/no-unused-vars.js @@ -551,7 +551,7 @@ ruleTester.run("no-unused-vars", rule, { errors: [{ message: "'err' is defined but never used." }] }, - // no conclict in ignore patterns + // no conflict in ignore patterns { code: "try{}catch(err){};", options: [ diff --git a/tests/lib/rules/no-useless-concat.js b/tests/lib/rules/no-useless-concat.js index cc66b2578791..d5974027d64a 100644 --- a/tests/lib/rules/no-useless-concat.js +++ b/tests/lib/rules/no-useless-concat.js @@ -1,5 +1,5 @@ /** - * @fileoverview disallow unncessary concatenation of literals or template literals + * @fileoverview disallow unnecessary concatenation of literals or template literals * @author Henry Zhu */ "use strict"; diff --git a/tests/lib/rules/one-var-declaration-per-line.js b/tests/lib/rules/one-var-declaration-per-line.js index 7d7df711c0cc..c2faa6603fa7 100644 --- a/tests/lib/rules/one-var-declaration-per-line.js +++ b/tests/lib/rules/one-var-declaration-per-line.js @@ -21,7 +21,7 @@ const rule = require("../../../lib/rules/one-var-declaration-per-line"), * @private * @param {int} line line number * @param {int} column column number - * @returns {Oject} Error object + * @returns {Object} Error object */ function errorAt(line, column) { return { diff --git a/tests/lib/rules/padded-blocks.js b/tests/lib/rules/padded-blocks.js index 38e9d40ba23b..6dfe30ecb372 100644 --- a/tests/lib/rules/padded-blocks.js +++ b/tests/lib/rules/padded-blocks.js @@ -42,7 +42,7 @@ ruleTester.run("padded-blocks", rule, { { code: "switch (a) {\n\ncase 0: foo();\ncase 1: bar();\n\n}", options: ["always"] }, { code: "switch (a) {\n\ncase 0: foo();\ncase 1: bar();\n\n}", options: [{ switches: "always" }] }, { code: "switch (a) {\n\n//comment\ncase 0: foo();//comment\n\n}", options: [{ switches: "always" }] }, - { code: "switch (a) {//coment\n\ncase 0: foo();\ncase 1: bar();\n\n/* comment */}", options: [{ switches: "always" }] }, + { code: "switch (a) {//comment\n\ncase 0: foo();\ncase 1: bar();\n\n/* comment */}", options: [{ switches: "always" }] }, { code: "class A{\n\nfoo(){}\n\n}", parserOptions: { ecmaVersion: 6 } }, { code: "class A{\n\nfoo(){}\n\n}", options: ["always"], parserOptions: { ecmaVersion: 6 } }, diff --git a/tests/lib/rules/prefer-destructuring.js b/tests/lib/rules/prefer-destructuring.js index 2fef0f93851f..53ef6f0a32f0 100644 --- a/tests/lib/rules/prefer-destructuring.js +++ b/tests/lib/rules/prefer-destructuring.js @@ -25,13 +25,13 @@ ruleTester.run("prefer-destructuring", rule, { "var foo;", { - // Ensure that the default behavior does not require desturcturing when renaming + // Ensure that the default behavior does not require destructuring when renaming code: "var foo = object.bar;", options: [{ VariableDeclarator: { object: true } }] }, { - // Ensure that the default behavior does not require desturcturing when renaming + // Ensure that the default behavior does not require destructuring when renaming code: "var foo = object.bar;", options: [{ object: true }] }, diff --git a/tests/lib/rules/prefer-regex-literals.js b/tests/lib/rules/prefer-regex-literals.js index e263ef03dc7a..cfcddbec7d72 100644 --- a/tests/lib/rules/prefer-regex-literals.js +++ b/tests/lib/rules/prefer-regex-literals.js @@ -28,9 +28,9 @@ ruleTester.run("prefer-regex-literals", rule, { "RegExp(pattern, 'g')", "new RegExp(f('a'))", "RegExp(prefix + 'a')", - "new RegExp('a' + sufix)", - "RegExp(`a` + sufix);", - "new RegExp(String.raw`a` + sufix);", + "new RegExp('a' + suffix)", + "RegExp(`a` + suffix);", + "new RegExp(String.raw`a` + suffix);", "RegExp('a', flags)", "RegExp('a', 'g' + flags)", "new RegExp(String.raw`a`, flags);", diff --git a/tests/lib/rules/quotes.js b/tests/lib/rules/quotes.js index ec29848d5508..86dc711f7943 100644 --- a/tests/lib/rules/quotes.js +++ b/tests/lib/rules/quotes.js @@ -603,7 +603,7 @@ ruleTester.run("quotes", rule, { ] }, { - code: "var foo = 'prefix \\75 sufix'", + code: "var foo = 'prefix \\75 suffix'", output: null, options: ["backtick"], parserOptions: { ecmaVersion: 6 }, diff --git a/tests/lib/shared/naming.js b/tests/lib/shared/naming.js index f6239dab1ea1..0a868a872ed8 100644 --- a/tests/lib/shared/naming.js +++ b/tests/lib/shared/naming.js @@ -56,10 +56,10 @@ describe("naming", () => { }); describe("getNamespaceFromTerm()", () => { - it("should remove namepace when passed with namepace", () => { - const namespace = naming.getNamespaceFromTerm("@namepace/eslint-plugin-test"); + it("should remove namespace when passed with namespace", () => { + const namespace = naming.getNamespaceFromTerm("@namespace/eslint-plugin-test"); - assert.strictEqual(namespace, "@namepace/"); + assert.strictEqual(namespace, "@namespace/"); }); }); }); diff --git a/tools/internal-testers/event-generator-tester.js b/tools/internal-testers/event-generator-tester.js index 1c628d7eb1c4..a5ec8e192bfc 100644 --- a/tools/internal-testers/event-generator-tester.js +++ b/tools/internal-testers/event-generator-tester.js @@ -19,7 +19,7 @@ const assert = require("assert"); module.exports = { /** - * Overrideable `describe` function to test. + * Overridable `describe` function to test. * @param {string} text A description. * @param {Function} method A test logic. * @returns {any} The returned value with the test logic. @@ -29,7 +29,7 @@ module.exports = { }, /** - * Overrideable `it` function to test. + * Overridable `it` function to test. * @param {string} text A description. * @param {Function} method A test logic. * @returns {any} The returned value with the test logic.