Skip to content
Permalink
Browse files
Chore: fix typos (#13960)
  • Loading branch information
yeonjuan committed Dec 27, 2020
1 parent 7289ecf commit c3e9accce2f61b04ab699fd37c90703305281aa3
@@ -272,7 +272,7 @@ function processOptions({
errors.push("'rulePaths' must be an array of non-empty strings.");
}
if (typeof useEslintrc !== "boolean") {
errors.push("'useElintrc' must be a boolean.");
errors.push("'useEslintrc' must be a boolean.");
}

if (errors.length > 0) {
@@ -563,7 +563,7 @@ class ESLint {

/**
* Returns the formatter representing the given formatter name.
* @param {string} [name] The name of the formattter to load.
* @param {string} [name] The name of the formatter to load.
* The following values are allowed:
* - `undefined` ... Load `stylish` builtin formatter.
* - A builtin formatter name ... Load the builtin formatter.
@@ -191,7 +191,7 @@ module.exports = {
}

/*
* If the first token of the reutrn value is `{` or the return value is a sequence expression,
* If the first token of the return value is `{` or the return value is a sequence expression,
* enclose the return value by parentheses to avoid syntax error.
*/
if (astUtils.isOpeningBraceToken(firstValueToken) || blockBody[0].argument.type === "SequenceExpression" || (funcInfo.hasInOperator && isInsideForLoopInitializer(node))) {
@@ -59,9 +59,9 @@ module.exports = {
}

/**
* Check to see if a node contains only identifers
* Check to see if a node contains only identifiers
* @param {ASTNode} node The node to check
* @returns {boolean} Whether or not the node contains only identifers
* @returns {boolean} Whether or not the node contains only identifiers
*/
function containsOnlyIdentifiers(node) {
if (node.type === "Identifier") {
@@ -46,7 +46,7 @@ module.exports = {
const sourceCode = context.getSourceCode();

/**
* Reports if the dot between object and property is on the correct loccation.
* Reports if the dot between object and property is on the correct location.
* @param {ASTNode} node The `MemberExpression` node.
* @returns {void}
*/
@@ -131,7 +131,7 @@ module.exports = {
return null;
}

// If `?.` exsits, it doesn't hide no-undexpected-multiline errors
// If `?.` exists, it doesn't hide no-unexpected-multiline errors
if (node.optional) {
return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], "?.");
}
@@ -177,7 +177,7 @@ module.exports = {
/*
* Only autofix if there is no newline
* https://github.com/eslint/eslint/issues/7787
* But if `?.` exsits, it doesn't hide no-undexpected-multiline errors
* But if `?.` exists, it doesn't hide no-unexpected-multiline errors
*/
if (!node.optional) {
return null;
@@ -138,7 +138,7 @@ module.exports = {
}

/*
* `identifierNode.parent` is a MamberExpression `*.prototype`.
* `identifierNode.parent` is a MemberExpression `*.prototype`.
* If it's an optional member access, it may be wrapped by a `ChainExpression` node.
*/
const prototypeNode =
@@ -97,10 +97,10 @@ function isIterationVariable(node) {
* - `Object.defineProperties`
* - `Object.freeze`
* - `Object.setPrototypeOf`
* - `Refrect.defineProperty`
* - `Refrect.deleteProperty`
* - `Refrect.set`
* - `Refrect.setPrototypeOf`
* - `Reflect.defineProperty`
* - `Reflect.deleteProperty`
* - `Reflect.set`
* - `Reflect.setPrototypeOf`
* @param {ASTNode} node The node to check.
* @param {Scope} scope A `escope.Scope` object to find variable (whichever).
* @returns {boolean} `true` if the node is at the first argument of a well-known mutation function.
@@ -45,7 +45,7 @@ module.exports = {

/**
* Checks and reports given exported identifier.
* @param {ASTNode} node exported `Identifer` node to check.
* @param {ASTNode} node exported `Identifier` node to check.
* @returns {void}
*/
function checkExportedName(node) {
@@ -171,7 +171,7 @@ module.exports = {
/**
* Removes the top of stack item.
*
* And this treverses all segments of this code path then reports every
* And this traverses all segments of this code path then reports every
* invalid node.
* @param {CodePath} codePath A code path which was ended.
* @returns {void}
@@ -279,7 +279,7 @@ module.exports = {
* @param {ASTNode} node the AssignmentExpression node
* @returns {void}
*/
function checkAssigmentExpression(node) {
function checkAssignmentExpression(node) {
if (node.operator === "=") {
performCheck(node.left, node.right, node);
}
@@ -291,7 +291,7 @@ module.exports = {

return {
VariableDeclarator: checkVariableDeclarator,
AssignmentExpression: checkAssigmentExpression
AssignmentExpression: checkAssignmentExpression
};
}
};
@@ -105,10 +105,10 @@ module.exports = {
CallExpression(node) {
const methodName = (node.callee.property || {}).name;
const isReflectCall = (node.callee.object || {}).name === "Reflect";
const hasReflectSubsitute = Object.prototype.hasOwnProperty.call(reflectSubstitutes, methodName);
const hasReflectSubstitute = Object.prototype.hasOwnProperty.call(reflectSubstitutes, methodName);
const userConfiguredException = exceptions.indexOf(methodName) !== -1;

if (hasReflectSubsitute && !isReflectCall && !userConfiguredException) {
if (hasReflectSubstitute && !isReflectCall && !userConfiguredException) {
report(node, existingNames[methodName], reflectSubstitutes[methodName]);
}
},
@@ -1,5 +1,5 @@
/**
* @fileoverview This rule shoud require or disallow spaces before or after unary operations.
* @fileoverview This rule should require or disallow spaces before or after unary operations.
* @author Marcin Kumorek
*/
"use strict";
@@ -82,7 +82,7 @@ function startsWithUpperCase(s) {
/**
* Checks whether or not a node is a constructor.
* @param {ASTNode} node A function node to check.
* @returns {boolean} Wehether or not a node is a constructor.
* @returns {boolean} Whether or not a node is a constructor.
*/
function isES5Constructor(node) {
return (node.id && startsWithUpperCase(node.id.name));
@@ -1574,7 +1574,7 @@ module.exports = {
},

/*
* Determine if a node has a possiblity to be an Error object
* Determine if a node has a possibility to be an Error object
* @param {ASTNode} node ASTNode to check
* @returns {boolean} True if there is a chance it contains an Error obj
*/
@@ -15,7 +15,7 @@ const lodash = require("lodash");
// Private
//------------------------------------------------------------------------------

// Defitions for deprecation warnings.
// Definitions for deprecation warnings.
const deprecationWarningMessages = {
ESLINT_LEGACY_ECMAFEATURES:
"The 'ecmaFeatures' config file property is deprecated and has no effect.",
@@ -46,9 +46,9 @@ module.exports = {};
/**
* @typedef {Object} OverrideConfigData
* @property {Record<string, boolean>} [env] The environment settings.
* @property {string | string[]} [excludedFiles] The glob pattarns for excluded files.
* @property {string | string[]} [excludedFiles] The glob patterns for excluded files.
* @property {string | string[]} [extends] The path to other config files or the package name of shareable configs.
* @property {string | string[]} files The glob pattarns for target files.
* @property {string | string[]} files The glob patterns for target files.
* @property {Record<string, GlobalConf>} [globals] The global variable settings.
* @property {boolean} [noInlineConfig] The flag that disables directive comments.
* @property {OverrideConfigData[]} [overrides] The override settings per kind of files.
@@ -208,7 +208,7 @@ describe("ESLint", () => {
"- 'reportUnusedDisableDirectives' must be any of \"error\", \"warn\", \"off\", and null.",
"- 'resolvePluginsRelativeTo' must be a non-empty string or null.",
"- 'rulePaths' must be an array of non-empty strings.",
"- 'useElintrc' must be a boolean."
"- 'useEslintrc' must be a boolean."
].join("\n")), "u")
);
});

0 comments on commit c3e9acc

Please sign in to comment.