diff --git a/Makefile.js b/Makefile.js index d11ca75a0ea..64db70365d0 100644 --- a/Makefile.js +++ b/Makefile.js @@ -941,7 +941,7 @@ target.checkLicenses = function() { /** * Downloads a repository which has many js files to test performance with multi files. * Here, it's eslint@1.10.3 (450 files) - * @param {Function} cb - A callback function. + * @param {Function} cb A callback function. * @returns {void} */ function downloadMultifilesTestTarget(cb) { @@ -1017,11 +1017,10 @@ function time(cmd, runs, runNumber, results, cb) { /** * Run a performance test. - * - * @param {string} title - A title. - * @param {string} targets - Test targets. - * @param {number} multiplier - A multiplier for limitation. - * @param {Function} cb - A callback function. + * @param {string} title A title. + * @param {string} targets Test targets. + * @param {number} multiplier A multiplier for limitation. + * @param {Function} cb A callback function. * @returns {void} */ function runPerformanceTest(title, targets, multiplier, cb) { diff --git a/lib/cli-engine/cascading-config-array-factory.js b/lib/cli-engine/cascading-config-array-factory.js index 13b240f12b3..ba5c037933a 100644 --- a/lib/cli-engine/cascading-config-array-factory.js +++ b/lib/cli-engine/cascading-config-array-factory.js @@ -153,7 +153,7 @@ function createCLIConfigArray({ class ConfigurationNotFoundError extends Error { /** - * @param {string} directoryPath - The directory path. + * @param {string} directoryPath The directory path. */ constructor(directoryPath) { super(`No ESLint configuration found in ${directoryPath}.`); diff --git a/lib/cli-engine/cli-engine.js b/lib/cli-engine/cli-engine.js index 3c67d33daa6..e768da837d0 100644 --- a/lib/cli-engine/cli-engine.js +++ b/lib/cli-engine/cli-engine.js @@ -145,7 +145,7 @@ function validateFixTypes(fixTypes) { /** * It will calculate the error and warning count for collection of messages per file - * @param {LintMessage[]} messages - Collection of messages + * @param {LintMessage[]} messages Collection of messages * @returns {Object} Contains the stats * @private */ @@ -173,7 +173,7 @@ function calculateStatsPerFile(messages) { /** * It will calculate the error and warning count for collection of results from all files - * @param {LintResult[]} results - Collection of messages from all the files + * @param {LintResult[]} results Collection of messages from all the files * @returns {Object} Contains the stats * @private */ @@ -272,8 +272,8 @@ function verifyText({ /** * Returns result with warning by ignore settings - * @param {string} filePath - File path of checked code - * @param {string} baseDir - Absolute path of base directory + * @param {string} filePath File path of checked code + * @param {string} baseDir Absolute path of base directory * @returns {LintResult} Result with single warning * @private */ @@ -387,7 +387,6 @@ function isErrorMessage(message) { * name will be the `cacheFile/.cache_hashOfCWD` * * if cacheFile points to a file or looks like a file then in will just use that file - * * @param {string} cacheFile The name of file to be used to store the cache * @param {string} cwd Current working directory * @returns {string} the resolved path to the cache file diff --git a/lib/cli-engine/config-array/config-array.js b/lib/cli-engine/config-array/config-array.js index 6383c02115f..089ff305a2b 100644 --- a/lib/cli-engine/config-array/config-array.js +++ b/lib/cli-engine/config-array/config-array.js @@ -126,7 +126,6 @@ function isNonNullObject(x) { * * Assign every property values of `y` to `x` if `x` doesn't have the property. * If `x`'s property value is an object, it does recursive. - * * @param {Object} target The destination to merge * @param {Object|undefined} source The source to merge. * @returns {void} @@ -157,7 +156,6 @@ function mergeWithoutOverwrite(target, source) { /** * Merge plugins. * `target`'s definition is prior to `source`'s. - * * @param {Record} target The destination to merge * @param {Record|undefined} source The source to merge. * @returns {void} @@ -187,7 +185,6 @@ function mergePlugins(target, source) { /** * Merge rule configs. * `target`'s definition is prior to `source`'s. - * * @param {Record} target The destination to merge * @param {Record|undefined} source The source to merge. * @returns {void} @@ -382,7 +379,6 @@ function ensurePluginMemberMaps(instance) { * You need to call `ConfigArray#extractConfig(filePath)` method in order to * extract, merge and get only the config data which is related to an arbitrary * file. - * * @extends {Array} */ class ConfigArray extends Array { diff --git a/lib/cli-engine/file-enumerator.js b/lib/cli-engine/file-enumerator.js index a027359ae51..59083fc4636 100644 --- a/lib/cli-engine/file-enumerator.js +++ b/lib/cli-engine/file-enumerator.js @@ -150,8 +150,8 @@ function readdirSafeSync(directoryPath) { class NoFilesFoundError extends Error { /** - * @param {string} pattern - The glob pattern which was not found. - * @param {boolean} globDisabled - If `true` then the pattern was a glob pattern, but glob was disabled. + * @param {string} pattern The glob pattern which was not found. + * @param {boolean} globDisabled If `true` then the pattern was a glob pattern, but glob was disabled. */ constructor(pattern, globDisabled) { super(`No files matching '${pattern}' were found${globDisabled ? " (glob was disabled)" : ""}.`); @@ -166,7 +166,7 @@ class NoFilesFoundError extends Error { class AllFilesIgnoredError extends Error { /** - * @param {string} pattern - The glob pattern which was not found. + * @param {string} pattern The glob pattern which was not found. */ constructor(pattern) { super(`All files matched by '${pattern}' are ignored.`); diff --git a/lib/init/autoconfig.js b/lib/init/autoconfig.js index 19c4986c31b..5b84df3bb8c 100644 --- a/lib/init/autoconfig.js +++ b/lib/init/autoconfig.js @@ -31,7 +31,6 @@ const MAX_CONFIG_COMBINATIONS = 17, // 16 combinations + 1 for severity only /** * Information about a rule configuration, in the context of a Registry. - * * @typedef {Object} registryItem * @param {ruleConfig} config A valid configuration for the rule * @param {number} specificity The number of elements in the ruleConfig array @@ -82,7 +81,6 @@ class Registry { * * It will set the registry's `rule` property to an object having rule names * as keys and an array of registryItems as values. - * * @returns {void} */ populateFromCoreRules() { @@ -101,7 +99,6 @@ class Registry { * configurations. * * The length of the returned array will be <= MAX_CONFIG_COMBINATIONS. - * * @returns {Object[]} "rules" configurations to use for linting */ buildRuleSets() { @@ -114,7 +111,6 @@ class Registry { * * This is broken out into its own function so that it doesn't need to be * created inside of the while loop. - * * @param {string} rule The ruleId to add. * @returns {void} */ @@ -162,7 +158,6 @@ class Registry { * * Note: this also removes rule configurations which were not linted * (meaning, they have an undefined errorCount). - * * @returns {void} */ stripFailingConfigs() { @@ -185,7 +180,6 @@ class Registry { /** * Removes rule configurations which were not included in a ruleSet - * * @returns {void} */ stripExtraConfigs() { @@ -204,7 +198,6 @@ class Registry { * Creates a registry of rules which had no error-free configs. * The new registry is intended to be analyzed to determine whether its rules * should be disabled or set to warning. - * * @returns {Registry} A registry of failing rules. */ getFailingRulesRegistry() { @@ -225,7 +218,6 @@ class Registry { /** * Create an eslint config for any rules which only have one configuration * in the registry. - * * @returns {Object} An eslint config with rules section populated */ createConfig() { @@ -243,7 +235,6 @@ class Registry { /** * Return a cloned registry containing only configs with a desired specificity - * * @param {number} specificity Only keep configs with this specificity * @returns {Registry} A registry of rules */ @@ -261,7 +252,6 @@ class Registry { /** * Lint SourceCodes against all configurations in the registry, and record results - * * @param {Object[]} sourceCodes SourceCode objects for each filename * @param {Object} config ESLint config object * @param {progressCallback} [cb] Optional callback for reporting execution status @@ -327,7 +317,6 @@ class Registry { * * This will return a new config with `"extends": "eslint:recommended"` and * only the rules which have configurations different from the recommended config. - * * @param {Object} config config object * @returns {Object} config object using `"extends": "eslint:recommended"` */ diff --git a/lib/init/config-file.js b/lib/init/config-file.js index 77f14a47299..960b572cddb 100644 --- a/lib/init/config-file.js +++ b/lib/init/config-file.js @@ -23,7 +23,6 @@ const debug = require("debug")("eslint:config-file"); * Determines sort order for object keys for json-stable-stringify * * see: https://github.com/samn/json-stable-stringify#cmp - * * @param {Object} a The first comparison object ({key: akey, value: avalue}) * @param {Object} b The second comparison object ({key: bkey, value: bvalue}) * @returns {number} 1 or -1, used in stringify cmp method diff --git a/lib/init/config-initializer.js b/lib/init/config-initializer.js index 2e47e902c77..48e56ce5261 100644 --- a/lib/init/config-initializer.js +++ b/lib/init/config-initializer.js @@ -147,7 +147,6 @@ function getModulesList(config, installESLint) { * * Note: This clones the config object and returns a new config to avoid mutating * the original config parameter. - * * @param {Object} answers answers received from inquirer * @param {Object} config config object * @returns {Object} config object with configured rules diff --git a/lib/init/config-rule.js b/lib/init/config-rule.js index e40feb7145b..a93142b8abe 100644 --- a/lib/init/config-rule.js +++ b/lib/init/config-rule.js @@ -33,7 +33,6 @@ function explodeArray(xs) { * * For example: * combineArrays([a, [b, c]], [x, y]); // -> [[a, x], [a, y], [b, c, x], [b, c, y]] - * * @param {Array} arr1 The first array to combine. * @param {Array} arr2 The second array to combine. * @returns {Array} A mixture of the elements of the first and second arrays. @@ -71,7 +70,6 @@ function combineArrays(arr1, arr2) { * [{before: true}, {before: false}], * [{after: true}, {after: false}] * ] - * * @param {Object[]} objects Array of objects, each with one property/value pair * @returns {Array[]} Array of arrays of objects grouped by property */ @@ -98,7 +96,6 @@ function groupByProperty(objects) { * element in the array is the severity, and is the only required element. * Configs may also have one or more additional elements to specify rule * configuration or options. - * * @typedef {Array|number} ruleConfig * @param {number} 0 The rule's severity (0, 1, 2). */ @@ -134,7 +131,6 @@ function groupByProperty(objects) { * {before: false, after: true}, * {before: false, after: false} * ] - * * @param {Object[]} objArr1 Single key/value objects, all with the same key * @param {Object[]} objArr2 Single key/value objects, all with another key * @returns {Object[]} Combined objects for each combination of input properties and values @@ -193,7 +189,6 @@ class RuleConfigSet { /** * Add a severity level to the front of all configs in the instance. * This should only be called after all configs have been added to the instance. - * * @returns {void} */ addErrorSeverity() { diff --git a/lib/init/npm-utils.js b/lib/init/npm-utils.js index 3d4a896b6f6..28c198fc8ad 100644 --- a/lib/init/npm-utils.js +++ b/lib/init/npm-utils.js @@ -21,7 +21,6 @@ const fs = require("fs"), /** * Find the closest package.json file, starting at process.cwd (by default), * and working up to root. - * * @param {string} [startDir=process.cwd()] Starting directory * @returns {string} Absolute path to closest package.json file */ @@ -88,7 +87,6 @@ function fetchPeerDependencies(packageName) { /** * Check whether node modules are include in a project's package.json. - * * @param {string[]} packages Array of node module names * @param {Object} opt Options Object * @param {boolean} opt.dependencies Set to true to check for direct dependencies @@ -136,7 +134,6 @@ function check(packages, opt) { * package.json. * * Convenience wrapper around check(). - * * @param {string[]} packages Array of node modules to check. * @param {string} rootDir The directory contianing a package.json * @returns {Object} An object whose keys are the module names @@ -151,7 +148,6 @@ function checkDeps(packages, rootDir) { * package.json. * * Convenience wrapper around check(). - * * @param {string[]} packages Array of node modules to check. * @returns {Object} An object whose keys are the module names * and values are booleans indicating installation. @@ -162,7 +158,6 @@ function checkDevDeps(packages) { /** * Check whether package.json is found in current path. - * * @param {string} [startDir] Starting directory * @returns {boolean} Whether a package.json is found in current path. */ diff --git a/lib/linter/code-path-analysis/code-path-analyzer.js b/lib/linter/code-path-analysis/code-path-analyzer.js index 821477aef99..79d1cf1932b 100644 --- a/lib/linter/code-path-analysis/code-path-analyzer.js +++ b/lib/linter/code-path-analysis/code-path-analyzer.js @@ -22,8 +22,7 @@ const assert = require("assert"), /** * Checks whether or not a given node is a `case` node (not `default` node). - * - * @param {ASTNode} node - A `SwitchCase` node to check. + * @param {ASTNode} node A `SwitchCase` node to check. * @returns {boolean} `true` if the node is a `case` node (not `default` node). */ function isCaseNode(node) { @@ -33,8 +32,7 @@ function isCaseNode(node) { /** * Checks whether the given logical operator is taken into account for the code * path analysis. - * - * @param {string} operator - The operator found in the LogicalExpression node + * @param {string} operator The operator found in the LogicalExpression node * @returns {boolean} `true` if the operator is "&&" or "||" */ function isHandledLogicalOperator(operator) { @@ -43,8 +41,7 @@ function isHandledLogicalOperator(operator) { /** * Gets the label if the parent node of a given node is a LabeledStatement. - * - * @param {ASTNode} node - A node to get. + * @param {ASTNode} node A node to get. * @returns {string|null} The label or `null`. */ function getLabel(node) { @@ -57,8 +54,7 @@ function getLabel(node) { /** * Checks whether or not a given logical expression node goes different path * between the `true` case and the `false` case. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a test of a choice statement. */ function isForkingByTrueOrFalse(node) { @@ -86,8 +82,7 @@ function isForkingByTrueOrFalse(node) { * This is used to detect infinity loops (e.g. `while (true) {}`). * Statements preceded by an infinity loop are unreachable if the loop didn't * have any `break` statement. - * - * @param {ASTNode} node - A node to get. + * @param {ASTNode} node A node to get. * @returns {boolean|undefined} a boolean value if the node is a Literal node, * otherwise `undefined`. */ @@ -102,8 +97,7 @@ function getBooleanValueIfSimpleConstant(node) { * Checks that a given identifier node is a reference or not. * * This is used to detect the first throwable node in a `try` block. - * - * @param {ASTNode} node - An Identifier node to check. + * @param {ASTNode} node An Identifier node to check. * @returns {boolean} `true` if the node is a reference. */ function isIdentifierReference(node) { @@ -153,9 +147,8 @@ function isIdentifierReference(node) { * * In this process, both "onCodePathSegmentStart" and "onCodePathSegmentEnd" * events are fired. - * - * @param {CodePathAnalyzer} analyzer - The instance. - * @param {ASTNode} node - The current AST node. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. * @returns {void} */ function forwardCurrentToHead(analyzer, node) { @@ -211,9 +204,8 @@ function forwardCurrentToHead(analyzer, node) { /** * Updates the current segment with empty. * This is called at the last of functions or the program. - * - * @param {CodePathAnalyzer} analyzer - The instance. - * @param {ASTNode} node - The current AST node. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. * @returns {void} */ function leaveFromCurrentSegment(analyzer, node) { @@ -242,9 +234,8 @@ function leaveFromCurrentSegment(analyzer, node) { * * For example, if the node is `parent.consequent`, this creates a fork from the * current path. - * - * @param {CodePathAnalyzer} analyzer - The instance. - * @param {ASTNode} node - The current AST node. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. * @returns {void} */ function preprocess(analyzer, node) { @@ -352,9 +343,8 @@ function preprocess(analyzer, node) { /** * Updates the code path due to the type of a given node in entering. - * - * @param {CodePathAnalyzer} analyzer - The instance. - * @param {ASTNode} node - The current AST node. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. * @returns {void} */ function processCodePathToEnter(analyzer, node) { @@ -449,9 +439,8 @@ function processCodePathToEnter(analyzer, node) { /** * Updates the code path due to the type of a given node in leaving. - * - * @param {CodePathAnalyzer} analyzer - The instance. - * @param {ASTNode} node - The current AST node. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. * @returns {void} */ function processCodePathToExit(analyzer, node) { @@ -563,9 +552,8 @@ function processCodePathToExit(analyzer, node) { /** * Updates the code path to finalize the current code path. - * - * @param {CodePathAnalyzer} analyzer - The instance. - * @param {ASTNode} node - The current AST node. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. * @returns {void} */ function postprocess(analyzer, node) { @@ -610,7 +598,7 @@ function postprocess(analyzer, node) { class CodePathAnalyzer { /** - * @param {EventGenerator} eventGenerator - An event generator to wrap. + * @param {EventGenerator} eventGenerator An event generator to wrap. */ constructor(eventGenerator) { this.original = eventGenerator; @@ -624,8 +612,7 @@ class CodePathAnalyzer { /** * Does the process to enter a given AST node. * This updates state of analysis and calls `enterNode` of the wrapped. - * - * @param {ASTNode} node - A node which is entering. + * @param {ASTNode} node A node which is entering. * @returns {void} */ enterNode(node) { @@ -651,8 +638,7 @@ class CodePathAnalyzer { /** * Does the process to leave a given AST node. * This updates state of analysis and calls `leaveNode` of the wrapped. - * - * @param {ASTNode} node - A node which is leaving. + * @param {ASTNode} node A node which is leaving. * @returns {void} */ leaveNode(node) { @@ -676,9 +662,8 @@ class CodePathAnalyzer { /** * This is called on a code path looped. * Then this raises a looped event. - * - * @param {CodePathSegment} fromSegment - A segment of prev. - * @param {CodePathSegment} toSegment - A segment of next. + * @param {CodePathSegment} fromSegment A segment of prev. + * @param {CodePathSegment} toSegment A segment of next. * @returns {void} */ onLooped(fromSegment, toSegment) { diff --git a/lib/linter/code-path-analysis/code-path-segment.js b/lib/linter/code-path-analysis/code-path-segment.js index 8145f928016..6fa5ff44271 100644 --- a/lib/linter/code-path-analysis/code-path-segment.js +++ b/lib/linter/code-path-analysis/code-path-segment.js @@ -17,8 +17,7 @@ const debug = require("./debug-helpers"); /** * Checks whether or not a given segment is reachable. - * - * @param {CodePathSegment} segment - A segment to check. + * @param {CodePathSegment} segment A segment to check. * @returns {boolean} `true` if the segment is reachable. */ function isReachable(segment) { @@ -35,10 +34,10 @@ function isReachable(segment) { class CodePathSegment { /** - * @param {string} id - An identifier. - * @param {CodePathSegment[]} allPrevSegments - An array of the previous segments. + * @param {string} id An identifier. + * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. * This array includes unreachable segments. - * @param {boolean} reachable - A flag which shows this is reachable. + * @param {boolean} reachable A flag which shows this is reachable. */ constructor(id, allPrevSegments, reachable) { @@ -98,8 +97,7 @@ class CodePathSegment { /** * Checks a given previous segment is coming from the end of a loop. - * - * @param {CodePathSegment} segment - A previous segment to check. + * @param {CodePathSegment} segment A previous segment to check. * @returns {boolean} `true` if the segment is coming from the end of a loop. */ isLoopedPrevSegment(segment) { @@ -108,8 +106,7 @@ class CodePathSegment { /** * Creates the root segment. - * - * @param {string} id - An identifier. + * @param {string} id An identifier. * @returns {CodePathSegment} The created segment. */ static newRoot(id) { @@ -118,9 +115,8 @@ class CodePathSegment { /** * Creates a segment that follows given segments. - * - * @param {string} id - An identifier. - * @param {CodePathSegment[]} allPrevSegments - An array of the previous segments. + * @param {string} id An identifier. + * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. * @returns {CodePathSegment} The created segment. */ static newNext(id, allPrevSegments) { @@ -133,9 +129,8 @@ class CodePathSegment { /** * Creates an unreachable segment that follows given segments. - * - * @param {string} id - An identifier. - * @param {CodePathSegment[]} allPrevSegments - An array of the previous segments. + * @param {string} id An identifier. + * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. * @returns {CodePathSegment} The created segment. */ static newUnreachable(id, allPrevSegments) { @@ -154,9 +149,8 @@ class CodePathSegment { * Creates a segment that follows given segments. * This factory method does not connect with `allPrevSegments`. * But this inherits `reachable` flag. - * - * @param {string} id - An identifier. - * @param {CodePathSegment[]} allPrevSegments - An array of the previous segments. + * @param {string} id An identifier. + * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. * @returns {CodePathSegment} The created segment. */ static newDisconnected(id, allPrevSegments) { @@ -167,8 +161,7 @@ class CodePathSegment { * Makes a given segment being used. * * And this function registers the segment into the previous segments as a next. - * - * @param {CodePathSegment} segment - A segment to mark. + * @param {CodePathSegment} segment A segment to mark. * @returns {void} */ static markUsed(segment) { @@ -195,9 +188,8 @@ class CodePathSegment { /** * Marks a previous segment as looped. - * - * @param {CodePathSegment} segment - A segment. - * @param {CodePathSegment} prevSegment - A previous segment to mark. + * @param {CodePathSegment} segment A segment. + * @param {CodePathSegment} prevSegment A previous segment to mark. * @returns {void} */ static markPrevSegmentAsLooped(segment, prevSegment) { @@ -206,8 +198,7 @@ class CodePathSegment { /** * Replaces unused segments with the previous segments of each unused segment. - * - * @param {CodePathSegment[]} segments - An array of segments to replace. + * @param {CodePathSegment[]} segments An array of segments to replace. * @returns {CodePathSegment[]} The replaced array. */ static flattenUnusedSegments(segments) { diff --git a/lib/linter/code-path-analysis/code-path-state.js b/lib/linter/code-path-analysis/code-path-state.js index 57da10fa915..f6eec93e0ad 100644 --- a/lib/linter/code-path-analysis/code-path-state.js +++ b/lib/linter/code-path-analysis/code-path-state.js @@ -22,11 +22,10 @@ const CodePathSegment = require("./code-path-segment"), * array as well. * * This adds only reachable and used segments. - * - * @param {CodePathSegment[]} dest - A destination array (`returnedSegments` or `thrownSegments`). - * @param {CodePathSegment[]} others - Another destination array (`returnedSegments` or `thrownSegments`). - * @param {CodePathSegment[]} all - The unified destination array (`finalSegments`). - * @param {CodePathSegment[]} segments - Segments to add. + * @param {CodePathSegment[]} dest A destination array (`returnedSegments` or `thrownSegments`). + * @param {CodePathSegment[]} others Another destination array (`returnedSegments` or `thrownSegments`). + * @param {CodePathSegment[]} all The unified destination array (`finalSegments`). + * @param {CodePathSegment[]} segments Segments to add. * @returns {void} */ function addToReturnedOrThrown(dest, others, all, segments) { @@ -42,9 +41,8 @@ function addToReturnedOrThrown(dest, others, all, segments) { /** * Gets a loop-context for a `continue` statement. - * - * @param {CodePathState} state - A state to get. - * @param {string} label - The label of a `continue` statement. + * @param {CodePathState} state A state to get. + * @param {string} label The label of a `continue` statement. * @returns {LoopContext} A loop-context for a `continue` statement. */ function getContinueContext(state, label) { @@ -67,9 +65,8 @@ function getContinueContext(state, label) { /** * Gets a context for a `break` statement. - * - * @param {CodePathState} state - A state to get. - * @param {string} label - The label of a `break` statement. + * @param {CodePathState} state A state to get. + * @param {string} label The label of a `break` statement. * @returns {LoopContext|SwitchContext} A context for a `break` statement. */ function getBreakContext(state, label) { @@ -88,8 +85,7 @@ function getBreakContext(state, label) { /** * Gets a context for a `return` statement. - * - * @param {CodePathState} state - A state to get. + * @param {CodePathState} state A state to get. * @returns {TryContext|CodePathState} A context for a `return` statement. */ function getReturnContext(state) { @@ -107,8 +103,7 @@ function getReturnContext(state) { /** * Gets a context for a `throw` statement. - * - * @param {CodePathState} state - A state to get. + * @param {CodePathState} state A state to get. * @returns {TryContext|CodePathState} A context for a `throw` statement. */ function getThrowContext(state) { @@ -128,9 +123,8 @@ function getThrowContext(state) { /** * Removes a given element from a given array. - * - * @param {any[]} xs - An array to remove the specific element. - * @param {any} x - An element to be removed. + * @param {any[]} xs An array to remove the specific element. + * @param {any} x An element to be removed. * @returns {void} */ function remove(xs, x) { @@ -143,9 +137,8 @@ function remove(xs, x) { * This is used in a process for switch statements. * If there is the "default" chunk before other cases, the order is different * between node's and running's. - * - * @param {CodePathSegment[]} prevSegments - Forward segments to disconnect. - * @param {CodePathSegment[]} nextSegments - Backward segments to disconnect. + * @param {CodePathSegment[]} prevSegments Forward segments to disconnect. + * @param {CodePathSegment[]} nextSegments Backward segments to disconnect. * @returns {void} */ function removeConnection(prevSegments, nextSegments) { @@ -162,10 +155,9 @@ function removeConnection(prevSegments, nextSegments) { /** * Creates looping path. - * - * @param {CodePathState} state - The instance. - * @param {CodePathSegment[]} unflattenedFromSegments - Segments which are source. - * @param {CodePathSegment[]} unflattenedToSegments - Segments which are destination. + * @param {CodePathState} state The instance. + * @param {CodePathSegment[]} unflattenedFromSegments Segments which are source. + * @param {CodePathSegment[]} unflattenedToSegments Segments which are destination. * @returns {void} */ function makeLooped(state, unflattenedFromSegments, unflattenedToSegments) { @@ -200,10 +192,9 @@ function makeLooped(state, unflattenedFromSegments, unflattenedToSegments) { * * - Adds `false` paths to paths which are leaving from the loop. * - Sets `true` paths to paths which go to the body. - * - * @param {LoopContext} context - A loop context to modify. - * @param {ChoiceContext} choiceContext - A choice context of this loop. - * @param {CodePathSegment[]} head - The current head paths. + * @param {LoopContext} context A loop context to modify. + * @param {ChoiceContext} choiceContext A choice context of this loop. + * @param {CodePathSegment[]} head The current head paths. * @returns {void} */ function finalizeTestSegmentsOfFor(context, choiceContext, head) { @@ -228,9 +219,9 @@ function finalizeTestSegmentsOfFor(context, choiceContext, head) { class CodePathState { /** - * @param {IdGenerator} idGenerator - An id generator to generate id for code + * @param {IdGenerator} idGenerator An id generator to generate id for code * path segments. - * @param {Function} onLooped - A callback function to notify looping. + * @param {Function} onLooped A callback function to notify looping. */ constructor(idGenerator, onLooped) { this.idGenerator = idGenerator; @@ -275,8 +266,7 @@ class CodePathState { /** * Creates and stacks new forking context. - * - * @param {boolean} forkLeavingPath - A flag which shows being in a + * @param {boolean} forkLeavingPath A flag which shows being in a * "finally" block. * @returns {ForkContext} The created context. */ @@ -313,7 +303,6 @@ class CodePathState { /** * Creates a bypass path. * This is used for such as IfStatement which does not have "else" chunk. - * * @returns {void} */ forkBypassPath() { @@ -346,12 +335,11 @@ class CodePathState { * a -> foo(); * a -> b -> foo(); * a -> b -> bar(); - * - * @param {string} kind - A kind string. + * @param {string} kind A kind string. * If the new context is LogicalExpression's, this is `"&&"` or `"||"`. * If it's IfStatement's or ConditionalExpression's, this is `"test"`. * Otherwise, this is `"loop"`. - * @param {boolean} isForkingAsResult - A flag that shows that goes different + * @param {boolean} isForkingAsResult A flag that shows that goes different * paths between `true` and `false`. * @returns {void} */ @@ -368,7 +356,6 @@ class CodePathState { /** * Pops the last choice context and finalizes it. - * * @returns {ChoiceContext} The popped context. */ popChoiceContext() { @@ -456,7 +443,6 @@ class CodePathState { /** * Makes a code path segment of the right-hand operand of a logical * expression. - * * @returns {void} */ makeLogicalRight() { @@ -500,7 +486,6 @@ class CodePathState { /** * Makes a code path segment of the `if` block. - * * @returns {void} */ makeIfConsequent() { @@ -527,7 +512,6 @@ class CodePathState { /** * Makes a code path segment of the `else` block. - * * @returns {void} */ makeIfAlternate() { @@ -554,10 +538,9 @@ class CodePathState { /** * Creates a context object of SwitchStatement and stacks it. - * - * @param {boolean} hasCase - `true` if the switch statement has one or more + * @param {boolean} hasCase `true` if the switch statement has one or more * case parts. - * @param {string|null} label - The label text. + * @param {string|null} label The label text. * @returns {void} */ pushSwitchContext(hasCase, label) { @@ -581,7 +564,6 @@ class CodePathState { * - Creates the next code path segment from `context.brokenForkContext`. * - If the last `SwitchCase` node is not a `default` part, creates a path * to the `default` body. - * * @returns {void} */ popSwitchContext() { @@ -655,9 +637,8 @@ class CodePathState { /** * Makes a code path segment for a `SwitchCase` node. - * - * @param {boolean} isEmpty - `true` if the body is empty. - * @param {boolean} isDefault - `true` if the body is the default case. + * @param {boolean} isEmpty `true` if the body is empty. + * @param {boolean} isDefault `true` if the body is the default case. * @returns {void} */ makeSwitchCaseBody(isEmpty, isDefault) { @@ -706,8 +687,7 @@ class CodePathState { /** * Creates a context object of TryStatement and stacks it. - * - * @param {boolean} hasFinalizer - `true` if the try statement has a + * @param {boolean} hasFinalizer `true` if the try statement has a * `finally` block. * @returns {void} */ @@ -729,7 +709,6 @@ class CodePathState { /** * Pops the last context of TryStatement and finalizes it. - * * @returns {void} */ popTryContext() { @@ -785,7 +764,6 @@ class CodePathState { /** * Makes a code path segment for a `catch` block. - * * @returns {void} */ makeCatchBlock() { @@ -814,7 +792,6 @@ class CodePathState { * In the `finally` block, parallel paths are created. The parallel paths * are used as leaving-paths. The leaving-paths are paths from `return` * statements and `throw` statements in a `try` block or a `catch` block. - * * @returns {void} */ makeFinallyBlock() { @@ -874,7 +851,6 @@ class CodePathState { /** * Makes a code path segment from the first throwable node to the `catch` * block or the `finally` block. - * * @returns {void} */ makeFirstThrowablePathInTryBlock() { @@ -903,11 +879,10 @@ class CodePathState { /** * Creates a context object of a loop statement and stacks it. - * - * @param {string} type - The type of the node which was triggered. One of + * @param {string} type The type of the node which was triggered. One of * `WhileStatement`, `DoWhileStatement`, `ForStatement`, `ForInStatement`, * and `ForStatement`. - * @param {string|null} label - A label of the node which was triggered. + * @param {string|null} label A label of the node which was triggered. * @returns {void} */ pushLoopContext(type, label) { @@ -979,7 +954,6 @@ class CodePathState { /** * Pops the last context of a loop statement and finalizes it. - * * @returns {void} */ popLoopContext() { @@ -1051,8 +1025,7 @@ class CodePathState { /** * Makes a code path segment for the test part of a WhileStatement. - * - * @param {boolean|undefined} test - The test value (only when constant). + * @param {boolean|undefined} test The test value (only when constant). * @returns {void} */ makeWhileTest(test) { @@ -1068,7 +1041,6 @@ class CodePathState { /** * Makes a code path segment for the body part of a WhileStatement. - * * @returns {void} */ makeWhileBody() { @@ -1090,7 +1062,6 @@ class CodePathState { /** * Makes a code path segment for the body part of a DoWhileStatement. - * * @returns {void} */ makeDoWhileBody() { @@ -1105,8 +1076,7 @@ class CodePathState { /** * Makes a code path segment for the test part of a DoWhileStatement. - * - * @param {boolean|undefined} test - The test value (only when constant). + * @param {boolean|undefined} test The test value (only when constant). * @returns {void} */ makeDoWhileTest(test) { @@ -1126,8 +1096,7 @@ class CodePathState { /** * Makes a code path segment for the test part of a ForStatement. - * - * @param {boolean|undefined} test - The test value (only when constant). + * @param {boolean|undefined} test The test value (only when constant). * @returns {void} */ makeForTest(test) { @@ -1145,7 +1114,6 @@ class CodePathState { /** * Makes a code path segment for the update part of a ForStatement. - * * @returns {void} */ makeForUpdate() { @@ -1173,7 +1141,6 @@ class CodePathState { /** * Makes a code path segment for the body part of a ForStatement. - * * @returns {void} */ makeForBody() { @@ -1227,7 +1194,6 @@ class CodePathState { /** * Makes a code path segment for the left part of a ForInStatement and a * ForOfStatement. - * * @returns {void} */ makeForInOfLeft() { @@ -1244,7 +1210,6 @@ class CodePathState { /** * Makes a code path segment for the right part of a ForInStatement and a * ForOfStatement. - * * @returns {void} */ makeForInOfRight() { @@ -1263,7 +1228,6 @@ class CodePathState { /** * Makes a code path segment for the body part of a ForInStatement and a * ForOfStatement. - * * @returns {void} */ makeForInOfBody() { @@ -1288,10 +1252,9 @@ class CodePathState { /** * Creates new context for BreakStatement. - * - * @param {boolean} breakable - The flag to indicate it can break by + * @param {boolean} breakable The flag to indicate it can break by * an unlabeled BreakStatement. - * @param {string|null} label - The label of this context. + * @param {string|null} label The label of this context. * @returns {Object} The new context. */ pushBreakContext(breakable, label) { @@ -1306,7 +1269,6 @@ class CodePathState { /** * Removes the top item of the break context stack. - * * @returns {Object} The removed context. */ popBreakContext() { @@ -1333,8 +1295,7 @@ class CodePathState { * * It registers the head segment to a context of `break`. * It makes new unreachable segment, then it set the head with the segment. - * - * @param {string} label - A label of the break statement. + * @param {string} label A label of the break statement. * @returns {void} */ makeBreak(label) { @@ -1359,8 +1320,7 @@ class CodePathState { * * It makes a looping path. * It makes new unreachable segment, then it set the head with the segment. - * - * @param {string} label - A label of the continue statement. + * @param {string} label A label of the continue statement. * @returns {void} */ makeContinue(label) { @@ -1395,7 +1355,6 @@ class CodePathState { * * It registers the head segment to a context of `return`. * It makes new unreachable segment, then it set the head with the segment. - * * @returns {void} */ makeReturn() { @@ -1412,7 +1371,6 @@ class CodePathState { * * It registers the head segment to a context of `throw`. * It makes new unreachable segment, then it set the head with the segment. - * * @returns {void} */ makeThrow() { diff --git a/lib/linter/code-path-analysis/code-path.js b/lib/linter/code-path-analysis/code-path.js index cb26ea18a3e..b9f72912fba 100644 --- a/lib/linter/code-path-analysis/code-path.js +++ b/lib/linter/code-path-analysis/code-path.js @@ -22,9 +22,9 @@ const IdGenerator = require("./id-generator"); class CodePath { /** - * @param {string} id - An identifier. - * @param {CodePath|null} upper - The code path of the upper function scope. - * @param {Function} onLooped - A callback function to notify looping. + * @param {string} id An identifier. + * @param {CodePath|null} upper The code path of the upper function scope. + * @param {Function} onLooped A callback function to notify looping. */ constructor(id, upper, onLooped) { @@ -62,8 +62,7 @@ class CodePath { /** * Gets the state of a given code path. - * - * @param {CodePath} codePath - A code path to get. + * @param {CodePath} codePath A code path to get. * @returns {CodePathState} The state of the code path. */ static getState(codePath) { @@ -126,11 +125,10 @@ class CodePath { * * - `controller.skip()` - Skip the following segments in this branch. * - `controller.break()` - Skip all following segments. - * - * @param {Object} [options] - Omittable. - * @param {CodePathSegment} [options.first] - The first segment to traverse. - * @param {CodePathSegment} [options.last] - The last segment to traverse. - * @param {Function} callback - A callback function. + * @param {Object} [options] Omittable. + * @param {CodePathSegment} [options.first] The first segment to traverse. + * @param {CodePathSegment} [options.last] The last segment to traverse. + * @param {Function} callback A callback function. * @returns {void} */ traverseSegments(options, callback) { @@ -171,7 +169,7 @@ class CodePath { /** * Checks a given previous segment has been visited. - * @param {CodePathSegment} prevSegment - A previous segment to check. + * @param {CodePathSegment} prevSegment A previous segment to check. * @returns {boolean} `true` if the segment has been visited. */ function isVisited(prevSegment) { diff --git a/lib/linter/code-path-analysis/debug-helpers.js b/lib/linter/code-path-analysis/debug-helpers.js index 2ca6dbc1e52..35a4cb2dacb 100644 --- a/lib/linter/code-path-analysis/debug-helpers.js +++ b/lib/linter/code-path-analysis/debug-helpers.js @@ -17,7 +17,7 @@ const debug = require("debug")("eslint:code-path"); /** * Gets id of a given segment. - * @param {CodePathSegment} segment - A segment to get. + * @param {CodePathSegment} segment A segment to get. * @returns {string} Id of the segment. */ /* istanbul ignore next */ @@ -39,18 +39,16 @@ module.exports = { /** * Dumps given objects. - * - * @param {...any} args - objects to dump. + * @param {...any} args objects to dump. * @returns {void} */ dump: debug, /** * Dumps the current analyzing state. - * - * @param {ASTNode} node - A node to dump. - * @param {CodePathState} state - A state to dump. - * @param {boolean} leaving - A flag whether or not it's leaving + * @param {ASTNode} node A node to dump. + * @param {CodePathState} state A state to dump. + * @param {boolean} leaving A flag whether or not it's leaving * @returns {void} */ dumpState: !debug.enabled ? debug : /* istanbul ignore next */ function(node, state, leaving) { @@ -73,8 +71,7 @@ module.exports = { /** * Dumps a DOT code of a given code path. * The DOT code can be visialized with Graphvis. - * - * @param {CodePath} codePath - A code path to dump. + * @param {CodePath} codePath A code path to dump. * @returns {void} * @see http://www.graphviz.org * @see http://www.webgraphviz.com @@ -139,9 +136,8 @@ module.exports = { /** * Makes a DOT code of a given code path. * The DOT code can be visialized 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. + * @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. */ makeDotArrows(codePath, traceMap) { diff --git a/lib/linter/code-path-analysis/fork-context.js b/lib/linter/code-path-analysis/fork-context.js index 939ed2d0d9a..76a64f876ff 100644 --- a/lib/linter/code-path-analysis/fork-context.js +++ b/lib/linter/code-path-analysis/fork-context.js @@ -22,8 +22,7 @@ const assert = require("assert"), /** * Gets whether or not a given segment is reachable. - * - * @param {CodePathSegment} segment - A segment to get. + * @param {CodePathSegment} segment A segment to get. * @returns {boolean} `true` if the segment is reachable. */ function isReachable(segment) { @@ -36,11 +35,10 @@ function isReachable(segment) { * When `context.segmentsList` is `[[a, b], [c, d], [e, f]]`, `begin` is `0`, and * `end` is `-1`, this creates `[g, h]`. This `g` is from `a`, `c`, and `e`. * This `h` is from `b`, `d`, and `f`. - * - * @param {ForkContext} context - An instance. - * @param {number} begin - The first index of the previous segments. - * @param {number} end - The last index of the previous segments. - * @param {Function} create - A factory function of new segments. + * @param {ForkContext} context An instance. + * @param {number} begin The first index of the previous segments. + * @param {number} end The last index of the previous segments. + * @param {Function} create A factory function of new segments. * @returns {CodePathSegment[]} New segments. */ function makeSegments(context, begin, end, create) { @@ -69,9 +67,8 @@ function makeSegments(context, begin, end, create) { * control statement (such as `break`, `continue`) from the `finally` block, the * destination's segments may be half of the source segments. In that case, this * merges segments. - * - * @param {ForkContext} context - An instance. - * @param {CodePathSegment[]} segments - Segments to merge. + * @param {ForkContext} context An instance. + * @param {CodePathSegment[]} segments Segments to merge. * @returns {CodePathSegment[]} The merged segments. */ function mergeExtraSegments(context, segments) { @@ -101,9 +98,9 @@ function mergeExtraSegments(context, segments) { class ForkContext { /** - * @param {IdGenerator} idGenerator - An identifier generator for segments. - * @param {ForkContext|null} upper - An upper fork context. - * @param {number} count - A number of parallel segments. + * @param {IdGenerator} idGenerator An identifier generator for segments. + * @param {ForkContext|null} upper An upper fork context. + * @param {number} count A number of parallel segments. */ constructor(idGenerator, upper, count) { this.idGenerator = idGenerator; @@ -142,9 +139,8 @@ class ForkContext { /** * Creates new segments from this context. - * - * @param {number} begin - The first index of previous segments. - * @param {number} end - The last index of previous segments. + * @param {number} begin The first index of previous segments. + * @param {number} end The last index of previous segments. * @returns {CodePathSegment[]} New segments. */ makeNext(begin, end) { @@ -154,9 +150,8 @@ class ForkContext { /** * Creates new segments from this context. * The new segments is always unreachable. - * - * @param {number} begin - The first index of previous segments. - * @param {number} end - The last index of previous segments. + * @param {number} begin The first index of previous segments. + * @param {number} end The last index of previous segments. * @returns {CodePathSegment[]} New segments. */ makeUnreachable(begin, end) { @@ -167,9 +162,8 @@ class ForkContext { * Creates new segments from this context. * The new segments don't have connections for previous segments. * But these inherit the reachable flag from this context. - * - * @param {number} begin - The first index of previous segments. - * @param {number} end - The last index of previous segments. + * @param {number} begin The first index of previous segments. + * @param {number} end The last index of previous segments. * @returns {CodePathSegment[]} New segments. */ makeDisconnected(begin, end) { @@ -179,8 +173,7 @@ class ForkContext { /** * Adds segments into this context. * The added segments become the head. - * - * @param {CodePathSegment[]} segments - Segments to add. + * @param {CodePathSegment[]} segments Segments to add. * @returns {void} */ add(segments) { @@ -192,8 +185,7 @@ class ForkContext { /** * Replaces the head segments with given segments. * The current head segments are removed. - * - * @param {CodePathSegment[]} segments - Segments to add. + * @param {CodePathSegment[]} segments Segments to add. * @returns {void} */ replaceHead(segments) { @@ -204,8 +196,7 @@ class ForkContext { /** * Adds all segments of a given fork context into this context. - * - * @param {ForkContext} context - A fork context to add. + * @param {ForkContext} context A fork context to add. * @returns {void} */ addAll(context) { @@ -220,7 +211,6 @@ class ForkContext { /** * Clears all secments in this context. - * * @returns {void} */ clear() { @@ -229,8 +219,7 @@ class ForkContext { /** * Creates the root fork context. - * - * @param {IdGenerator} idGenerator - An identifier generator for segments. + * @param {IdGenerator} idGenerator An identifier generator for segments. * @returns {ForkContext} New fork context. */ static newRoot(idGenerator) { @@ -243,9 +232,8 @@ class ForkContext { /** * Creates an empty fork context preceded by a given context. - * - * @param {ForkContext} parentContext - The parent fork context. - * @param {boolean} forkLeavingPath - A flag which shows inside of `finally` block. + * @param {ForkContext} parentContext The parent fork context. + * @param {boolean} forkLeavingPath A flag which shows inside of `finally` block. * @returns {ForkContext} New fork context. */ static newEmpty(parentContext, forkLeavingPath) { diff --git a/lib/linter/code-path-analysis/id-generator.js b/lib/linter/code-path-analysis/id-generator.js index 062058ddc12..83787a4ea5a 100644 --- a/lib/linter/code-path-analysis/id-generator.js +++ b/lib/linter/code-path-analysis/id-generator.js @@ -19,7 +19,7 @@ class IdGenerator { /** - * @param {string} prefix - Optional. A prefix of generated ids. + * @param {string} prefix Optional. A prefix of generated ids. */ constructor(prefix) { this.prefix = String(prefix); @@ -28,7 +28,6 @@ class IdGenerator { /** * Generates id. - * * @returns {string} A generated id. */ next() { diff --git a/lib/linter/linter.js b/lib/linter/linter.js index 534181da9e4..311cd8995af 100644 --- a/lib/linter/linter.js +++ b/lib/linter/linter.js @@ -438,7 +438,7 @@ const eslintEnvPattern = /\/\*\s*eslint-env\s(.+?)\*\//gu; /** * Checks whether or not there is a comment which has "eslint-env *" in a given text. - * @param {string} text - A source code text to check. + * @param {string} text A source code text to check. * @returns {Object|null} A result of parseListConfig() with "eslint-env *" comment. */ function findEslintEnv(text) { @@ -555,8 +555,7 @@ function resolveGlobals(providedGlobals, enabledEnvironments) { /** * Strips Unicode BOM from a given text. - * - * @param {string} text - A text to strip. + * @param {string} text A text to strip. * @returns {string} The stripped text. */ function stripUnicodeBOM(text) { diff --git a/lib/linter/node-event-generator.js b/lib/linter/node-event-generator.js index 1267081d95b..ece44a10290 100644 --- a/lib/linter/node-event-generator.js +++ b/lib/linter/node-event-generator.js @@ -286,7 +286,7 @@ class NodeEventGenerator { /** * Emits an event of entering AST node. - * @param {ASTNode} node - A node which was entered. + * @param {ASTNode} node A node which was entered. * @returns {void} */ enterNode(node) { @@ -298,7 +298,7 @@ class NodeEventGenerator { /** * Emits an event of leaving AST node. - * @param {ASTNode} node - A node which was left. + * @param {ASTNode} node A node which was left. * @returns {void} */ leaveNode(node) { diff --git a/lib/rule-tester/rule-tester.js b/lib/rule-tester/rule-tester.js index 9f8324a358f..e57cd09bd87 100644 --- a/lib/rule-tester/rule-tester.js +++ b/lib/rule-tester/rule-tester.js @@ -78,8 +78,7 @@ const hasOwnProperty = Function.call.bind(Object.hasOwnProperty); /** * Clones a given value deeply. * Note: This ignores `parent` property. - * - * @param {any} x - A value to clone. + * @param {any} x A value to clone. * @returns {any} A cloned value. */ function cloneDeeplyExcludesParent(x) { @@ -104,8 +103,7 @@ function cloneDeeplyExcludesParent(x) { /** * Freezes a given value deeply. - * - * @param {any} x - A value to freeze. + * @param {any} x A value to freeze. * @returns {void} */ function freezeDeeply(x) { @@ -146,8 +144,8 @@ const IT = Symbol("it"); /** * This is `it` default handler if `it` don't exist. * @this {Mocha} - * @param {string} text - The description of the test case. - * @param {Function} method - The logic of the test case. + * @param {string} text The description of the test case. + * @param {Function} method The logic of the test case. * @returns {any} Returned value of `method`. */ function itDefaultHandler(text, method) { @@ -164,8 +162,8 @@ function itDefaultHandler(text, method) { /** * This is `describe` default handler if `describe` don't exist. * @this {Mocha} - * @param {string} text - The description of the test case. - * @param {Function} method - The logic of the test case. + * @param {string} text The description of the test case. + * @param {Function} method The logic of the test case. * @returns {any} Returned value of `method`. */ function describeDefaultHandler(text, method) { diff --git a/lib/rules/accessor-pairs.js b/lib/rules/accessor-pairs.js index a33d1f32f2e..3a32db6eac7 100644 --- a/lib/rules/accessor-pairs.js +++ b/lib/rules/accessor-pairs.js @@ -79,7 +79,7 @@ function areEqualKeys(left, right) { /** * Checks whether or not a given node is of an accessor kind ('get' or 'set'). - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is of an accessor kind. */ function isAccessorKind(node) { @@ -88,8 +88,8 @@ function isAccessorKind(node) { /** * Checks whether or not a given node is an `Identifier` node which was named a given name. - * @param {ASTNode} node - A node to check. - * @param {string} name - An expected name of the node. + * @param {ASTNode} node A node to check. + * @param {string} name An expected name of the node. * @returns {boolean} `true` if the node is an `Identifier` node which was named as expected. */ function isIdentifier(node, name) { @@ -98,10 +98,10 @@ function isIdentifier(node, name) { /** * Checks whether or not a given node is an argument of a specified method call. - * @param {ASTNode} node - A node to check. - * @param {number} index - An expected index of the node in arguments. - * @param {string} object - An expected name of the object of the method. - * @param {string} property - An expected name of the method. + * @param {ASTNode} node A node to check. + * @param {number} index An expected index of the node in arguments. + * @param {string} object An expected name of the object of the method. + * @param {string} property An expected name of the method. * @returns {boolean} `true` if the node is an argument of the specified method call. */ function isArgumentOfMethodCall(node, index, object, property) { @@ -119,7 +119,7 @@ function isArgumentOfMethodCall(node, index, object, property) { /** * Checks whether or not a given node is a property descriptor. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a property descriptor. */ function isPropertyDescriptor(node) { diff --git a/lib/rules/array-bracket-newline.js b/lib/rules/array-bracket-newline.js index f6be2e8dd02..21463177762 100644 --- a/lib/rules/array-bracket-newline.js +++ b/lib/rules/array-bracket-newline.js @@ -65,8 +65,7 @@ module.exports = { /** * Normalizes a given option value. - * - * @param {string|Object|undefined} option - An option value to parse. + * @param {string|Object|undefined} option An option value to parse. * @returns {{multiline: boolean, minItems: number}} Normalized option object. */ function normalizeOptionValue(option) { @@ -97,8 +96,7 @@ module.exports = { /** * Normalizes a given option value. - * - * @param {string|Object|undefined} options - An option value to parse. + * @param {string|Object|undefined} options An option value to parse. * @returns {{ArrayExpression: {multiline: boolean, minItems: number}, ArrayPattern: {multiline: boolean, minItems: number}}} Normalized option object. */ function normalizeOptions(options) { @@ -109,8 +107,8 @@ module.exports = { /** * Reports that there shouldn't be a linebreak after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoBeginningLinebreak(node, token) { @@ -132,8 +130,8 @@ module.exports = { /** * Reports that there shouldn't be a linebreak before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoEndingLinebreak(node, token) { @@ -155,8 +153,8 @@ module.exports = { /** * Reports that there should be a linebreak after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredBeginningLinebreak(node, token) { @@ -172,8 +170,8 @@ module.exports = { /** * Reports that there should be a linebreak before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredEndingLinebreak(node, token) { @@ -189,8 +187,7 @@ module.exports = { /** * Reports a given node if it violated this rule. - * - * @param {ASTNode} node - A node to check. This is an ArrayExpression node or an ArrayPattern node. + * @param {ASTNode} node A node to check. This is an ArrayExpression node or an ArrayPattern node. * @returns {void} */ function check(node) { diff --git a/lib/rules/array-bracket-spacing.js b/lib/rules/array-bracket-spacing.js index 0a51d350cd7..2510159ee48 100644 --- a/lib/rules/array-bracket-spacing.js +++ b/lib/rules/array-bracket-spacing.js @@ -59,7 +59,7 @@ module.exports = { * Determines whether an option is set, relative to the spacing option. * If spaced is "always", then check whether option is set to false. * If spaced is "never", then check whether option is set to true. - * @param {Object} option - The option to exclude. + * @param {Object} option The option to exclude. * @returns {boolean} Whether or not the property is excluded. */ function isOptionSet(option) { @@ -79,8 +79,8 @@ module.exports = { /** * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoBeginningSpace(node, token) { @@ -101,8 +101,8 @@ module.exports = { /** * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoEndingSpace(node, token) { @@ -123,8 +123,8 @@ module.exports = { /** * Reports that there should be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredBeginningSpace(node, token) { @@ -143,8 +143,8 @@ module.exports = { /** * Reports that there should be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredEndingSpace(node, token) { @@ -163,7 +163,7 @@ module.exports = { /** * Determines if a node is an object type - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} Whether or not the node is an object type. */ function isObjectType(node) { @@ -172,7 +172,7 @@ module.exports = { /** * Determines if a node is an array type - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} Whether or not the node is an array type. */ function isArrayType(node) { @@ -181,7 +181,7 @@ module.exports = { /** * Validates the spacing around array brackets - * @param {ASTNode} node - The node we're checking for spacing + * @param {ASTNode} node The node we're checking for spacing * @returns {void} */ function validateArraySpacing(node) { diff --git a/lib/rules/array-callback-return.js b/lib/rules/array-callback-return.js index bd1f3a37aad..d632a3f30c2 100644 --- a/lib/rules/array-callback-return.js +++ b/lib/rules/array-callback-return.js @@ -22,8 +22,7 @@ const TARGET_METHODS = /^(?:every|filter|find(?:Index)?|map|reduce(?:Right)?|som /** * Checks a given code path segment is reachable. - * - * @param {CodePathSegment} segment - A segment to check. + * @param {CodePathSegment} segment A segment to check. * @returns {boolean} `true` if the segment is reachable. */ function isReachable(segment) { @@ -35,9 +34,8 @@ function isReachable(segment) { * * - FunctionExpression -> the function name or `function` keyword. * - ArrowFunctionExpression -> `=>` token. - * - * @param {ASTNode} node - A function node to get. - * @param {SourceCode} sourceCode - A source code to get tokens. + * @param {ASTNode} node A function node to get. + * @param {SourceCode} sourceCode A source code to get tokens. * @returns {ASTNode|Token} The node or the token of a location. */ function getLocation(node, sourceCode) { @@ -50,8 +48,7 @@ function getLocation(node, sourceCode) { /** * Checks a given node is a MemberExpression node which has the specified name's * property. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a MemberExpression node which has * the specified name's property */ @@ -65,8 +62,7 @@ function isTargetMethod(node) { /** * Checks whether or not a given node is a function expression which is the * callback of an array method. - * - * @param {ASTNode} node - A node to check. This is one of + * @param {ASTNode} node A node to check. This is one of * FunctionExpression or ArrowFunctionExpression. * @returns {boolean} `true` if the node is the callback of an array method. */ @@ -188,8 +184,7 @@ module.exports = { * * If the last code path segment is reachable, there are paths which are not * returned or thrown. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function checkLastSegment(node) { diff --git a/lib/rules/array-element-newline.js b/lib/rules/array-element-newline.js index c3d026ad696..1da67667bee 100644 --- a/lib/rules/array-element-newline.js +++ b/lib/rules/array-element-newline.js @@ -62,8 +62,7 @@ module.exports = { /** * Normalizes a given option value. - * - * @param {string|Object|undefined} providedOption - An option value to parse. + * @param {string|Object|undefined} providedOption An option value to parse. * @returns {{multiline: boolean, minItems: number}} Normalized option object. */ function normalizeOptionValue(providedOption) { @@ -90,8 +89,7 @@ module.exports = { /** * Normalizes a given option value. - * - * @param {string|Object|undefined} options - An option value to parse. + * @param {string|Object|undefined} options An option value to parse. * @returns {{ArrayExpression: {multiline: boolean, minItems: number}, ArrayPattern: {multiline: boolean, minItems: number}}} Normalized option object. */ function normalizeOptions(options) { @@ -102,7 +100,7 @@ module.exports = { /** * Reports that there shouldn't be a line break after the first token - * @param {Token} token - The token to use for the report. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoLineBreak(token) { @@ -151,7 +149,7 @@ module.exports = { /** * Reports that there should be a line break after the first token - * @param {Token} token - The token to use for the report. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredLineBreak(token) { @@ -171,8 +169,7 @@ module.exports = { /** * Reports a given node if it violated this rule. - * - * @param {ASTNode} node - A node to check. This is an ObjectExpression node or an ObjectPattern node. + * @param {ASTNode} node A node to check. This is an ObjectExpression node or an ObjectPattern node. * @returns {void} */ function check(node) { diff --git a/lib/rules/arrow-parens.js b/lib/rules/arrow-parens.js index b4b26e35342..dc3c3825791 100644 --- a/lib/rules/arrow-parens.js +++ b/lib/rules/arrow-parens.js @@ -16,7 +16,6 @@ const astUtils = require("./utils/ast-utils"); /** * Get location should be reported by AST node. - * * @param {ASTNode} node AST Node. * @returns {Location} Location information. */ diff --git a/lib/rules/block-scoped-var.js b/lib/rules/block-scoped-var.js index 053cfc334cd..481057ba6c7 100644 --- a/lib/rules/block-scoped-var.js +++ b/lib/rules/block-scoped-var.js @@ -31,7 +31,7 @@ module.exports = { /** * Makes a block scope. - * @param {ASTNode} node - A node of a scope. + * @param {ASTNode} node A node of a scope. * @returns {void} */ function enterScope(node) { @@ -48,7 +48,7 @@ module.exports = { /** * Reports a given reference. - * @param {eslint-scope.Reference} reference - A reference to report. + * @param {eslint-scope.Reference} reference A reference to report. * @returns {void} */ function report(reference) { @@ -59,7 +59,7 @@ module.exports = { /** * Finds and reports references which are outside of valid scopes. - * @param {ASTNode} node - A node to get variables. + * @param {ASTNode} node A node to get variables. * @returns {void} */ function checkForVariables(node) { diff --git a/lib/rules/block-spacing.js b/lib/rules/block-spacing.js index e843148e5d1..c6ed44a2798 100644 --- a/lib/rules/block-spacing.js +++ b/lib/rules/block-spacing.js @@ -41,7 +41,7 @@ module.exports = { /** * Gets the open brace token from a given node. - * @param {ASTNode} node - A BlockStatement/SwitchStatement node to get. + * @param {ASTNode} node A BlockStatement/SwitchStatement node to get. * @returns {Token} The token of the open brace. */ function getOpenBrace(node) { @@ -58,8 +58,8 @@ module.exports = { * Checks whether or not: * - given tokens are on same line. * - there is/isn't a space between given tokens. - * @param {Token} left - A token to check. - * @param {Token} right - The token which is next to `left`. + * @param {Token} left A token to check. + * @param {Token} right The token which is next to `left`. * @returns {boolean} * When the option is `"always"`, `true` if there are one or more spaces between given tokens. * When the option is `"never"`, `true` if there are not any spaces between given tokens. @@ -74,7 +74,7 @@ module.exports = { /** * Reports invalid spacing style inside braces. - * @param {ASTNode} node - A BlockStatement/SwitchStatement node to get. + * @param {ASTNode} node A BlockStatement/SwitchStatement node to get. * @returns {void} */ function checkSpacingInsideBraces(node) { diff --git a/lib/rules/capitalized-comments.js b/lib/rules/capitalized-comments.js index dd7ef145648..d7524b878d2 100644 --- a/lib/rules/capitalized-comments.js +++ b/lib/rules/capitalized-comments.js @@ -54,7 +54,6 @@ const DEFAULTS = { * set is returned. Options specified in overrides will take priority * over options specified in the main options object, which will in * turn take priority over the rule's defaults. - * * @param {Object|string} rawOptions The user-provided options. * @param {string} which Either "line" or "block". * @returns {Object} The normalized options. @@ -65,7 +64,6 @@ function getNormalizedOptions(rawOptions, which) { /** * Get normalized options for block and line comments. - * * @param {Object|string} rawOptions The user-provided options. * @returns {Object} An object with "Line" and "Block" keys and corresponding * normalized options objects. @@ -82,7 +80,6 @@ function getAllNormalizedOptions(rawOptions = {}) { * options. * * This is done in order to avoid invoking the RegExp constructor repeatedly. - * * @param {Object} normalizedOptions The normalized rule options. * @returns {void} */ @@ -162,7 +159,6 @@ module.exports = { * Also, it follows from this definition that only block comments can * be considered as possibly inline. This is because line comments * would consume any following tokens on the same line as the comment. - * * @param {ASTNode} comment The comment node to check. * @returns {boolean} True if the comment is an inline comment, false * otherwise. @@ -181,7 +177,6 @@ module.exports = { /** * Determine if a comment follows another comment. - * * @param {ASTNode} comment The comment to check. * @returns {boolean} True if the comment follows a valid comment. */ @@ -196,7 +191,6 @@ module.exports = { /** * Check a comment to determine if it is valid for this rule. - * * @param {ASTNode} comment The comment node to process. * @param {Object} options The options for checking this comment. * @returns {boolean} True if the comment is valid, false otherwise. @@ -261,7 +255,6 @@ module.exports = { /** * Process a comment to determine if it needs to be reported. - * * @param {ASTNode} comment The comment node to process. * @returns {void} */ diff --git a/lib/rules/class-methods-use-this.js b/lib/rules/class-methods-use-this.js index 4bf17090abc..2cc5cc41842 100644 --- a/lib/rules/class-methods-use-this.js +++ b/lib/rules/class-methods-use-this.js @@ -61,7 +61,7 @@ module.exports = { /** * Check if the node is an instance method - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {boolean} True if its an instance method * @private */ @@ -71,7 +71,7 @@ module.exports = { /** * Check if the node is an instance method not excluded by config - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {boolean} True if it is an instance method, and not excluded by config * @private */ @@ -84,7 +84,7 @@ module.exports = { * Checks if we are leaving a function that is a method, and reports if 'this' has not been used. * Static methods and the constructor are exempt. * Then pops the context off the stack. - * @param {ASTNode} node - A function node that was entered. + * @param {ASTNode} node A function node that was entered. * @returns {void} * @private */ diff --git a/lib/rules/comma-dangle.js b/lib/rules/comma-dangle.js index 9cd6660d5d1..0c177296ea1 100644 --- a/lib/rules/comma-dangle.js +++ b/lib/rules/comma-dangle.js @@ -27,8 +27,7 @@ const DEFAULT_OPTIONS = Object.freeze({ /** * Checks whether or not a trailing comma is allowed in a given node. * If the `lastItem` is `RestElement` or `RestProperty`, it disallows trailing commas. - * - * @param {ASTNode} lastItem - The node of the last element in the given node. + * @param {ASTNode} lastItem The node of the last element in the given node. * @returns {boolean} `true` if a trailing comma is allowed. */ function isTrailingCommaAllowed(lastItem) { @@ -41,8 +40,7 @@ function isTrailingCommaAllowed(lastItem) { /** * Normalize option value. - * - * @param {string|Object|undefined} optionValue - The 1st option value to normalize. + * @param {string|Object|undefined} optionValue The 1st option value to normalize. * @returns {Object} The normalized option value. */ function normalizeOptions(optionValue) { @@ -142,7 +140,7 @@ module.exports = { /** * Gets the last item of the given node. - * @param {ASTNode} node - The node to get. + * @param {ASTNode} node The node to get. * @returns {ASTNode|null} The last node or null. */ function getLastItem(node) { @@ -172,9 +170,8 @@ module.exports = { * Gets the trailing comma token of the given node. * If the trailing comma does not exist, this returns the token which is * the insertion point of the trailing comma token. - * - * @param {ASTNode} node - The node to get. - * @param {ASTNode} lastItem - The last item of the node. + * @param {ASTNode} node The node to get. + * @param {ASTNode} lastItem The last item of the node. * @returns {Token} The trailing comma token or the insertion point. */ function getTrailingToken(node, lastItem) { @@ -199,8 +196,7 @@ module.exports = { * Checks whether or not a given node is multiline. * This rule handles a given node as multiline when the closing parenthesis * and the last element are not on the same line. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is multiline. */ function isMultiline(node) { @@ -218,8 +214,7 @@ module.exports = { /** * Reports a trailing comma if it exists. - * - * @param {ASTNode} node - A node to check. Its type is one of + * @param {ASTNode} node A node to check. Its type is one of * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, * ImportDeclaration, and ExportNamedDeclaration. * @returns {void} @@ -251,8 +246,7 @@ module.exports = { * * If a given node is `ArrayPattern` which has `RestElement`, the trailing * comma is disallowed, so report if it exists. - * - * @param {ASTNode} node - A node to check. Its type is one of + * @param {ASTNode} node A node to check. Its type is one of * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, * ImportDeclaration, and ExportNamedDeclaration. * @returns {void} @@ -286,8 +280,7 @@ module.exports = { * If a given node is multiline, reports the last element of a given node * when it does not have a trailing comma. * Otherwise, reports a trailing comma if it exists. - * - * @param {ASTNode} node - A node to check. Its type is one of + * @param {ASTNode} node A node to check. Its type is one of * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, * ImportDeclaration, and ExportNamedDeclaration. * @returns {void} @@ -304,8 +297,7 @@ module.exports = { * Only if a given node is not multiline, reports the last element of a given node * when it does not have a trailing comma. * Otherwise, reports a trailing comma if it exists. - * - * @param {ASTNode} node - A node to check. Its type is one of + * @param {ASTNode} node A node to check. Its type is one of * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, * ImportDeclaration, and ExportNamedDeclaration. * @returns {void} diff --git a/lib/rules/comma-spacing.js b/lib/rules/comma-spacing.js index 79a556a8857..73c10a7711b 100644 --- a/lib/rules/comma-spacing.js +++ b/lib/rules/comma-spacing.js @@ -105,7 +105,7 @@ module.exports = { /** * Validates the spacing around a comma token. - * @param {Object} tokens - The tokens to be validated. + * @param {Object} tokens The tokens to be validated. * @param {Token} tokens.comma The token representing the comma. * @param {Token} [tokens.left] The last token before the comma. * @param {Token} [tokens.right] The first token after the comma. diff --git a/lib/rules/computed-property-spacing.js b/lib/rules/computed-property-spacing.js index 33f7c9401a9..bc8be964f4f 100644 --- a/lib/rules/computed-property-spacing.js +++ b/lib/rules/computed-property-spacing.js @@ -59,9 +59,9 @@ module.exports = { /** * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @param {Token} tokenAfter - The token after `token`. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @param {Token} tokenAfter The token after `token`. * @returns {void} */ function reportNoBeginningSpace(node, token, tokenAfter) { @@ -80,9 +80,9 @@ module.exports = { /** * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @param {Token} tokenBefore - The token before `token`. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @param {Token} tokenBefore The token before `token`. * @returns {void} */ function reportNoEndingSpace(node, token, tokenBefore) { @@ -101,8 +101,8 @@ module.exports = { /** * Reports that there should be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredBeginningSpace(node, token) { @@ -121,8 +121,8 @@ module.exports = { /** * Reports that there should be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredEndingSpace(node, token) { diff --git a/lib/rules/consistent-return.js b/lib/rules/consistent-return.js index 16f0070bc7c..22667fa4707 100644 --- a/lib/rules/consistent-return.js +++ b/lib/rules/consistent-return.js @@ -18,8 +18,8 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a given node is an `Identifier` node which was named a given name. - * @param {ASTNode} node - A node to check. - * @param {string} name - An expected name of the node. + * @param {ASTNode} node A node to check. + * @param {string} name An expected name of the node. * @returns {boolean} `true` if the node is an `Identifier` node which was named as expected. */ function isIdentifier(node, name) { @@ -28,7 +28,7 @@ function isIdentifier(node, name) { /** * Checks whether or not a given code path segment is unreachable. - * @param {CodePathSegment} segment - A CodePathSegment to check. + * @param {CodePathSegment} segment A CodePathSegment to check. * @returns {boolean} `true` if the segment is unreachable. */ function isUnreachable(segment) { @@ -88,8 +88,7 @@ module.exports = { /** * Checks whether of not the implicit returning is consistent if the last * code path segment is reachable. - * - * @param {ASTNode} node - A program/function node to check. + * @param {ASTNode} node A program/function node to check. * @returns {void} */ function checkLastSegment(node) { diff --git a/lib/rules/consistent-this.js b/lib/rules/consistent-this.js index 4bdcdfdc10e..16f53b5374c 100644 --- a/lib/rules/consistent-this.js +++ b/lib/rules/consistent-this.js @@ -46,8 +46,8 @@ module.exports = { /** * Reports that a variable declarator or assignment expression is assigning * a non-'this' value to the specified alias. - * @param {ASTNode} node - The assigning node. - * @param {string} name - the name of the alias that was incorrectly used. + * @param {ASTNode} node The assigning node. + * @param {string} name the name of the alias that was incorrectly used. * @returns {void} */ function reportBadAssignment(node, name) { @@ -57,9 +57,9 @@ module.exports = { /** * Checks that an assignment to an identifier only assigns 'this' to the * appropriate alias, and the alias is only assigned to 'this'. - * @param {ASTNode} node - The assigning node. - * @param {Identifier} name - The name of the variable assigned to. - * @param {Expression} value - The value of the assignment. + * @param {ASTNode} node The assigning node. + * @param {Identifier} name The name of the variable assigned to. + * @param {Expression} value The value of the assignment. * @returns {void} */ function checkAssignment(node, name, value) { diff --git a/lib/rules/constructor-super.js b/lib/rules/constructor-super.js index e4cdb099b3b..5a848f210ca 100644 --- a/lib/rules/constructor-super.js +++ b/lib/rules/constructor-super.js @@ -11,8 +11,7 @@ /** * Checks whether a given code path segment is reachable or not. - * - * @param {CodePathSegment} segment - A code path segment to check. + * @param {CodePathSegment} segment A code path segment to check. * @returns {boolean} `true` if the segment is reachable. */ function isReachable(segment) { @@ -21,7 +20,7 @@ function isReachable(segment) { /** * Checks whether or not a given node is a constructor. - * @param {ASTNode} node - A node to check. This node type is one of + * @param {ASTNode} node A node to check. This node type is one of * `Program`, `FunctionDeclaration`, `FunctionExpression`, and * `ArrowFunctionExpression`. * @returns {boolean} `true` if the node is a constructor. @@ -36,8 +35,7 @@ function isConstructorFunction(node) { /** * Checks whether a given node can be a constructor or not. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node can be a constructor. */ function isPossibleConstructor(node) { @@ -137,7 +135,7 @@ module.exports = { /** * Gets the flag which shows `super()` is called in some paths. - * @param {CodePathSegment} segment - A code path segment to get. + * @param {CodePathSegment} segment A code path segment to get. * @returns {boolean} The flag which shows `super()` is called in some paths */ function isCalledInSomePath(segment) { @@ -146,7 +144,7 @@ module.exports = { /** * Gets the flag which shows `super()` is called in all paths. - * @param {CodePathSegment} segment - A code path segment to get. + * @param {CodePathSegment} segment A code path segment to get. * @returns {boolean} The flag which shows `super()` is called in all paths. */ function isCalledInEveryPath(segment) { @@ -168,8 +166,8 @@ module.exports = { /** * Stacks a constructor information. - * @param {CodePath} codePath - A code path which was started. - * @param {ASTNode} node - The current node. + * @param {CodePath} codePath A code path which was started. + * @param {ASTNode} node The current node. * @returns {void} */ onCodePathStart(codePath, node) { @@ -200,8 +198,8 @@ module.exports = { /** * Pops a constructor information. * And reports if `super()` lacked. - * @param {CodePath} codePath - A code path which was ended. - * @param {ASTNode} node - The current node. + * @param {CodePath} codePath A code path which was ended. + * @param {ASTNode} node The current node. * @returns {void} */ onCodePathEnd(codePath, node) { @@ -231,7 +229,7 @@ module.exports = { /** * Initialize information of a given code path segment. - * @param {CodePathSegment} segment - A code path segment to initialize. + * @param {CodePathSegment} segment A code path segment to initialize. * @returns {void} */ onCodePathSegmentStart(segment) { @@ -258,9 +256,9 @@ module.exports = { /** * Update information of the code path segment when a code path was * looped. - * @param {CodePathSegment} fromSegment - The code path segment of the + * @param {CodePathSegment} fromSegment The code path segment of the * end of a loop. - * @param {CodePathSegment} toSegment - A code path segment of the head + * @param {CodePathSegment} toSegment A code path segment of the head * of a loop. * @returns {void} */ @@ -303,7 +301,7 @@ module.exports = { /** * Checks for a call of `super()`. - * @param {ASTNode} node - A CallExpression node to check. + * @param {ASTNode} node A CallExpression node to check. * @returns {void} */ "CallExpression:exit"(node) { @@ -358,7 +356,7 @@ module.exports = { /** * Set the mark to the returned path as `super()` was called. - * @param {ASTNode} node - A ReturnStatement node to check. + * @param {ASTNode} node A ReturnStatement node to check. * @returns {void} */ ReturnStatement(node) { diff --git a/lib/rules/curly.js b/lib/rules/curly.js index 8eaaddc25c6..93c74d11fcf 100644 --- a/lib/rules/curly.js +++ b/lib/rules/curly.js @@ -119,8 +119,7 @@ module.exports = { /** * Checks if the given token is an `else` token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is an `else` token. */ function isElseKeywordToken(token) { @@ -129,7 +128,7 @@ module.exports = { /** * Gets the `else` keyword token of a given `IfStatement` node. - * @param {ASTNode} node - A `IfStatement` node to get. + * @param {ASTNode} node A `IfStatement` node to get. * @returns {Token} The `else` keyword token. */ function getElseKeyword(node) { @@ -143,8 +142,7 @@ module.exports = { * 1. The given node has the `alternate` node. * 2. There is a `IfStatement` which doesn't have `alternate` node in the * trailing statement chain of the `consequent` node. - * - * @param {ASTNode} node - A IfStatement node to check. + * @param {ASTNode} node A IfStatement node to check. * @returns {boolean} `true` if the node requires braces of the consequent chunk. */ function requiresBraceOfConsequent(node) { diff --git a/lib/rules/func-names.js b/lib/rules/func-names.js index ff3a1f4b5bf..1341d036308 100644 --- a/lib/rules/func-names.js +++ b/lib/rules/func-names.js @@ -13,7 +13,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a given variable is a function name. - * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Variable} variable A variable to check. * @returns {boolean} `true` if the variable is a function name. */ function isFunctionName(variable) { @@ -73,7 +73,7 @@ module.exports = { /** * Returns the config option for the given node. - * @param {ASTNode} node - A node to get the config for. + * @param {ASTNode} node A node to get the config for. * @returns {string} The config option. */ function getConfigForNode(node) { @@ -91,7 +91,7 @@ module.exports = { /** * Determines whether the current FunctionExpression node is a get, set, or * shorthand method in an object literal or a class. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} True if the node is a get, set, or shorthand method. */ function isObjectOrClassMethod(node) { @@ -109,7 +109,7 @@ module.exports = { /** * Determines whether the current FunctionExpression node has a name that would be * inferred from context in a conforming ES6 environment. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} True if the node would have a name assigned automatically. */ function hasInferredName(node) { @@ -125,7 +125,7 @@ module.exports = { /** * Reports that an unnamed function should be named - * @param {ASTNode} node - The node to report in the event of an error. + * @param {ASTNode} node The node to report in the event of an error. * @returns {void} */ function reportUnexpectedUnnamedFunction(node) { @@ -139,7 +139,7 @@ module.exports = { /** * Reports that a named function should be unnamed - * @param {ASTNode} node - The node to report in the event of an error. + * @param {ASTNode} node The node to report in the event of an error. * @returns {void} */ function reportUnexpectedNamedFunction(node) { diff --git a/lib/rules/generator-star-spacing.js b/lib/rules/generator-star-spacing.js index 6f860290cec..65534f727fa 100644 --- a/lib/rules/generator-star-spacing.js +++ b/lib/rules/generator-star-spacing.js @@ -78,9 +78,8 @@ module.exports = { /** * Returns resolved option definitions based on an option and defaults - * - * @param {any} option - The option object or string value - * @param {Object} defaults - The defaults to use if options are not present + * @param {any} option The option object or string value + * @param {Object} defaults The defaults to use if options are not present * @returns {Object} the resolved object definition */ function optionToDefinition(option, defaults) { @@ -107,8 +106,7 @@ module.exports = { /** * Checks if the given token is a star token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a star token. */ function isStarToken(token) { @@ -117,8 +115,7 @@ module.exports = { /** * Gets the generator star token of the given function node. - * - * @param {ASTNode} node - The function node to get. + * @param {ASTNode} node The function node to get. * @returns {Token} Found star token. */ function getStarToken(node) { @@ -139,7 +136,6 @@ module.exports = { /** * Checks the spacing between two tokens before or after the star token. - * * @param {string} kind Either "named", "anonymous", or "method" * @param {string} side Either "before" or "after". * @param {Token} leftToken `function` keyword token if side is "before", or @@ -173,7 +169,6 @@ module.exports = { /** * Enforces the spacing around the star if node is a generator function. - * * @param {ASTNode} node A function expression or declaration node. * @returns {void} */ diff --git a/lib/rules/getter-return.js b/lib/rules/getter-return.js index 6549555646e..e1468a5b19f 100644 --- a/lib/rules/getter-return.js +++ b/lib/rules/getter-return.js @@ -18,8 +18,7 @@ const TARGET_NODE_TYPE = /^(?:Arrow)?FunctionExpression$/u; /** * Checks a given code path segment is reachable. - * - * @param {CodePathSegment} segment - A segment to check. + * @param {CodePathSegment} segment A segment to check. * @returns {boolean} `true` if the segment is reachable. */ function isReachable(segment) { @@ -30,8 +29,7 @@ function isReachable(segment) { * Gets a readable location. * * - FunctionExpression -> the function name or `function` keyword. - * - * @param {ASTNode} node - A function node to get. + * @param {ASTNode} node A function node to get. * @returns {ASTNode|Token} The node or the token of a location. */ function getId(node) { @@ -92,8 +90,7 @@ module.exports = { * * If the last code path segment is reachable, there are paths which are not * returned or thrown. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function checkLastSegment(node) { @@ -113,7 +110,7 @@ module.exports = { /** * Checks whether a node means a getter function. - * @param {ASTNode} node - a node to check. + * @param {ASTNode} node a node to check. * @returns {boolean} if node means a getter, return true; else return false. */ function isGetter(node) { diff --git a/lib/rules/indent.js b/lib/rules/indent.js index a2fa9c4f409..1aeac12d17f 100644 --- a/lib/rules/indent.js +++ b/lib/rules/indent.js @@ -329,7 +329,6 @@ class OffsetStorage { * Instead, the correct way would be to offset `baz` by 1 level from `bar`, offset `bar` by 1 level from the `)`, and * offset the `)` by 0 levels from `foo`. This ensures that the offset between `bar` and the `)` are correctly collapsed * in the second case. - * * @param {Token} token The token * @param {Token} fromToken The token that `token` should be offset from * @param {number} offset The desired indent level @@ -358,7 +357,6 @@ class OffsetStorage { * * The `setDesiredOffsets` methods inserts ranges like the ones above. The third line above would be inserted by using: * `setDesiredOffsets([30, 43], fooToken, 1);` - * * @param {[number, number]} range A [start, end] pair. All tokens with range[0] <= token.start < range[1] will have the offset applied. * @param {Token} fromToken The token that this is offset from * @param {number} offset The desired indent level diff --git a/lib/rules/init-declarations.js b/lib/rules/init-declarations.js index 65197358e60..6cfdf92c909 100644 --- a/lib/rules/init-declarations.js +++ b/lib/rules/init-declarations.js @@ -11,7 +11,7 @@ /** * Checks whether or not a given node is a for loop. - * @param {ASTNode} block - A node to check. + * @param {ASTNode} block A node to check. * @returns {boolean} `true` when the node is a for loop. */ function isForLoop(block) { @@ -22,7 +22,7 @@ function isForLoop(block) { /** * Checks whether or not a given declarator node has its initializer. - * @param {ASTNode} node - A declarator node to check. + * @param {ASTNode} node A declarator node to check. * @returns {boolean} `true` when the node has its initializer. */ function isInitialized(node) { diff --git a/lib/rules/jsx-quotes.js b/lib/rules/jsx-quotes.js index e6764b2e817..3b282df2f07 100644 --- a/lib/rules/jsx-quotes.js +++ b/lib/rules/jsx-quotes.js @@ -65,7 +65,7 @@ module.exports = { /** * Checks if the given string literal node uses the expected quotes - * @param {ASTNode} node - A string literal node. + * @param {ASTNode} node A string literal node. * @returns {boolean} Whether or not the string literal used the expected quotes. * @public */ diff --git a/lib/rules/keyword-spacing.js b/lib/rules/keyword-spacing.js index a1bf9910427..ef619aa7791 100644 --- a/lib/rules/keyword-spacing.js +++ b/lib/rules/keyword-spacing.js @@ -41,8 +41,7 @@ const KEYS = keywords.concat(["as", "async", "await", "from", "get", "let", "of" /** * Checks whether or not a given token is a "Template" token ends with "${". - * - * @param {Token} token - A token to check. + * @param {Token} token A token to check. * @returns {boolean} `true` if the token is a "Template" token ends with "${". */ function isOpenParenOfTemplate(token) { @@ -51,8 +50,7 @@ function isOpenParenOfTemplate(token) { /** * Checks whether or not a given token is a "Template" token starts with "}". - * - * @param {Token} token - A token to check. + * @param {Token} token A token to check. * @returns {boolean} `true` if the token is a "Template" token starts with "}". */ function isCloseParenOfTemplate(token) { @@ -114,9 +112,8 @@ module.exports = { /** * Reports a given token if there are not space(s) before the token. - * - * @param {Token} token - A token to report. - * @param {RegExp} pattern - A pattern of the previous token to check. + * @param {Token} token A token to report. + * @param {RegExp} pattern A pattern of the previous token to check. * @returns {void} */ function expectSpaceBefore(token, pattern) { @@ -141,9 +138,8 @@ module.exports = { /** * Reports a given token if there are space(s) before the token. - * - * @param {Token} token - A token to report. - * @param {RegExp} pattern - A pattern of the previous token to check. + * @param {Token} token A token to report. + * @param {RegExp} pattern A pattern of the previous token to check. * @returns {void} */ function unexpectSpaceBefore(token, pattern) { @@ -168,9 +164,8 @@ module.exports = { /** * Reports a given token if there are not space(s) after the token. - * - * @param {Token} token - A token to report. - * @param {RegExp} pattern - A pattern of the next token to check. + * @param {Token} token A token to report. + * @param {RegExp} pattern A pattern of the next token to check. * @returns {void} */ function expectSpaceAfter(token, pattern) { @@ -195,9 +190,8 @@ module.exports = { /** * Reports a given token if there are space(s) after the token. - * - * @param {Token} token - A token to report. - * @param {RegExp} pattern - A pattern of the next token to check. + * @param {Token} token A token to report. + * @param {RegExp} pattern A pattern of the next token to check. * @returns {void} */ function unexpectSpaceAfter(token, pattern) { @@ -222,8 +216,7 @@ module.exports = { /** * Parses the option object and determines check methods for each keyword. - * - * @param {Object|undefined} options - The option object to parse. + * @param {Object|undefined} options The option object to parse. * @returns {Object} - Normalized option object. * Keys are keywords (there are for every keyword). * Values are instances of `{"before": function, "after": function}`. @@ -263,9 +256,8 @@ module.exports = { /** * Reports a given token if usage of spacing followed by the token is * invalid. - * - * @param {Token} token - A token to report. - * @param {RegExp|undefined} pattern - Optional. A pattern of the previous + * @param {Token} token A token to report. + * @param {RegExp} [pattern] Optional. A pattern of the previous * token to check. * @returns {void} */ @@ -276,9 +268,8 @@ module.exports = { /** * Reports a given token if usage of spacing preceded by the token is * invalid. - * - * @param {Token} token - A token to report. - * @param {RegExp|undefined} pattern - Optional. A pattern of the next + * @param {Token} token A token to report. + * @param {RegExp} [pattern] Optional. A pattern of the next * token to check. * @returns {void} */ @@ -288,8 +279,7 @@ module.exports = { /** * Reports a given token if usage of spacing around the token is invalid. - * - * @param {Token} token - A token to report. + * @param {Token} token A token to report. * @returns {void} */ function checkSpacingAround(token) { @@ -300,8 +290,7 @@ module.exports = { /** * Reports the first token of a given node if the first token is a keyword * and usage of spacing around the token is invalid. - * - * @param {ASTNode|null} node - A node to report. + * @param {ASTNode|null} node A node to report. * @returns {void} */ function checkSpacingAroundFirstToken(node) { @@ -318,8 +307,7 @@ module.exports = { * * This is used for unary operators (e.g. `typeof`), `function`, and `super`. * Other rules are handling usage of spacing preceded by those keywords. - * - * @param {ASTNode|null} node - A node to report. + * @param {ASTNode|null} node A node to report. * @returns {void} */ function checkSpacingBeforeFirstToken(node) { @@ -333,8 +321,7 @@ module.exports = { /** * Reports the previous token of a given node if the token is a keyword and * usage of spacing around the token is invalid. - * - * @param {ASTNode|null} node - A node to report. + * @param {ASTNode|null} node A node to report. * @returns {void} */ function checkSpacingAroundTokenBefore(node) { @@ -348,8 +335,7 @@ module.exports = { /** * Reports `async` or `function` keywords of a given node if usage of * spacing around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForFunction(node) { @@ -366,8 +352,7 @@ module.exports = { /** * Reports `class` and `extends` keywords of a given node if usage of * spacing around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForClass(node) { @@ -378,8 +363,7 @@ module.exports = { /** * Reports `if` and `else` keywords of a given node if usage of spacing * around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForIfStatement(node) { @@ -390,8 +374,7 @@ module.exports = { /** * Reports `try`, `catch`, and `finally` keywords of a given node if usage * of spacing around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForTryStatement(node) { @@ -403,8 +386,7 @@ module.exports = { /** * Reports `do` and `while` keywords of a given node if usage of spacing * around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForDoWhileStatement(node) { @@ -415,8 +397,7 @@ module.exports = { /** * Reports `for` and `in` keywords of a given node if usage of spacing * around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForForInStatement(node) { @@ -427,8 +408,7 @@ module.exports = { /** * Reports `for` and `of` keywords of a given node if usage of spacing * around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForForOfStatement(node) { @@ -449,8 +429,7 @@ module.exports = { * * import*as A from "./a"; /*error Expected space(s) after "import". * error Expected space(s) before "as". - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForModuleDeclaration(node) { @@ -474,8 +453,7 @@ module.exports = { /** * Reports `as` keyword of a given node if usage of spacing around this * keyword is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForImportNamespaceSpecifier(node) { @@ -487,8 +465,7 @@ module.exports = { /** * Reports `static`, `get`, and `set` keywords of a given node if usage of * spacing around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForProperty(node) { @@ -528,8 +505,7 @@ module.exports = { /** * Reports `await` keyword of a given node if usage of spacing before * this keyword is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForAwaitExpression(node) { diff --git a/lib/rules/lines-around-directive.js b/lib/rules/lines-around-directive.js index 39686d98916..fb439dad6a3 100644 --- a/lib/rules/lines-around-directive.js +++ b/lib/rules/lines-around-directive.js @@ -131,7 +131,7 @@ module.exports = { /** * Check lines around directives in node - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {void} */ function checkDirectives(node) { diff --git a/lib/rules/max-len.js b/lib/rules/max-len.js index 45b02f35117..b29099ed4c4 100644 --- a/lib/rules/max-len.js +++ b/lib/rules/max-len.js @@ -198,7 +198,6 @@ module.exports = { /** * Ensure that an array exists at [key] on `object`, and add `value` to it. - * * @param {Object} object the object to mutate * @param {string} key the object's key * @param {*} value the value to add @@ -214,7 +213,6 @@ module.exports = { /** * Retrieves an array containing all strings (" or ') in the source code. - * * @returns {ASTNode[]} An array of string nodes. */ function getAllStrings() { @@ -224,7 +222,6 @@ module.exports = { /** * Retrieves an array containing all template literals in the source code. - * * @returns {ASTNode[]} An array of template literal nodes. */ function getAllTemplateLiterals() { @@ -234,7 +231,6 @@ module.exports = { /** * Retrieves an array containing all RegExp literals in the source code. - * * @returns {ASTNode[]} An array of RegExp literal nodes. */ function getAllRegExpLiterals() { @@ -244,7 +240,6 @@ module.exports = { /** * A reducer to group an AST node by line number, both start and end. - * * @param {Object} acc the accumulator * @param {ASTNode} node the AST node in question * @returns {Object} the modified accumulator diff --git a/lib/rules/max-statements-per-line.js b/lib/rules/max-statements-per-line.js index e9212001a34..5407cff3c54 100644 --- a/lib/rules/max-statements-per-line.js +++ b/lib/rules/max-statements-per-line.js @@ -61,7 +61,6 @@ module.exports = { /** * Reports with the first extra statement, and clears it. - * * @returns {void} */ function reportFirstExtraStatementAndClear() { @@ -81,8 +80,7 @@ module.exports = { /** * Gets the actual last token of a given node. - * - * @param {ASTNode} node - A node to get. This is a node except EmptyStatement. + * @param {ASTNode} node A node to get. This is a node except EmptyStatement. * @returns {Token} The actual last token. */ function getActualLastToken(node) { @@ -92,8 +90,7 @@ module.exports = { /** * Addresses a given node. * It updates the state of this rule, then reports the node if the node violated this rule. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function enterStatement(node) { @@ -127,8 +124,7 @@ module.exports = { /** * Updates the state of this rule with the end line of leaving node to check with the next statement. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function leaveStatement(node) { diff --git a/lib/rules/multiline-ternary.js b/lib/rules/multiline-ternary.js index 3b98d0b3cf1..1df90b6feb8 100644 --- a/lib/rules/multiline-ternary.js +++ b/lib/rules/multiline-ternary.js @@ -46,9 +46,9 @@ module.exports = { /** * Tests whether node is preceded by supplied tokens - * @param {ASTNode} node - node to check - * @param {ASTNode} parentNode - parent of node to report - * @param {boolean} expected - whether newline was expected or not + * @param {ASTNode} node node to check + * @param {ASTNode} parentNode parent of node to report + * @param {boolean} expected whether newline was expected or not * @returns {void} * @private */ diff --git a/lib/rules/newline-after-var.js b/lib/rules/newline-after-var.js index 8f244149c55..4809d9bfc5a 100644 --- a/lib/rules/newline-after-var.js +++ b/lib/rules/newline-after-var.js @@ -72,8 +72,7 @@ module.exports = { * var foo = 1 * * ;(a || b).doSomething() - * - * @param {ASTNode} node - The node to get. + * @param {ASTNode} node The node to get. * @returns {Token} The token to compare line to the next statement. */ function getLastToken(node) { @@ -93,7 +92,7 @@ module.exports = { /** * Determine if provided keyword is a variable declaration * @private - * @param {string} keyword - keyword to test + * @param {string} keyword keyword to test * @returns {boolean} True if `keyword` is a type of var */ function isVar(keyword) { @@ -103,7 +102,7 @@ module.exports = { /** * Determine if provided keyword is a variant of for specifiers * @private - * @param {string} keyword - keyword to test + * @param {string} keyword keyword to test * @returns {boolean} True if `keyword` is a variant of for specifier */ function isForTypeSpecifier(keyword) { @@ -113,7 +112,7 @@ module.exports = { /** * Determine if provided keyword is an export specifiers * @private - * @param {string} nodeType - nodeType to test + * @param {string} nodeType nodeType to test * @returns {boolean} True if `nodeType` is an export specifier */ function isExportSpecifier(nodeType) { @@ -124,7 +123,7 @@ module.exports = { /** * Determine if provided node is the last of their parent block. * @private - * @param {ASTNode} node - node to test + * @param {ASTNode} node node to test * @returns {boolean} True if `node` is last of their parent block. */ function isLastNode(node) { @@ -159,7 +158,7 @@ module.exports = { * set to "always", or checks that there is no blank line when mode is set * to "never" * @private - * @param {ASTNode} node - `VariableDeclaration` node to test + * @param {ASTNode} node `VariableDeclaration` node to test * @returns {void} */ function checkForBlankLine(node) { diff --git a/lib/rules/newline-before-return.js b/lib/rules/newline-before-return.js index 816ddba72b2..65ca32321cc 100644 --- a/lib/rules/newline-before-return.js +++ b/lib/rules/newline-before-return.js @@ -39,8 +39,8 @@ module.exports = { /** * Tests whether node is preceded by supplied tokens - * @param {ASTNode} node - node to check - * @param {Array} testTokens - array of tokens to test against + * @param {ASTNode} node node to check + * @param {Array} testTokens array of tokens to test against * @returns {boolean} Whether or not the node is preceded by one of the supplied tokens * @private */ @@ -52,7 +52,7 @@ module.exports = { /** * Checks whether node is the first node after statement or in block - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {boolean} Whether or not the node is the first node after statement or in block * @private */ @@ -80,8 +80,8 @@ module.exports = { /** * Returns the number of lines of comments that precede the node - * @param {ASTNode} node - node to check for overlapping comments - * @param {number} lineNumTokenBefore - line number of previous token, to check for overlapping comments + * @param {ASTNode} node node to check for overlapping comments + * @param {number} lineNumTokenBefore line number of previous token, to check for overlapping comments * @returns {number} Number of lines of comments that precede the node * @private */ @@ -115,7 +115,7 @@ module.exports = { /** * Returns the line number of the token before the node that is passed in as an argument - * @param {ASTNode} node - The node to use as the start of the calculation + * @param {ASTNode} node The node to use as the start of the calculation * @returns {number} Line number of the token before `node` * @private */ @@ -142,7 +142,7 @@ module.exports = { /** * Checks whether node is preceded by a newline - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {boolean} Whether or not the node is preceded by a newline * @private */ @@ -160,8 +160,7 @@ module.exports = { * The fix is not considered safe if the given return statement has leading comments, * as we cannot safely determine if the newline should be added before or after the comments. * For more information, see: https://github.com/eslint/eslint/issues/5958#issuecomment-222767211 - * - * @param {ASTNode} node - The return statement node to check. + * @param {ASTNode} node The return statement node to check. * @returns {boolean} `true` if it can fix the node. * @private */ diff --git a/lib/rules/newline-per-chained-call.js b/lib/rules/newline-per-chained-call.js index 4aee76da108..8ad88386c0f 100644 --- a/lib/rules/newline-per-chained-call.js +++ b/lib/rules/newline-per-chained-call.js @@ -53,8 +53,7 @@ module.exports = { * Get the prefix of a given MemberExpression node. * If the MemberExpression node is a computed value it returns a * left bracket. If not it returns a period. - * - * @param {ASTNode} node - A MemberExpression node to get + * @param {ASTNode} node A MemberExpression node to get * @returns {string} The prefix of the node. */ function getPrefix(node) { @@ -64,8 +63,7 @@ module.exports = { /** * Gets the property text of a given MemberExpression node. * If the text is multiline, this returns only the first line. - * - * @param {ASTNode} node - A MemberExpression node to get. + * @param {ASTNode} node A MemberExpression node to get. * @returns {string} The property text of the node. */ function getPropertyText(node) { diff --git a/lib/rules/no-class-assign.js b/lib/rules/no-class-assign.js index 986bdd7c1c3..887058ba0f9 100644 --- a/lib/rules/no-class-assign.js +++ b/lib/rules/no-class-assign.js @@ -33,7 +33,7 @@ module.exports = { /** * Finds and reports references that are non initializer and writable. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { @@ -45,7 +45,7 @@ module.exports = { /** * Finds and reports references that are non initializer and writable. - * @param {ASTNode} node - A ClassDeclaration/ClassExpression node to check. + * @param {ASTNode} node A ClassDeclaration/ClassExpression node to check. * @returns {void} */ function checkForClass(node) { diff --git a/lib/rules/no-compare-neg-zero.js b/lib/rules/no-compare-neg-zero.js index f5c8d5f417b..0c6865ad59e 100644 --- a/lib/rules/no-compare-neg-zero.js +++ b/lib/rules/no-compare-neg-zero.js @@ -35,8 +35,7 @@ module.exports = { /** * Checks a given node is -0 - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is -0. */ function isNegZero(node) { diff --git a/lib/rules/no-confusing-arrow.js b/lib/rules/no-confusing-arrow.js index 895b9499dde..b9a0e6ed0a7 100644 --- a/lib/rules/no-confusing-arrow.js +++ b/lib/rules/no-confusing-arrow.js @@ -14,7 +14,7 @@ const astUtils = require("./utils/ast-utils.js"); /** * Checks whether or not a node is a conditional expression. - * @param {ASTNode} node - node to test + * @param {ASTNode} node node to test * @returns {boolean} `true` if the node is a conditional expression. */ function isConditional(node) { @@ -59,7 +59,7 @@ module.exports = { /** * Reports if an arrow function contains an ambiguous conditional. - * @param {ASTNode} node - A node to check and report. + * @param {ASTNode} node A node to check and report. * @returns {void} */ function checkArrowFunc(node) { diff --git a/lib/rules/no-console.js b/lib/rules/no-console.js index e4b5ce1ea44..56dbbc3a9fd 100644 --- a/lib/rules/no-console.js +++ b/lib/rules/no-console.js @@ -54,8 +54,7 @@ module.exports = { /** * Checks whether the given reference is 'console' or not. - * - * @param {eslint-scope.Reference} reference - The reference to check. + * @param {eslint-scope.Reference} reference The reference to check. * @returns {boolean} `true` if the reference is 'console'. */ function isConsole(reference) { @@ -67,8 +66,7 @@ module.exports = { /** * Checks whether the property name of the given MemberExpression node * is allowed by options or not. - * - * @param {ASTNode} node - The MemberExpression node to check. + * @param {ASTNode} node The MemberExpression node to check. * @returns {boolean} `true` if the property name of the node is allowed. */ function isAllowed(node) { @@ -80,8 +78,7 @@ module.exports = { /** * Checks whether the given reference is a member access which is not * allowed by options or not. - * - * @param {eslint-scope.Reference} reference - The reference to check. + * @param {eslint-scope.Reference} reference The reference to check. * @returns {boolean} `true` if the reference is a member access which * is not allowed by options. */ @@ -98,8 +95,7 @@ module.exports = { /** * Reports the given reference as a violation. - * - * @param {eslint-scope.Reference} reference - The reference to report. + * @param {eslint-scope.Reference} reference The reference to report. * @returns {void} */ function report(reference) { diff --git a/lib/rules/no-const-assign.js b/lib/rules/no-const-assign.js index 9f4c91fa305..e4ae891705f 100644 --- a/lib/rules/no-const-assign.js +++ b/lib/rules/no-const-assign.js @@ -33,7 +33,7 @@ module.exports = { /** * Finds and reports references that are non initializer and writable. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { diff --git a/lib/rules/no-dupe-args.js b/lib/rules/no-dupe-args.js index 4e42336ae3d..817277f522e 100644 --- a/lib/rules/no-dupe-args.js +++ b/lib/rules/no-dupe-args.js @@ -35,7 +35,7 @@ module.exports = { /** * Checks whether or not a given definition is a parameter's. - * @param {eslint-scope.DefEntry} def - A definition to check. + * @param {eslint-scope.DefEntry} def A definition to check. * @returns {boolean} `true` if the definition is a parameter's. */ function isParameter(def) { diff --git a/lib/rules/no-dupe-class-members.js b/lib/rules/no-dupe-class-members.js index 97f63a28962..6041e9e371c 100644 --- a/lib/rules/no-dupe-class-members.js +++ b/lib/rules/no-dupe-class-members.js @@ -32,8 +32,8 @@ module.exports = { /** * Gets state of a given member name. - * @param {string} name - A name of a member. - * @param {boolean} isStatic - A flag which specifies that is a static member. + * @param {string} name A name of a member. + * @param {boolean} isStatic A flag which specifies that is a static member. * @returns {Object} A state of a given member name. * - retv.init {boolean} A flag which shows the name is declared as normal member. * - retv.get {boolean} A flag which shows the name is declared as getter. @@ -55,8 +55,7 @@ module.exports = { /** * Gets the name text of a given node. - * - * @param {ASTNode} node - A node to get the name. + * @param {ASTNode} node A node to get the name. * @returns {string} The name text of the node. */ function getName(node) { diff --git a/lib/rules/no-dupe-keys.js b/lib/rules/no-dupe-keys.js index 1b7f69cfaca..cfddde47666 100644 --- a/lib/rules/no-dupe-keys.js +++ b/lib/rules/no-dupe-keys.js @@ -24,8 +24,8 @@ const SET_KIND = /^(?:init|set)$/u; class ObjectInfo { /** - * @param {ObjectInfo|null} upper - The information of the outer object. - * @param {ASTNode} node - The ObjectExpression node of this information. + * @param {ObjectInfo|null} upper The information of the outer object. + * @param {ASTNode} node The ObjectExpression node of this information. */ constructor(upper, node) { this.upper = upper; @@ -35,7 +35,7 @@ class ObjectInfo { /** * Gets the information of the given Property node. - * @param {ASTNode} node - The Property node to get. + * @param {ASTNode} node The Property node to get. * @returns {{get: boolean, set: boolean}} The information of the property. */ getPropertyInfo(node) { @@ -49,7 +49,7 @@ class ObjectInfo { /** * Checks whether the given property has been defined already or not. - * @param {ASTNode} node - The Property node to check. + * @param {ASTNode} node The Property node to check. * @returns {boolean} `true` if the property has been defined. */ isPropertyDefined(node) { @@ -63,7 +63,7 @@ class ObjectInfo { /** * Defines the given property. - * @param {ASTNode} node - The Property node to define. + * @param {ASTNode} node The Property node to define. * @returns {void} */ defineProperty(node) { diff --git a/lib/rules/no-duplicate-imports.js b/lib/rules/no-duplicate-imports.js index 03b5e2c1239..7218dc64add 100644 --- a/lib/rules/no-duplicate-imports.js +++ b/lib/rules/no-duplicate-imports.js @@ -10,8 +10,7 @@ /** * Returns the name of the module imported or re-exported. - * - * @param {ASTNode} node - A node to get. + * @param {ASTNode} node A node to get. * @returns {string} the name of the module, or empty string if no name. */ function getValue(node) { @@ -24,12 +23,11 @@ function getValue(node) { /** * Checks if the name of the import or export exists in the given array, and reports if so. - * - * @param {RuleContext} context - The ESLint rule context object. - * @param {ASTNode} node - A node to get. - * @param {string} value - The name of the imported or exported module. - * @param {string[]} array - The array containing other imports or exports in the file. - * @param {string} messageId - A messageId to be reported after the name of the module + * @param {RuleContext} context The ESLint rule context object. + * @param {ASTNode} node A node to get. + * @param {string} value The name of the imported or exported module. + * @param {string[]} array The array containing other imports or exports in the file. + * @param {string} messageId A messageId to be reported after the name of the module * * @returns {void} No return value */ @@ -47,16 +45,15 @@ function checkAndReport(context, node, value, array, messageId) { /** * @callback nodeCallback - * @param {ASTNode} node - A node to handle. + * @param {ASTNode} node A node to handle. */ /** * Returns a function handling the imports of a given file - * - * @param {RuleContext} context - The ESLint rule context object. - * @param {boolean} includeExports - Whether or not to check for exports in addition to imports. - * @param {string[]} importsInFile - The array containing other imports in the file. - * @param {string[]} exportsInFile - The array containing other exports in the file. + * @param {RuleContext} context The ESLint rule context object. + * @param {boolean} includeExports Whether or not to check for exports in addition to imports. + * @param {string[]} importsInFile The array containing other imports in the file. + * @param {string[]} exportsInFile The array containing other exports in the file. * * @returns {nodeCallback} A function passed to ESLint to handle the statement. */ @@ -78,10 +75,9 @@ function handleImports(context, includeExports, importsInFile, exportsInFile) { /** * Returns a function handling the exports of a given file - * - * @param {RuleContext} context - The ESLint rule context object. - * @param {string[]} importsInFile - The array containing other imports in the file. - * @param {string[]} exportsInFile - The array containing other exports in the file. + * @param {RuleContext} context The ESLint rule context object. + * @param {string[]} importsInFile The array containing other imports in the file. + * @param {string[]} exportsInFile The array containing other exports in the file. * * @returns {nodeCallback} A function passed to ESLint to handle the statement. */ diff --git a/lib/rules/no-else-return.js b/lib/rules/no-else-return.js index c63af2be523..84409fac87c 100644 --- a/lib/rules/no-else-return.js +++ b/lib/rules/no-else-return.js @@ -58,7 +58,6 @@ module.exports = { * * This is not a generic function. In particular, it is assumed that the scope is a function scope or * a function's inner scope, and that the names can be valid identifiers in the given scope. - * * @param {string[]} names Array of variable names. * @param {eslint-scope.Scope} scope Function scope or a function's inner scope. * @returns {boolean} True if all names can be safely declared, false otherwise. @@ -134,7 +133,6 @@ module.exports = { /** * Checks whether the removal of `else` and its braces is safe from variable name collisions. - * * @param {Node} node The 'else' node. * @param {eslint-scope.Scope} scope The scope in which the node and the whole 'if' statement is. * @returns {boolean} True if it is safe, false otherwise. @@ -171,7 +169,6 @@ module.exports = { /** * Display the context report if rule is violated - * * @param {Node} node The 'else' node * @returns {void} */ @@ -255,7 +252,6 @@ module.exports = { /** * Check to see if the node is a ReturnStatement - * * @param {Node} node The node being evaluated * @returns {boolean} True if node is a return */ @@ -267,7 +263,6 @@ module.exports = { * Naive return checking, does not iterate through the whole * BlockStatement because we make the assumption that the ReturnStatement * will be the last node in the body of the BlockStatement. - * * @param {Node} node The consequent/alternate node * @returns {boolean} True if it has a return */ @@ -284,7 +279,6 @@ module.exports = { /** * Check to see if the node is valid for evaluation, * meaning it has an else. - * * @param {Node} node The node being evaluated * @returns {boolean} True if the node is valid */ @@ -296,7 +290,6 @@ module.exports = { * If the consequent is an IfStatement, check to see if it has an else * and both its consequent and alternate path return, meaning this is * a nested case of rule violation. If-Else not considered currently. - * * @param {Node} node The consequent node * @returns {boolean} True if this is a nested rule violation */ @@ -309,7 +302,6 @@ module.exports = { * Check the consequent/body node to make sure it is not * a ReturnStatement or an IfStatement that returns on both * code paths. - * * @param {Node} node The consequent or body node * @returns {boolean} `true` if it is a Return/If node that always returns. */ diff --git a/lib/rules/no-empty-function.js b/lib/rules/no-empty-function.js index 149b1477dc1..c57e66fd534 100644 --- a/lib/rules/no-empty-function.js +++ b/lib/rules/no-empty-function.js @@ -28,8 +28,7 @@ const ALLOW_OPTIONS = Object.freeze([ /** * Gets the kind of a given function node. - * - * @param {ASTNode} node - A function node to get. This is one of + * @param {ASTNode} node A function node to get. This is one of * an ArrowFunctionExpression, a FunctionDeclaration, or a * FunctionExpression. * @returns {string} The kind of the function. This is one of "functions", @@ -130,8 +129,7 @@ module.exports = { * - Not allowed by options. * - The body is empty. * - The body doesn't have any comments. - * - * @param {ASTNode} node - A function node to report. This is one of + * @param {ASTNode} node A function node to report. This is one of * an ArrowFunctionExpression, a FunctionDeclaration, or a * FunctionExpression. * @returns {void} diff --git a/lib/rules/no-eval.js b/lib/rules/no-eval.js index d580f369259..9e56fb00b9f 100644 --- a/lib/rules/no-eval.js +++ b/lib/rules/no-eval.js @@ -22,9 +22,8 @@ const candidatesOfGlobalObject = Object.freeze([ /** * Checks a given node is a Identifier node of the specified name. - * - * @param {ASTNode} node - A node to check. - * @param {string} name - A name to check. + * @param {ASTNode} node A node to check. + * @param {string} name A name to check. * @returns {boolean} `true` if the node is a Identifier node of the name. */ function isIdentifier(node, name) { @@ -33,9 +32,8 @@ function isIdentifier(node, name) { /** * Checks a given node is a Literal node of the specified string value. - * - * @param {ASTNode} node - A node to check. - * @param {string} name - A name to check. + * @param {ASTNode} node A node to check. + * @param {string} name A name to check. * @returns {boolean} `true` if the node is a Literal node of the name. */ function isConstant(node, name) { @@ -57,9 +55,8 @@ function isConstant(node, name) { /** * Checks a given node is a MemberExpression node which has the specified name's * property. - * - * @param {ASTNode} node - A node to check. - * @param {string} name - A name to check. + * @param {ASTNode} node A node to check. + * @param {string} name A name to check. * @returns {boolean} `true` if the node is a MemberExpression node which has * the specified name's property */ @@ -113,8 +110,7 @@ module.exports = { * * This is used in order to check whether or not `this` binding is a * reference to the global object. - * - * @param {ASTNode} node - A node of the scope. This is one of Program, + * @param {ASTNode} node A node of the scope. This is one of Program, * FunctionDeclaration, FunctionExpression, and ArrowFunctionExpression. * @returns {void} */ @@ -132,7 +128,6 @@ module.exports = { /** * Pops a variable scope from the stack. - * * @returns {void} */ function exitVarScope() { @@ -148,8 +143,7 @@ module.exports = { * The location of the report is always `eval` `Identifier` (or possibly * `Literal`). The type of the report is `CallExpression` if the parent is * `CallExpression`. Otherwise, it's the given node type. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function report(node) { @@ -171,8 +165,7 @@ module.exports = { /** * Reports accesses of `eval` via the global object. - * - * @param {eslint-scope.Scope} globalScope - The global scope. + * @param {eslint-scope.Scope} globalScope The global scope. * @returns {void} */ function reportAccessingEvalViaGlobalObject(globalScope) { @@ -205,8 +198,7 @@ module.exports = { /** * Reports all accesses of `eval` (excludes direct calls to eval). - * - * @param {eslint-scope.Scope} globalScope - The global scope. + * @param {eslint-scope.Scope} globalScope The global scope. * @returns {void} */ function reportAccessingEval(globalScope) { diff --git a/lib/rules/no-ex-assign.js b/lib/rules/no-ex-assign.js index 21d3220799b..1163920361d 100644 --- a/lib/rules/no-ex-assign.js +++ b/lib/rules/no-ex-assign.js @@ -33,7 +33,7 @@ module.exports = { /** * Finds and reports references that are non initializer and writable. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { diff --git a/lib/rules/no-extra-bind.js b/lib/rules/no-extra-bind.js index cc5611b1089..d938c0f51b0 100644 --- a/lib/rules/no-extra-bind.js +++ b/lib/rules/no-extra-bind.js @@ -47,7 +47,6 @@ module.exports = { * Checks if a node is free of side effects. * * This check is stricter than it needs to be, in order to keep the implementation simple. - * * @param {ASTNode} node A node to check. * @returns {boolean} True if the node is known to be side-effect free, false otherwise. */ @@ -57,8 +56,7 @@ module.exports = { /** * Reports a given function node. - * - * @param {ASTNode} node - A node to report. This is a FunctionExpression or + * @param {ASTNode} node A node to report. This is a FunctionExpression or * an ArrowFunctionExpression. * @returns {void} */ @@ -90,8 +88,7 @@ module.exports = { * method. * * e.g. `(function() {}.bind(foo))` - * - * @param {ASTNode} node - A node to report. This is a FunctionExpression or + * @param {ASTNode} node A node to report. This is a FunctionExpression or * an ArrowFunctionExpression. * @returns {boolean} `true` if the node is the callee of `.bind()` method. */ @@ -113,8 +110,7 @@ module.exports = { /** * Adds a scope information object to the stack. - * - * @param {ASTNode} node - A node to add. This node is a FunctionExpression + * @param {ASTNode} node A node to add. This node is a FunctionExpression * or a FunctionDeclaration node. * @returns {void} */ @@ -130,8 +126,7 @@ module.exports = { * Removes the scope information object from the top of the stack. * At the same time, this reports the function node if the function has * `.bind()` and the `this` keywords found. - * - * @param {ASTNode} node - A node to remove. This node is a + * @param {ASTNode} node A node to remove. This node is a * FunctionExpression or a FunctionDeclaration node. * @returns {void} */ @@ -146,8 +141,7 @@ module.exports = { /** * Reports a given arrow function if the function is callee of `.bind()` * method. - * - * @param {ASTNode} node - A node to report. This node is an + * @param {ASTNode} node A node to report. This node is an * ArrowFunctionExpression. * @returns {void} */ @@ -159,7 +153,6 @@ module.exports = { /** * Set the mark as the `this` keyword was found in this scope. - * * @returns {void} */ function markAsThisFound() { diff --git a/lib/rules/no-extra-boolean-cast.js b/lib/rules/no-extra-boolean-cast.js index e818cd448c4..336f601d165 100644 --- a/lib/rules/no-extra-boolean-cast.js +++ b/lib/rules/no-extra-boolean-cast.js @@ -49,7 +49,6 @@ module.exports = { /** * Check if a node is in a context where its value would be coerced to a boolean at runtime. - * * @param {ASTNode} node The node * @param {ASTNode} parent Its parent * @returns {boolean} If it is in a boolean context @@ -67,7 +66,6 @@ module.exports = { /** * Check if a node has comments inside. - * * @param {ASTNode} node The node to check. * @returns {boolean} `true` if it has comments inside. */ diff --git a/lib/rules/no-extra-label.js b/lib/rules/no-extra-label.js index 48add937e6e..81406e76095 100644 --- a/lib/rules/no-extra-label.js +++ b/lib/rules/no-extra-label.js @@ -40,8 +40,7 @@ module.exports = { /** * Creates a new scope with a breakable statement. - * - * @param {ASTNode} node - A node to create. This is a BreakableStatement. + * @param {ASTNode} node A node to create. This is a BreakableStatement. * @returns {void} */ function enterBreakableStatement(node) { @@ -54,7 +53,6 @@ module.exports = { /** * Removes the top scope of the stack. - * * @returns {void} */ function exitBreakableStatement() { @@ -66,8 +64,7 @@ module.exports = { * * This ignores it if the body is a breakable statement. * In this case it's handled in the `enterBreakableStatement` function. - * - * @param {ASTNode} node - A node to create. This is a LabeledStatement. + * @param {ASTNode} node A node to create. This is a LabeledStatement. * @returns {void} */ function enterLabeledStatement(node) { @@ -85,8 +82,7 @@ module.exports = { * * This ignores it if the body is a breakable statement. * In this case it's handled in the `exitBreakableStatement` function. - * - * @param {ASTNode} node - A node. This is a LabeledStatement. + * @param {ASTNode} node A node. This is a LabeledStatement. * @returns {void} */ function exitLabeledStatement(node) { @@ -97,8 +93,7 @@ module.exports = { /** * Reports a given control node if it's unnecessary. - * - * @param {ASTNode} node - A node. This is a BreakStatement or a + * @param {ASTNode} node A node. This is a BreakStatement or a * ContinueStatement. * @returns {void} */ diff --git a/lib/rules/no-extra-parens.js b/lib/rules/no-extra-parens.js index c6809c355bc..677cde56b8f 100644 --- a/lib/rules/no-extra-parens.js +++ b/lib/rules/no-extra-parens.js @@ -88,7 +88,7 @@ module.exports = { /** * Determines if this rule should be enforced for a node given the current configuration. - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the rule should be enforced for this node. * @private */ @@ -127,7 +127,7 @@ module.exports = { /** * Determines if a node is surrounded by parentheses. - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is parenthesised. * @private */ @@ -137,7 +137,7 @@ module.exports = { /** * Determines if a node is surrounded by parentheses twice. - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is doubly parenthesised. * @private */ @@ -147,7 +147,7 @@ module.exports = { /** * Determines if a node is surrounded by (potentially) invalid parentheses. - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is incorrectly parenthesised. * @private */ @@ -158,7 +158,7 @@ module.exports = { /** * Determines if a node that is expected to be parenthesised is surrounded by * (potentially) invalid extra parentheses. - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is has an unexpected extra pair of parentheses. * @private */ @@ -168,7 +168,7 @@ module.exports = { /** * Determines if a node test expression is allowed to have a parenthesised assignment - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the assignment can be parenthesised. * @private */ @@ -178,7 +178,7 @@ module.exports = { /** * Determines if a node is in a return statement - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is in a return statement. * @private */ @@ -197,7 +197,7 @@ module.exports = { /** * Determines if a constructor function is newed-up with parens - * @param {ASTNode} newExpression - The NewExpression node to be checked. + * @param {ASTNode} newExpression The NewExpression node to be checked. * @returns {boolean} True if the constructor is called with parens. * @private */ @@ -217,7 +217,7 @@ module.exports = { /** * Determines if a node is or contains an assignment expression - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is or contains an assignment expression. * @private */ @@ -239,7 +239,7 @@ module.exports = { /** * Determines if a node is contained by or is itself a return statement and is allowed to have a parenthesised assignment - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the assignment can be parenthesised. * @private */ @@ -261,8 +261,8 @@ module.exports = { /** * Determines if a node following a [no LineTerminator here] restriction is * surrounded by (potentially) invalid extra parentheses. - * @param {Token} token - The token preceding the [no LineTerminator here] restriction. - * @param {ASTNode} node - The node to be checked. + * @param {Token} token The token preceding the [no LineTerminator here] restriction. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is incorrectly parenthesised. * @private */ @@ -567,7 +567,6 @@ module.exports = { /** * Checks whether the syntax of the given ancestor of an 'in' expression inside a for-loop initializer * is preventing the 'in' keyword from being interpreted as a part of an ill-formed for-in loop. - * * @param {ASTNode} node Ancestor of an 'in' expression. * @param {ASTNode} child Child of the node, ancestor of the same 'in' expression or the 'in' expression itself. * @returns {boolean} True if the keyword 'in' would be interpreted as the 'in' operator, without any parenthesis. @@ -599,7 +598,6 @@ module.exports = { /** * Starts a new reports buffering. Warnings will be stored in a buffer instead of being reported immediately. * An additional logic that requires multiple nodes (e.g. a whole subtree) may dismiss some of the stored warnings. - * * @returns {void} */ function startNewReportsBuffering() { diff --git a/lib/rules/no-extra-semi.js b/lib/rules/no-extra-semi.js index e99dd67b35b..e0a8df0565a 100644 --- a/lib/rules/no-extra-semi.js +++ b/lib/rules/no-extra-semi.js @@ -40,7 +40,7 @@ module.exports = { /** * Reports an unnecessary semicolon error. - * @param {Node|Token} nodeOrToken - A node or a token to be reported. + * @param {Node|Token} nodeOrToken A node or a token to be reported. * @returns {void} */ function report(nodeOrToken) { @@ -64,8 +64,7 @@ module.exports = { /** * Checks for a part of a class body. * This checks tokens from a specified token to a next MethodDefinition or the end of class body. - * - * @param {Token} firstToken - The first token to check. + * @param {Token} firstToken The first token to check. * @returns {void} */ function checkForPartOfClassBody(firstToken) { @@ -83,7 +82,7 @@ module.exports = { /** * Reports this empty statement, except if the parent node is a loop. - * @param {Node} node - A EmptyStatement node to be reported. + * @param {Node} node A EmptyStatement node to be reported. * @returns {void} */ EmptyStatement(node) { @@ -106,7 +105,7 @@ module.exports = { /** * Checks tokens from the head of this class body to the first MethodDefinition or the end of this class body. - * @param {Node} node - A ClassBody node to check. + * @param {Node} node A ClassBody node to check. * @returns {void} */ ClassBody(node) { @@ -115,7 +114,7 @@ module.exports = { /** * Checks tokens from this MethodDefinition to the next MethodDefinition or the end of this class body. - * @param {Node} node - A MethodDefinition node of the start point. + * @param {Node} node A MethodDefinition node of the start point. * @returns {void} */ MethodDefinition(node) { diff --git a/lib/rules/no-fallthrough.js b/lib/rules/no-fallthrough.js index c6a71b6c8c6..dd1f3ed9d9a 100644 --- a/lib/rules/no-fallthrough.js +++ b/lib/rules/no-fallthrough.js @@ -18,9 +18,9 @@ const DEFAULT_FALLTHROUGH_COMMENT = /falls?\s?through/iu; /** * Checks whether or not a given node has a fallthrough comment. - * @param {ASTNode} node - A SwitchCase node to get comments. - * @param {RuleContext} context - A rule context which stores comments. - * @param {RegExp} fallthroughCommentPattern - A pattern to match comment to. + * @param {ASTNode} node A SwitchCase node to get comments. + * @param {RuleContext} context A rule context which stores comments. + * @param {RegExp} fallthroughCommentPattern A pattern to match comment to. * @returns {boolean} `true` if the node has a valid fallthrough comment. */ function hasFallthroughComment(node, context, fallthroughCommentPattern) { @@ -32,7 +32,7 @@ function hasFallthroughComment(node, context, fallthroughCommentPattern) { /** * Checks whether or not a given code path segment is reachable. - * @param {CodePathSegment} segment - A CodePathSegment to check. + * @param {CodePathSegment} segment A CodePathSegment to check. * @returns {boolean} `true` if the segment is reachable. */ function isReachable(segment) { @@ -41,8 +41,8 @@ function isReachable(segment) { /** * Checks whether a node and a token are separated by blank lines - * @param {ASTNode} node - The node to check - * @param {Token} token - The token to compare against + * @param {ASTNode} node The node to check + * @param {Token} token The token to compare against * @returns {boolean} `true` if there are blank lines between node and token */ function hasBlankLinesBetween(node, token) { diff --git a/lib/rules/no-func-assign.js b/lib/rules/no-func-assign.js index d2b4109fa33..66756e62bef 100644 --- a/lib/rules/no-func-assign.js +++ b/lib/rules/no-func-assign.js @@ -29,7 +29,7 @@ module.exports = { /** * Reports a reference if is non initializer and writable. - * @param {References} references - Collection of reference to check. + * @param {References} references Collection of reference to check. * @returns {void} */ function checkReference(references) { @@ -40,7 +40,7 @@ module.exports = { /** * Finds and reports references that are non initializer and writable. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { @@ -51,7 +51,7 @@ module.exports = { /** * Checks parameters of a given function node. - * @param {ASTNode} node - A function node to check. + * @param {ASTNode} node A function node to check. * @returns {void} */ function checkForFunction(node) { diff --git a/lib/rules/no-global-assign.js b/lib/rules/no-global-assign.js index 73f36b25e47..4ab0c706446 100644 --- a/lib/rules/no-global-assign.js +++ b/lib/rules/no-global-assign.js @@ -41,9 +41,9 @@ module.exports = { /** * Reports write references. - * @param {Reference} reference - A reference to check. - * @param {int} index - The index of the reference in the references. - * @param {Reference[]} references - The array that the reference belongs to. + * @param {Reference} reference A reference to check. + * @param {int} index The index of the reference in the references. + * @param {Reference[]} references The array that the reference belongs to. * @returns {void} */ function checkReference(reference, index, references) { @@ -68,7 +68,7 @@ module.exports = { /** * Reports write references if a given variable is read-only builtin. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { diff --git a/lib/rules/no-implicit-coercion.js b/lib/rules/no-implicit-coercion.js index 7d463ac2bdc..c80f9813020 100644 --- a/lib/rules/no-implicit-coercion.js +++ b/lib/rules/no-implicit-coercion.js @@ -16,7 +16,7 @@ const ALLOWABLE_OPERATORS = ["~", "!!", "+", "*"]; /** * Parses and normalizes an option object. - * @param {Object} options - An option object to parse. + * @param {Object} options An option object to parse. * @returns {Object} The parsed and normalized option object. */ function parseOptions(options) { @@ -30,7 +30,7 @@ function parseOptions(options) { /** * Checks whether or not a node is a double logical nigating. - * @param {ASTNode} node - An UnaryExpression node to check. + * @param {ASTNode} node An UnaryExpression node to check. * @returns {boolean} Whether or not the node is a double logical nigating. */ function isDoubleLogicalNegating(node) { @@ -43,7 +43,7 @@ function isDoubleLogicalNegating(node) { /** * Checks whether or not a node is a binary negating of `.indexOf()` method calling. - * @param {ASTNode} node - An UnaryExpression node to check. + * @param {ASTNode} node An UnaryExpression node to check. * @returns {boolean} Whether or not the node is a binary negating of `.indexOf()` method calling. */ function isBinaryNegatingOfIndexOf(node) { @@ -58,7 +58,7 @@ function isBinaryNegatingOfIndexOf(node) { /** * Checks whether or not a node is a multiplying by one. - * @param {BinaryExpression} node - A BinaryExpression node to check. + * @param {BinaryExpression} node A BinaryExpression node to check. * @returns {boolean} Whether or not the node is a multiplying by one. */ function isMultiplyByOne(node) { @@ -118,7 +118,7 @@ function isEmptyString(node) { /** * Checks whether or not a node is a concatenating with an empty string. - * @param {ASTNode} node - A BinaryExpression node to check. + * @param {ASTNode} node A BinaryExpression node to check. * @returns {boolean} Whether or not the node is a concatenating with an empty string. */ function isConcatWithEmptyString(node) { @@ -130,7 +130,7 @@ function isConcatWithEmptyString(node) { /** * Checks whether or not a node is appended with an empty string. - * @param {ASTNode} node - An AssignmentExpression node to check. + * @param {ASTNode} node An AssignmentExpression node to check. * @returns {boolean} Whether or not the node is appended with an empty string. */ function isAppendEmptyString(node) { @@ -139,7 +139,7 @@ function isAppendEmptyString(node) { /** * Returns the operand that is not an empty string from a flagged BinaryExpression. - * @param {ASTNode} node - The flagged BinaryExpression node to check. + * @param {ASTNode} node The flagged BinaryExpression node to check. * @returns {ASTNode} The operand that is not an empty string from a flagged BinaryExpression. */ function getNonEmptyOperand(node) { @@ -196,9 +196,9 @@ module.exports = { /** * Reports an error and autofixes the node - * @param {ASTNode} node - An ast node to report the error on. - * @param {string} recommendation - The recommended code for the issue - * @param {bool} shouldFix - Whether this report should fix the node + * @param {ASTNode} node An ast node to report the error on. + * @param {string} recommendation The recommended code for the issue + * @param {bool} shouldFix Whether this report should fix the node * @returns {void} */ function report(node, recommendation, shouldFix) { diff --git a/lib/rules/no-implied-eval.js b/lib/rules/no-implied-eval.js index f2f6f9cea4f..e0764d8223d 100644 --- a/lib/rules/no-implied-eval.js +++ b/lib/rules/no-implied-eval.js @@ -64,7 +64,6 @@ module.exports = { * Determines if a node represents a call to a potentially implied eval. * * This checks the callee name and that there's an argument, but not the type of the argument. - * * @param {ASTNode} node The CallExpression to check. * @returns {boolean} True if the node matches, false if not. * @private diff --git a/lib/rules/no-invalid-this.js b/lib/rules/no-invalid-this.js index 30ae3fdc31a..b1dddd9319c 100644 --- a/lib/rules/no-invalid-this.js +++ b/lib/rules/no-invalid-this.js @@ -38,7 +38,6 @@ module.exports = { * * The return value has a flag that whether or not `this` keyword is valid. * The flag is initialized when got at the first time. - * * @returns {{valid: boolean}} * an object which has a flag that whether or not `this` keyword is valid. */ @@ -61,8 +60,7 @@ module.exports = { * The checking context is not initialized yet. * Because most functions don't have `this` keyword. * When `this` keyword was found, the checking context is initialized. - * - * @param {ASTNode} node - A function node that was entered. + * @param {ASTNode} node A function node that was entered. * @returns {void} */ function enterFunction(node) { diff --git a/lib/rules/no-labels.js b/lib/rules/no-labels.js index 8168dc06c17..52f4b0f5168 100644 --- a/lib/rules/no-labels.js +++ b/lib/rules/no-labels.js @@ -51,8 +51,7 @@ module.exports = { /** * Gets the kind of a given node. - * - * @param {ASTNode} node - A node to get. + * @param {ASTNode} node A node to get. * @returns {string} The kind of the node. */ function getBodyKind(node) { @@ -67,8 +66,7 @@ module.exports = { /** * Checks whether the label of a given kind is allowed or not. - * - * @param {string} kind - A kind to check. + * @param {string} kind A kind to check. * @returns {boolean} `true` if the kind is allowed. */ function isAllowed(kind) { @@ -81,8 +79,7 @@ module.exports = { /** * Checks whether a given name is a label of a loop or not. - * - * @param {string} label - A name of a label to check. + * @param {string} label A name of a label to check. * @returns {boolean} `true` if the name is a label of a loop. */ function getKind(label) { diff --git a/lib/rules/no-lone-blocks.js b/lib/rules/no-lone-blocks.js index 4365b047861..37561b0f9a3 100644 --- a/lib/rules/no-lone-blocks.js +++ b/lib/rules/no-lone-blocks.js @@ -31,7 +31,7 @@ module.exports = { /** * Reports a node as invalid. - * @param {ASTNode} node - The node to be reported. + * @param {ASTNode} node The node to be reported. * @returns {void} */ function report(node) { diff --git a/lib/rules/no-loop-func.js b/lib/rules/no-loop-func.js index f4531f3a7da..13ebd3ee22b 100644 --- a/lib/rules/no-loop-func.js +++ b/lib/rules/no-loop-func.js @@ -14,8 +14,7 @@ * * We don't need to check nested functions, so this ignores those. * `Scope.through` contains references of nested functions. - * - * @param {ASTNode} node - An AST node to get. + * @param {ASTNode} node An AST node to get. * @returns {ASTNode|null} The containing loop node of the specified node, or * `null`. */ @@ -63,9 +62,8 @@ function getContainingLoopNode(node) { /** * Gets the containing loop node of a given node. * If the loop was nested, this returns the most outer loop. - * - * @param {ASTNode} node - A node to get. This is a loop node. - * @param {ASTNode|null} excludedNode - A node that the result node should not + * @param {ASTNode} node A node to get. This is a loop node. + * @param {ASTNode|null} excludedNode A node that the result node should not * include. * @returns {ASTNode} The most outer loop node. */ @@ -85,9 +83,8 @@ function getTopLoopNode(node, excludedNode) { /** * Checks whether a given reference which refers to an upper scope's variable is * safe or not. - * - * @param {ASTNode} loopNode - A containing loop node. - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {ASTNode} loopNode A containing loop node. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the reference is safe or not. */ function isSafe(loopNode, reference) { @@ -131,8 +128,7 @@ function isSafe(loopNode, reference) { * It's safeafe if the reference matches one of the following condition. * - is readonly. * - doesn't exist inside a local function and after the border. - * - * @param {eslint-scope.Reference} upperRef - A reference to check. + * @param {eslint-scope.Reference} upperRef A reference to check. * @returns {boolean} `true` if the reference is safe. */ function isSafeReference(upperRef) { @@ -177,7 +173,6 @@ module.exports = { * * - has a loop node in ancestors. * - has any references which refers to an unsafe variable. - * * @param {ASTNode} node The AST node to check. * @returns {boolean} Whether or not the node is within a loop. */ diff --git a/lib/rules/no-magic-numbers.js b/lib/rules/no-magic-numbers.js index 2c6ea61e283..0909e3166d9 100644 --- a/lib/rules/no-magic-numbers.js +++ b/lib/rules/no-magic-numbers.js @@ -61,7 +61,7 @@ module.exports = { /** * Returns whether the node is number literal - * @param {Node} node - the node literal being evaluated + * @param {Node} node the node literal being evaluated * @returns {boolean} true if the node is a number literal */ function isNumber(node) { @@ -70,7 +70,7 @@ module.exports = { /** * Returns whether the number should be ignored - * @param {number} num - the number + * @param {number} num the number * @returns {boolean} true if the number should be ignored */ function shouldIgnoreNumber(num) { @@ -79,8 +79,8 @@ module.exports = { /** * Returns whether the number should be ignored when used as a radix within parseInt() or Number.parseInt() - * @param {ASTNode} parent - the non-"UnaryExpression" parent - * @param {ASTNode} node - the node literal being evaluated + * @param {ASTNode} parent the non-"UnaryExpression" parent + * @param {ASTNode} node the node literal being evaluated * @returns {boolean} true if the number should be ignored */ function shouldIgnoreParseInt(parent, node) { @@ -93,7 +93,7 @@ module.exports = { /** * Returns whether the number should be ignored when used to define a JSX prop - * @param {ASTNode} parent - the non-"UnaryExpression" parent + * @param {ASTNode} parent the non-"UnaryExpression" parent * @returns {boolean} true if the number should be ignored */ function shouldIgnoreJSXNumbers(parent) { @@ -102,7 +102,7 @@ module.exports = { /** * Returns whether the number should be ignored when used as an array index with enabled 'ignoreArrayIndexes' option. - * @param {ASTNode} parent - the non-"UnaryExpression" parent. + * @param {ASTNode} parent the non-"UnaryExpression" parent. * @returns {boolean} true if the number should be ignored */ function shouldIgnoreArrayIndexes(parent) { diff --git a/lib/rules/no-misleading-character-class.js b/lib/rules/no-misleading-character-class.js index d7c394f463b..6d835816176 100644 --- a/lib/rules/no-misleading-character-class.js +++ b/lib/rules/no-misleading-character-class.js @@ -16,7 +16,6 @@ const { isCombiningCharacter, isEmojiModifier, isRegionalIndicatorSymbol, isSurr * * CharacterClassRange syntax can steal a part of character sequence, * so this function reverts CharacterClassRange syntax and restore the sequence. - * * @param {regexpp.AST.CharacterClassElement[]} nodes The node list to iterate character sequences. * @returns {IterableIterator} The list of character sequences. */ diff --git a/lib/rules/no-mixed-operators.js b/lib/rules/no-mixed-operators.js index 8d1c7a6af43..9e4cbd6e238 100644 --- a/lib/rules/no-mixed-operators.js +++ b/lib/rules/no-mixed-operators.js @@ -40,8 +40,7 @@ const TARGET_NODE_TYPE = /^(?:Binary|Logical|Conditional)Expression$/u; /** * Normalizes options. - * - * @param {Object|undefined} options - A options object to normalize. + * @param {Object|undefined} options A options object to normalize. * @returns {Object} Normalized option object. */ function normalizeOptions(options = {}) { @@ -57,10 +56,9 @@ function normalizeOptions(options = {}) { /** * Checks whether any group which includes both given operator exists or not. - * - * @param {Array.} groups - A list of groups to check. - * @param {string} left - An operator. - * @param {string} right - Another operator. + * @param {Array.} groups A list of groups to check. + * @param {string} left An operator. + * @param {string} right Another operator. * @returns {boolean} `true` if such group existed. */ function includesBothInAGroup(groups, left, right) { @@ -69,8 +67,7 @@ function includesBothInAGroup(groups, left, right) { /** * Checks whether the given node is a conditional expression and returns the test node else the left node. - * - * @param {ASTNode} node - A node which can be a BinaryExpression or a LogicalExpression node. + * @param {ASTNode} node A node which can be a BinaryExpression or a LogicalExpression node. * This parent node can be BinaryExpression, LogicalExpression * , or a ConditionalExpression node * @returns {ASTNode} node the appropriate node(left or test). @@ -124,8 +121,7 @@ module.exports = { /** * Checks whether a given node should be ignored by options or not. - * - * @param {ASTNode} node - A node to check. This is a BinaryExpression + * @param {ASTNode} node A node to check. This is a BinaryExpression * node or a LogicalExpression node. This parent node is one of * them, too. * @returns {boolean} `true` if the node should be ignored. @@ -146,8 +142,7 @@ module.exports = { /** * Checks whether the operator of a given node is mixed with parent * node's operator or not. - * - * @param {ASTNode} node - A node to check. This is a BinaryExpression + * @param {ASTNode} node A node to check. This is a BinaryExpression * node or a LogicalExpression node. This parent node is one of * them, too. * @returns {boolean} `true` if the node was mixed. @@ -163,8 +158,7 @@ module.exports = { /** * Checks whether the operator of a given node is mixed with a * conditional expression. - * - * @param {ASTNode} node - A node to check. This is a conditional + * @param {ASTNode} node A node to check. This is a conditional * expression node * @returns {boolean} `true` if the node was mixed. */ @@ -174,8 +168,7 @@ module.exports = { /** * Gets the operator token of a given node. - * - * @param {ASTNode} node - A node to check. This is a BinaryExpression + * @param {ASTNode} node A node to check. This is a BinaryExpression * node or a LogicalExpression node. * @returns {Token} The operator token of the node. */ @@ -186,8 +179,7 @@ module.exports = { /** * Reports both the operator of a given node and the operator of the * parent node. - * - * @param {ASTNode} node - A node to check. This is a BinaryExpression + * @param {ASTNode} node A node to check. This is a BinaryExpression * node or a LogicalExpression node. This parent node is one of * them, too. * @returns {void} @@ -220,8 +212,7 @@ module.exports = { /** * Checks between the operator of this node and the operator of the * parent node. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function check(node) { diff --git a/lib/rules/no-mixed-requires.js b/lib/rules/no-mixed-requires.js index e3164a8aba6..fda8a11d9e2 100644 --- a/lib/rules/no-mixed-requires.js +++ b/lib/rules/no-mixed-requires.js @@ -58,7 +58,6 @@ module.exports = { /** * Returns the list of built-in modules. - * * @returns {string[]} An array of built-in Node.js modules. */ function getBuiltinModules() { diff --git a/lib/rules/no-native-reassign.js b/lib/rules/no-native-reassign.js index 9ecfb4da7cb..eb233c80b1c 100644 --- a/lib/rules/no-native-reassign.js +++ b/lib/rules/no-native-reassign.js @@ -46,9 +46,9 @@ module.exports = { /** * Reports write references. - * @param {Reference} reference - A reference to check. - * @param {int} index - The index of the reference in the references. - * @param {Reference[]} references - The array that the reference belongs to. + * @param {Reference} reference A reference to check. + * @param {int} index The index of the reference in the references. + * @param {Reference[]} references The array that the reference belongs to. * @returns {void} */ function checkReference(reference, index, references) { @@ -73,7 +73,7 @@ module.exports = { /** * Reports write references if a given variable is read-only builtin. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { diff --git a/lib/rules/no-param-reassign.js b/lib/rules/no-param-reassign.js index 9b8c828d2c2..edaaef537eb 100644 --- a/lib/rules/no-param-reassign.js +++ b/lib/rules/no-param-reassign.js @@ -60,7 +60,7 @@ module.exports = { /** * Checks whether or not the reference modifies properties of its variable. - * @param {Reference} reference - A reference to check. + * @param {Reference} reference A reference to check. * @returns {boolean} Whether or not the reference modifies properties of its variable. */ function isModifyingProp(reference) { @@ -138,9 +138,9 @@ module.exports = { /** * Reports a reference if is non initializer and writable. - * @param {Reference} reference - A reference to check. - * @param {int} index - The index of the reference in the references. - * @param {Reference[]} references - The array that the reference belongs to. + * @param {Reference} reference A reference to check. + * @param {int} index The index of the reference in the references. + * @param {Reference[]} references The array that the reference belongs to. * @returns {void} */ function checkReference(reference, index, references) { @@ -165,7 +165,7 @@ module.exports = { /** * Finds and reports references that are non initializer and writable. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { @@ -176,7 +176,7 @@ module.exports = { /** * Checks parameters of a given function node. - * @param {ASTNode} node - A function node to check. + * @param {ASTNode} node A function node to check. * @returns {void} */ function checkForFunction(node) { diff --git a/lib/rules/no-redeclare.js b/lib/rules/no-redeclare.js index 9de2f4ed730..6ddb21c9e15 100644 --- a/lib/rules/no-redeclare.js +++ b/lib/rules/no-redeclare.js @@ -86,7 +86,7 @@ module.exports = { /** * Find variables in a given scope and flag redeclared ones. - * @param {Scope} scope - An eslint-scope scope object. + * @param {Scope} scope An eslint-scope scope object. * @returns {void} * @private */ diff --git a/lib/rules/no-regex-spaces.js b/lib/rules/no-regex-spaces.js index 41f5e149df0..7581e9271fd 100644 --- a/lib/rules/no-regex-spaces.js +++ b/lib/rules/no-regex-spaces.js @@ -52,7 +52,6 @@ module.exports = { /** * Validate regular expression - * * @param {ASTNode} nodeToReport Node to report. * @param {string} pattern Regular expression pattern to validate. * @param {string} rawPattern Raw representation of the pattern in the source code. diff --git a/lib/rules/no-restricted-imports.js b/lib/rules/no-restricted-imports.js index 6f3d2158c8d..bed9c2432a5 100644 --- a/lib/rules/no-restricted-imports.js +++ b/lib/rules/no-restricted-imports.js @@ -116,7 +116,7 @@ module.exports = { /** * Checks to see if "*" is being used to import everything. - * @param {Set.} importNames - Set of import names that are being imported + * @param {Set.} importNames Set of import names that are being imported * @returns {boolean} whether everything is imported or not */ function isEverythingImported(importNames) { @@ -145,7 +145,7 @@ module.exports = { /** * Report a restricted path specifically for patterns. - * @param {node} node - representing the restricted path reference + * @param {node} node representing the restricted path reference * @returns {void} * @private */ @@ -163,8 +163,8 @@ module.exports = { /** * Report a restricted path specifically when using the '*' import. - * @param {string} importSource - path of the import - * @param {node} node - representing the restricted path reference + * @param {string} importSource path of the import + * @param {node} node representing the restricted path reference * @returns {void} * @private */ @@ -185,8 +185,8 @@ module.exports = { /** * Check if the given importSource is restricted because '*' is being imported. - * @param {string} importSource - path of the import - * @param {Set.} importNames - Set of import names that are being imported + * @param {string} importSource path of the import + * @param {Set.} importNames Set of import names that are being imported * @returns {boolean} whether the path is restricted * @private */ @@ -198,8 +198,8 @@ module.exports = { /** * Check if the given importNames are restricted given a list of restrictedImportNames. - * @param {Set.} importNames - Set of import names that are being imported - * @param {string[]} restrictedImportNames - array of import names that are restricted for this import + * @param {Set.} importNames Set of import names that are being imported + * @param {string[]} restrictedImportNames array of import names that are restricted for this import * @returns {boolean} whether the objectName is restricted * @private */ @@ -211,8 +211,8 @@ module.exports = { /** * Check if the given importSource is a restricted path. - * @param {string} importSource - path of the import - * @param {Set.} importNames - Set of import names that are being imported + * @param {string} importSource path of the import + * @param {Set.} importNames Set of import names that are being imported * @returns {boolean} whether the variable is a restricted path or not * @private */ @@ -232,7 +232,7 @@ module.exports = { /** * Check if the given importSource is restricted by a pattern. - * @param {string} importSource - path of the import + * @param {string} importSource path of the import * @returns {boolean} whether the variable is a restricted pattern or not * @private */ diff --git a/lib/rules/no-self-assign.js b/lib/rules/no-self-assign.js index 6ebd1925e49..9a06ebba6bc 100644 --- a/lib/rules/no-self-assign.js +++ b/lib/rules/no-self-assign.js @@ -20,9 +20,8 @@ const SPACES = /\s+/gu; /** * Checks whether the property of 2 given member expression nodes are the same * property or not. - * - * @param {ASTNode} left - A member expression node to check. - * @param {ASTNode} right - Another member expression node to check. + * @param {ASTNode} left A member expression node to check. + * @param {ASTNode} right Another member expression node to check. * @returns {boolean} `true` if the member expressions have the same property. */ function isSameProperty(left, right) { @@ -43,9 +42,8 @@ function isSameProperty(left, right) { /** * Checks whether 2 given member expression nodes are the reference to the same * property or not. - * - * @param {ASTNode} left - A member expression node to check. - * @param {ASTNode} right - Another member expression node to check. + * @param {ASTNode} left A member expression node to check. + * @param {ASTNode} right Another member expression node to check. * @returns {boolean} `true` if the member expressions are the reference to the * same property or not. */ @@ -68,13 +66,12 @@ function isSameMember(left, right) { /** * Traverses 2 Pattern nodes in parallel, then reports self-assignments. - * - * @param {ASTNode|null} left - A left node to traverse. This is a Pattern or + * @param {ASTNode|null} left A left node to traverse. This is a Pattern or * a Property. - * @param {ASTNode|null} right - A right node to traverse. This is a Pattern or + * @param {ASTNode|null} right A right node to traverse. This is a Pattern or * a Property. - * @param {boolean} props - The flag to check member expressions as well. - * @param {Function} report - A callback function to report. + * @param {boolean} props The flag to check member expressions as well. + * @param {Function} report A callback function to report. * @returns {void} */ function eachSelfAssignment(left, right, props, report) { @@ -205,8 +202,7 @@ module.exports = { /** * Reports a given node as self assignments. - * - * @param {ASTNode} node - A node to report. This is an Identifier node. + * @param {ASTNode} node A node to report. This is an Identifier node. * @returns {void} */ function report(node) { diff --git a/lib/rules/no-sequences.js b/lib/rules/no-sequences.js index 39d147b69be..8046a8711a3 100644 --- a/lib/rules/no-sequences.js +++ b/lib/rules/no-sequences.js @@ -54,7 +54,7 @@ module.exports = { /** * Determines whether a node is required by the grammar to be wrapped in * parens, e.g. the test of an if statement. - * @param {ASTNode} node - The AST node + * @param {ASTNode} node The AST node * @returns {boolean} True if parens around node belong to parent node. */ function requiresExtraParens(node) { @@ -64,7 +64,7 @@ module.exports = { /** * Check if a node is wrapped in parens. - * @param {ASTNode} node - The AST node + * @param {ASTNode} node The AST node * @returns {boolean} True if the node has a paren on each side. */ function isParenthesised(node) { @@ -73,7 +73,7 @@ module.exports = { /** * Check if a node is wrapped in two levels of parens. - * @param {ASTNode} node - The AST node + * @param {ASTNode} node The AST node * @returns {boolean} True if two parens surround the node on each side. */ function isParenthesisedTwice(node) { diff --git a/lib/rules/no-shadow.js b/lib/rules/no-shadow.js index 1993d60078b..bad6cb5f309 100644 --- a/lib/rules/no-shadow.js +++ b/lib/rules/no-shadow.js @@ -54,7 +54,6 @@ module.exports = { /** * Check if variable name is allowed. - * * @param {ASTNode} variable The variable to check. * @returns {boolean} Whether or not the variable name is allowed. */ @@ -67,7 +66,6 @@ module.exports = { * * ClassDeclaration creates two variables of its name into its outer scope and its class scope. * So we should ignore the variable in the class scope. - * * @param {Object} variable The variable to check. * @returns {boolean} Whether or not the variable of the class name in the class scope of ClassDeclaration. */ @@ -82,7 +80,6 @@ module.exports = { * * To avoid reporting at declarations such as `var a = function a() {};`. * But it should report `var a = function(a) {};` or `var a = function() { function a() {} };`. - * * @param {Object} variable The variable to check. * @param {Object} scopeVar The scope variable to look for. * @returns {boolean} Whether or not the variable is inside initializer of scopeVar. @@ -139,7 +136,7 @@ module.exports = { /** * Checks the current context for shadowed variables. - * @param {Scope} scope - Fixme + * @param {Scope} scope Fixme * @returns {void} */ function checkForShadows(scope) { diff --git a/lib/rules/no-this-before-super.js b/lib/rules/no-this-before-super.js index b271797240a..6975ea060bf 100644 --- a/lib/rules/no-this-before-super.js +++ b/lib/rules/no-this-before-super.js @@ -17,7 +17,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a given node is a constructor. - * @param {ASTNode} node - A node to check. This node type is one of + * @param {ASTNode} node A node to check. This node type is one of * `Program`, `FunctionDeclaration`, `FunctionExpression`, and * `ArrowFunctionExpression`. * @returns {boolean} `true` if the node is a constructor. @@ -71,7 +71,7 @@ module.exports = { /** * Gets whether or not `super()` is called in a given code path segment. - * @param {CodePathSegment} segment - A code path segment to get. + * @param {CodePathSegment} segment A code path segment to get. * @returns {boolean} `true` if `super()` is called. */ function isCalled(segment) { @@ -99,7 +99,7 @@ module.exports = { /** * Sets a given node as invalid. - * @param {ASTNode} node - A node to set as invalid. This is one of + * @param {ASTNode} node A node to set as invalid. This is one of * a ThisExpression and a Super. * @returns {void} */ @@ -135,8 +135,8 @@ module.exports = { /** * Adds information of a constructor into the stack. - * @param {CodePath} codePath - A code path which was started. - * @param {ASTNode} node - The current node. + * @param {CodePath} codePath A code path which was started. + * @param {ASTNode} node The current node. * @returns {void} */ onCodePathStart(codePath, node) { @@ -169,8 +169,7 @@ module.exports = { * * And this treverses all segments of this code path then reports every * invalid node. - * - * @param {CodePath} codePath - A code path which was ended. + * @param {CodePath} codePath A code path which was ended. * @returns {void} */ onCodePathEnd(codePath) { @@ -204,7 +203,7 @@ module.exports = { /** * Initialize information of a given code path segment. - * @param {CodePathSegment} segment - A code path segment to initialize. + * @param {CodePathSegment} segment A code path segment to initialize. * @returns {void} */ onCodePathSegmentStart(segment) { @@ -225,9 +224,9 @@ module.exports = { /** * Update information of the code path segment when a code path was * looped. - * @param {CodePathSegment} fromSegment - The code path segment of the + * @param {CodePathSegment} fromSegment The code path segment of the * end of a loop. - * @param {CodePathSegment} toSegment - A code path segment of the head + * @param {CodePathSegment} toSegment A code path segment of the head * of a loop. * @returns {void} */ @@ -258,7 +257,7 @@ module.exports = { /** * Reports if this is before `super()`. - * @param {ASTNode} node - A target node. + * @param {ASTNode} node A target node. * @returns {void} */ ThisExpression(node) { @@ -269,7 +268,7 @@ module.exports = { /** * Reports if this is before `super()`. - * @param {ASTNode} node - A target node. + * @param {ASTNode} node A target node. * @returns {void} */ Super(node) { @@ -280,7 +279,7 @@ module.exports = { /** * Marks `super()` called. - * @param {ASTNode} node - A target node. + * @param {ASTNode} node A target node. * @returns {void} */ "CallExpression:exit"(node) { diff --git a/lib/rules/no-unmodified-loop-condition.js b/lib/rules/no-unmodified-loop-condition.js index 85292d136ec..3b8e7417d5b 100644 --- a/lib/rules/no-unmodified-loop-condition.js +++ b/lib/rules/no-unmodified-loop-condition.js @@ -35,8 +35,7 @@ const DYNAMIC_PATTERN = /^(?:Call|Member|New|TaggedTemplate|Yield)Expression$/u; /** * Checks whether or not a given reference is a write reference. - * - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the reference is a write reference. */ function isWriteReference(reference) { @@ -53,8 +52,7 @@ function isWriteReference(reference) { /** * Checks whether or not a given loop condition info does not have the modified * flag. - * - * @param {LoopConditionInfo} condition - A loop condition info to check. + * @param {LoopConditionInfo} condition A loop condition info to check. * @returns {boolean} `true` if the loop condition info is "unmodified". */ function isUnmodified(condition) { @@ -64,8 +62,7 @@ function isUnmodified(condition) { /** * Checks whether or not a given loop condition info does not have the modified * flag and does not have the group this condition belongs to. - * - * @param {LoopConditionInfo} condition - A loop condition info to check. + * @param {LoopConditionInfo} condition A loop condition info to check. * @returns {boolean} `true` if the loop condition info is "unmodified". */ function isUnmodifiedAndNotBelongToGroup(condition) { @@ -74,9 +71,8 @@ function isUnmodifiedAndNotBelongToGroup(condition) { /** * Checks whether or not a given reference is inside of a given node. - * - * @param {ASTNode} node - A node to check. - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {ASTNode} node A node to check. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the reference is inside of the node. */ function isInRange(node, reference) { @@ -88,9 +84,8 @@ function isInRange(node, reference) { /** * Checks whether or not a given reference is inside of a loop node's condition. - * - * @param {ASTNode} node - A node to check. - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {ASTNode} node A node to check. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the reference is inside of the loop node's * condition. */ @@ -108,8 +103,7 @@ const isInLoop = { /** * Gets the function which encloses a given reference. * This supports only FunctionDeclaration. - * - * @param {eslint-scope.Reference} reference - A reference to get. + * @param {eslint-scope.Reference} reference A reference to get. * @returns {ASTNode|null} The function node or null. */ function getEncloseFunctionDeclaration(reference) { @@ -128,9 +122,8 @@ function getEncloseFunctionDeclaration(reference) { /** * Updates the "modified" flags of given loop conditions with given modifiers. - * - * @param {LoopConditionInfo[]} conditions - The loop conditions to be updated. - * @param {eslint-scope.Reference[]} modifiers - The references to update. + * @param {LoopConditionInfo[]} conditions The loop conditions to be updated. + * @param {eslint-scope.Reference[]} modifiers The references to update. * @returns {void} */ function updateModifiedFlag(conditions, modifiers) { @@ -183,8 +176,7 @@ module.exports = { /** * Reports a given condition info. - * - * @param {LoopConditionInfo} condition - A loop condition info to report. + * @param {LoopConditionInfo} condition A loop condition info to report. * @returns {void} */ function report(condition) { @@ -199,8 +191,7 @@ module.exports = { /** * Registers given conditions to the group the condition belongs to. - * - * @param {LoopConditionInfo[]} conditions - A loop condition info to + * @param {LoopConditionInfo[]} conditions A loop condition info to * register. * @returns {void} */ @@ -222,8 +213,7 @@ module.exports = { /** * Reports references which are inside of unmodified groups. - * - * @param {LoopConditionInfo[]} conditions - A loop condition info to report. + * @param {LoopConditionInfo[]} conditions A loop condition info to report. * @returns {void} */ function checkConditionsInGroup(conditions) { @@ -234,8 +224,7 @@ module.exports = { /** * Checks whether or not a given group node has any dynamic elements. - * - * @param {ASTNode} root - A node to check. + * @param {ASTNode} root A node to check. * This node is one of BinaryExpression or ConditionalExpression. * @returns {boolean} `true` if the node is dynamic. */ @@ -259,8 +248,7 @@ module.exports = { /** * Creates the loop condition information from a given reference. - * - * @param {eslint-scope.Reference} reference - A reference to create. + * @param {eslint-scope.Reference} reference A reference to create. * @returns {LoopConditionInfo|null} Created loop condition info, or null. */ function toLoopCondition(reference) { @@ -313,8 +301,7 @@ module.exports = { /** * Finds unmodified references which are inside of a loop condition. * Then reports the references which are outside of groups. - * - * @param {eslint-scope.Variable} variable - A variable to report. + * @param {eslint-scope.Variable} variable A variable to report. * @returns {void} */ function checkReferences(variable) { diff --git a/lib/rules/no-unneeded-ternary.js b/lib/rules/no-unneeded-ternary.js index 331c9ce94d7..893baa34f74 100644 --- a/lib/rules/no-unneeded-ternary.js +++ b/lib/rules/no-unneeded-ternary.js @@ -57,7 +57,7 @@ module.exports = { /** * Test if the node is a boolean literal - * @param {ASTNode} node - The node to report. + * @param {ASTNode} node The node to report. * @returns {boolean} True if the its a boolean literal * @private */ @@ -91,7 +91,7 @@ module.exports = { /** * Tests if a given node always evaluates to a boolean value - * @param {ASTNode} node - An expression node + * @param {ASTNode} node An expression node * @returns {boolean} True if it is determined that the node will always evaluate to a boolean value */ function isBooleanExpression(node) { @@ -101,7 +101,7 @@ module.exports = { /** * Test if the node matches the pattern id ? id : expression - * @param {ASTNode} node - The ConditionalExpression to check. + * @param {ASTNode} node The ConditionalExpression to check. * @returns {boolean} True if the pattern is matched, and false otherwise * @private */ diff --git a/lib/rules/no-unreachable.js b/lib/rules/no-unreachable.js index 8ea2583f7cb..91c4ca71509 100644 --- a/lib/rules/no-unreachable.js +++ b/lib/rules/no-unreachable.js @@ -10,7 +10,7 @@ /** * Checks whether or not a given variable declarator has the initializer. - * @param {ASTNode} node - A VariableDeclarator node to check. + * @param {ASTNode} node A VariableDeclarator node to check. * @returns {boolean} `true` if the node has the initializer. */ function isInitialized(node) { @@ -19,7 +19,7 @@ function isInitialized(node) { /** * Checks whether or not a given code path segment is unreachable. - * @param {CodePathSegment} segment - A CodePathSegment to check. + * @param {CodePathSegment} segment A CodePathSegment to check. * @returns {boolean} `true` if the segment is unreachable. */ function isUnreachable(segment) { @@ -57,7 +57,7 @@ class ConsecutiveRange { /** * Checks whether the given node is inside of this range. - * @param {ASTNode|Token} node - The node to check. + * @param {ASTNode|Token} node The node to check. * @returns {boolean} `true` if the node is inside of this range. */ contains(node) { @@ -69,7 +69,7 @@ class ConsecutiveRange { /** * Checks whether the given node is consecutive to this range. - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} `true` if the node is consecutive to this range. */ isConsecutive(node) { @@ -78,7 +78,7 @@ class ConsecutiveRange { /** * Merges the given node to this range. - * @param {ASTNode} node - The node to merge. + * @param {ASTNode} node The node to merge. * @returns {void} */ merge(node) { @@ -87,7 +87,7 @@ class ConsecutiveRange { /** * Resets this range by the given node or null. - * @param {ASTNode|null} node - The node to reset, or null. + * @param {ASTNode|null} node The node to reset, or null. * @returns {void} */ reset(node) { @@ -120,7 +120,7 @@ module.exports = { /** * Reports a given node if it's unreachable. - * @param {ASTNode} node - A statement node to report. + * @param {ASTNode} node A statement node to report. * @returns {void} */ function reportIfUnreachable(node) { diff --git a/lib/rules/no-unsafe-finally.js b/lib/rules/no-unsafe-finally.js index 4daa63b6929..a41dff9c803 100644 --- a/lib/rules/no-unsafe-finally.js +++ b/lib/rules/no-unsafe-finally.js @@ -35,8 +35,7 @@ module.exports = { /** * Checks if the node is the finalizer of a TryStatement - * - * @param {ASTNode} node - node to check. + * @param {ASTNode} node node to check. * @returns {boolean} - true if the node is the finalizer of a TryStatement */ function isFinallyBlock(node) { @@ -45,9 +44,8 @@ module.exports = { /** * Climbs up the tree if the node is not a sentinel node - * - * @param {ASTNode} node - node to check. - * @param {string} label - label of the break or continue statement + * @param {ASTNode} node node to check. + * @param {string} label label of the break or continue statement * @returns {boolean} - return whether the node is a finally block or a sentinel node */ function isInFinallyBlock(node, label) { @@ -82,8 +80,7 @@ module.exports = { /** * Checks whether the possibly-unsafe statement is inside a finally block. - * - * @param {ASTNode} node - node to check. + * @param {ASTNode} node node to check. * @returns {void} */ function check(node) { diff --git a/lib/rules/no-unsafe-negation.js b/lib/rules/no-unsafe-negation.js index 717e5f6be39..5226b367dee 100644 --- a/lib/rules/no-unsafe-negation.js +++ b/lib/rules/no-unsafe-negation.js @@ -17,8 +17,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether the given operator is a relational operator or not. - * - * @param {string} op - The operator type to check. + * @param {string} op The operator type to check. * @returns {boolean} `true` if the operator is a relational operator. */ function isRelationalOperator(op) { @@ -27,8 +26,7 @@ function isRelationalOperator(op) { /** * Checks whether the given node is a logical negation expression or not. - * - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} `true` if the node is a logical negation expression. */ function isNegation(node) { diff --git a/lib/rules/no-unused-expressions.js b/lib/rules/no-unused-expressions.js index 02cce309ee9..191dd7c58a5 100644 --- a/lib/rules/no-unused-expressions.js +++ b/lib/rules/no-unused-expressions.js @@ -48,7 +48,7 @@ module.exports = { allowTaggedTemplates = config.allowTaggedTemplates || false; /** - * @param {ASTNode} node - any node + * @param {ASTNode} node any node * @returns {boolean} whether the given node structurally represents a directive */ function looksLikeDirective(node) { @@ -57,8 +57,8 @@ module.exports = { } /** - * @param {Function} predicate - ([a] -> Boolean) the function used to make the determination - * @param {a[]} list - the input list + * @param {Function} predicate ([a] -> Boolean) the function used to make the determination + * @param {a[]} list the input list * @returns {a[]} the leading sequence of members in the given list that pass the given predicate */ function takeWhile(predicate, list) { @@ -71,7 +71,7 @@ module.exports = { } /** - * @param {ASTNode} node - a Program or BlockStatement node + * @param {ASTNode} node a Program or BlockStatement node * @returns {ASTNode[]} the leading sequence of directive nodes in the given node's body */ function directives(node) { @@ -79,8 +79,8 @@ module.exports = { } /** - * @param {ASTNode} node - any node - * @param {ASTNode[]} ancestors - the given node's ancestors + * @param {ASTNode} node any node + * @param {ASTNode[]} ancestors the given node's ancestors * @returns {boolean} whether the given node is considered a directive in its current position */ function isDirective(node, ancestors) { @@ -94,7 +94,7 @@ module.exports = { /** * Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags. - * @param {ASTNode} node - any node + * @param {ASTNode} node any node * @returns {boolean} whether the given node is a valid expression */ function isValidExpression(node) { diff --git a/lib/rules/no-unused-labels.js b/lib/rules/no-unused-labels.js index 1ba1d05d5c6..b33fcb78679 100644 --- a/lib/rules/no-unused-labels.js +++ b/lib/rules/no-unused-labels.js @@ -35,8 +35,7 @@ module.exports = { /** * Adds a scope info to the stack. - * - * @param {ASTNode} node - A node to add. This is a LabeledStatement. + * @param {ASTNode} node A node to add. This is a LabeledStatement. * @returns {void} */ function enterLabeledScope(node) { @@ -50,8 +49,7 @@ module.exports = { /** * Removes the top of the stack. * At the same time, this reports the label if it's never used. - * - * @param {ASTNode} node - A node to report. This is a LabeledStatement. + * @param {ASTNode} node A node to report. This is a LabeledStatement. * @returns {void} */ function exitLabeledScope(node) { @@ -81,8 +79,7 @@ module.exports = { /** * Marks the label of a given node as used. - * - * @param {ASTNode} node - A node to mark. This is a BreakStatement or + * @param {ASTNode} node A node to mark. This is a BreakStatement or * ContinueStatement. * @returns {void} */ diff --git a/lib/rules/no-unused-vars.js b/lib/rules/no-unused-vars.js index 8094de57c73..63e6e048ef1 100644 --- a/lib/rules/no-unused-vars.js +++ b/lib/rules/no-unused-vars.js @@ -103,7 +103,7 @@ module.exports = { /** * Generate the warning message about the variable being * defined and unused, including the ignore pattern if configured. - * @param {Variable} unusedVar - eslint-scope variable object. + * @param {Variable} unusedVar eslint-scope variable object. * @returns {string} The warning message to be used with this unused variable. */ function getDefinedMessage(unusedVar) { @@ -146,7 +146,7 @@ module.exports = { /** * Determines if a given variable is being exported from a module. - * @param {Variable} variable - eslint-scope variable object. + * @param {Variable} variable eslint-scope variable object. * @returns {boolean} True if the variable is exported, false if not. * @private */ @@ -172,7 +172,7 @@ module.exports = { /** * Determines if a variable has a sibling rest property - * @param {Variable} variable - eslint-scope variable object. + * @param {Variable} variable eslint-scope variable object. * @returns {boolean} True if the variable is exported, false if not. * @private */ @@ -195,7 +195,7 @@ module.exports = { /** * Determines if a reference is a read operation. - * @param {Reference} ref - An eslint-scope Reference + * @param {Reference} ref An eslint-scope Reference * @returns {boolean} whether the given reference represents a read operation * @private */ @@ -205,8 +205,8 @@ module.exports = { /** * Determine if an identifier is referencing an enclosing function name. - * @param {Reference} ref - The reference to check. - * @param {ASTNode[]} nodes - The candidate function nodes. + * @param {Reference} ref The reference to check. + * @param {ASTNode[]} nodes The candidate function nodes. * @returns {boolean} True if it's a self-reference, false if not. * @private */ @@ -226,7 +226,7 @@ module.exports = { /** * Gets a list of function definitions for a specified variable. - * @param {Variable} variable - eslint-scope variable object. + * @param {Variable} variable eslint-scope variable object. * @returns {ASTNode[]} Function nodes. * @private */ @@ -252,9 +252,8 @@ module.exports = { /** * Checks the position of given nodes. - * - * @param {ASTNode} inner - A node which is expected as inside. - * @param {ASTNode} outer - A node which is expected as outside. + * @param {ASTNode} inner A node which is expected as inside. + * @param {ASTNode} outer A node which is expected as outside. * @returns {boolean} `true` if the `inner` node exists in the `outer` node. * @private */ @@ -275,9 +274,8 @@ module.exports = { * - The reference is inside of a loop. * - The reference is inside of a function scope which is different from * the declaration. - * - * @param {eslint-scope.Reference} ref - A reference to check. - * @param {ASTNode} prevRhsNode - The previous RHS node. + * @param {eslint-scope.Reference} ref A reference to check. + * @param {ASTNode} prevRhsNode The previous RHS node. * @returns {ASTNode|null} The RHS node or null. * @private */ @@ -310,9 +308,8 @@ module.exports = { /** * Checks whether a given function node is stored to somewhere or not. * If the function node is stored, the function can be used later. - * - * @param {ASTNode} funcNode - A function node to check. - * @param {ASTNode} rhsNode - The RHS node of the previous assignment. + * @param {ASTNode} funcNode A function node to check. + * @param {ASTNode} rhsNode The RHS node of the previous assignment. * @returns {boolean} `true` if under the following conditions: * - the funcNode is assigned to a variable. * - the funcNode is bound as an argument of a function call. @@ -367,9 +364,8 @@ module.exports = { * - the function is bound as an argument of a function call. * * If a reference exists in a function which can be used later, the reference is read when the function is called. - * - * @param {ASTNode} id - An Identifier node to check. - * @param {ASTNode} rhsNode - The RHS node of the previous assignment. + * @param {ASTNode} id An Identifier node to check. + * @param {ASTNode} rhsNode The RHS node of the previous assignment. * @returns {boolean} `true` if the `id` node exists inside of a function node which can be used later. * @private */ @@ -385,9 +381,8 @@ module.exports = { /** * Checks whether a given reference is a read to update itself or not. - * - * @param {eslint-scope.Reference} ref - A reference to check. - * @param {ASTNode} rhsNode - The RHS node of the previous assignment. + * @param {eslint-scope.Reference} ref A reference to check. + * @param {ASTNode} rhsNode The RHS node of the previous assignment. * @returns {boolean} The reference is a read to update itself. * @private */ @@ -416,8 +411,7 @@ module.exports = { /** * Determine if an identifier is used either in for-in loops. - * - * @param {Reference} ref - The reference to check. + * @param {Reference} ref The reference to check. * @returns {boolean} whether reference is used in the for-in loops * @private */ @@ -453,7 +447,7 @@ module.exports = { /** * Determines if the variable is used. - * @param {Variable} variable - The variable to check. + * @param {Variable} variable The variable to check. * @returns {boolean} True if the variable is used * @private */ @@ -481,8 +475,7 @@ module.exports = { /** * Checks whether the given variable is after the last used parameter. - * - * @param {eslint-scope.Variable} variable - The variable to check. + * @param {eslint-scope.Variable} variable The variable to check. * @returns {boolean} `true` if the variable is defined after the last * used parameter. */ @@ -497,8 +490,8 @@ module.exports = { /** * Gets an array of variables without read references. - * @param {Scope} scope - an eslint-scope Scope object. - * @param {Variable[]} unusedVars - an array that saving result. + * @param {Scope} scope an eslint-scope Scope object. + * @param {Variable[]} unusedVars an array that saving result. * @returns {Variable[]} unused variables of the scope and descendant scopes. * @private */ diff --git a/lib/rules/no-use-before-define.js b/lib/rules/no-use-before-define.js index a98f6c87ff8..ed3540532f9 100644 --- a/lib/rules/no-use-before-define.js +++ b/lib/rules/no-use-before-define.js @@ -14,8 +14,7 @@ const FOR_IN_OF_TYPE = /^For(?:In|Of)Statement$/u; /** * Parses a given value as options. - * - * @param {any} options - A value to parse. + * @param {any} options A value to parse. * @returns {Object} The parsed options. */ function parseOptions(options) { @@ -36,8 +35,7 @@ function parseOptions(options) { /** * Checks whether or not a given variable is a function declaration. - * - * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Variable} variable A variable to check. * @returns {boolean} `true` if the variable is a function declaration. */ function isFunction(variable) { @@ -46,9 +44,8 @@ function isFunction(variable) { /** * Checks whether or not a given variable is a class declaration in an upper function scope. - * - * @param {eslint-scope.Variable} variable - A variable to check. - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {eslint-scope.Variable} variable A variable to check. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the variable is a class declaration. */ function isOuterClass(variable, reference) { @@ -60,8 +57,8 @@ function isOuterClass(variable, reference) { /** * Checks whether or not a given variable is a variable declaration in an upper function scope. - * @param {eslint-scope.Variable} variable - A variable to check. - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {eslint-scope.Variable} variable A variable to check. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the variable is a variable declaration. */ function isOuterVariable(variable, reference) { @@ -73,9 +70,8 @@ function isOuterVariable(variable, reference) { /** * Checks whether or not a given location is inside of the range of a given node. - * - * @param {ASTNode} node - An node to check. - * @param {number} location - A location to check. + * @param {ASTNode} node An node to check. + * @param {number} location A location to check. * @returns {boolean} `true` if the location is inside of the range of the node. */ function isInRange(node, location) { @@ -92,9 +88,8 @@ function isInRange(node, location) { * var {a = a} = obj * for (var a in a) {} * for (var a of a) {} - * - * @param {Variable} variable - A variable to check. - * @param {Reference} reference - A reference to check. + * @param {Variable} variable A variable to check. + * @param {Reference} reference A reference to check. * @returns {boolean} `true` if the reference is inside of the initializers. */ function isInInitializer(variable, reference) { diff --git a/lib/rules/no-useless-call.js b/lib/rules/no-useless-call.js index d08b9cb8cb7..11cf524d124 100644 --- a/lib/rules/no-useless-call.js +++ b/lib/rules/no-useless-call.js @@ -13,7 +13,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a node is a `.call()`/`.apply()`. - * @param {ASTNode} node - A CallExpression node to check. + * @param {ASTNode} node A CallExpression node to check. * @returns {boolean} Whether or not the node is a `.call()`/`.apply()`. */ function isCallOrNonVariadicApply(node) { @@ -31,9 +31,9 @@ function isCallOrNonVariadicApply(node) { /** * Checks whether or not `thisArg` is not changed by `.call()`/`.apply()`. - * @param {ASTNode|null} expectedThis - The node that is the owner of the applied function. - * @param {ASTNode} thisArg - The node that is given to the first argument of the `.call()`/`.apply()`. - * @param {SourceCode} sourceCode - The ESLint source code object. + * @param {ASTNode|null} expectedThis The node that is the owner of the applied function. + * @param {ASTNode} thisArg The node that is given to the first argument of the `.call()`/`.apply()`. + * @param {SourceCode} sourceCode The ESLint source code object. * @returns {boolean} Whether or not `thisArg` is not changed by `.call()`/`.apply()`. */ function isValidThisArg(expectedThis, thisArg, sourceCode) { diff --git a/lib/rules/no-useless-concat.js b/lib/rules/no-useless-concat.js index d26003f1e4f..cdaca273eb0 100644 --- a/lib/rules/no-useless-concat.js +++ b/lib/rules/no-useless-concat.js @@ -16,7 +16,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a given node is a concatenation. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a concatenation. */ function isConcatenation(node) { @@ -25,7 +25,7 @@ function isConcatenation(node) { /** * Checks if the given token is a `+` token or not. - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a `+` token. */ function isConcatOperatorToken(token) { @@ -34,7 +34,7 @@ function isConcatOperatorToken(token) { /** * Get's the right most node on the left side of a BinaryExpression with + operator. - * @param {ASTNode} node - A BinaryExpression node to check. + * @param {ASTNode} node A BinaryExpression node to check. * @returns {ASTNode} node */ function getLeft(node) { @@ -48,7 +48,7 @@ function getLeft(node) { /** * Get's the left most node on the right side of a BinaryExpression with + operator. - * @param {ASTNode} node - A BinaryExpression node to check. + * @param {ASTNode} node A BinaryExpression node to check. * @returns {ASTNode} node */ function getRight(node) { diff --git a/lib/rules/no-useless-constructor.js b/lib/rules/no-useless-constructor.js index c10376450eb..7cf033805f9 100644 --- a/lib/rules/no-useless-constructor.js +++ b/lib/rules/no-useless-constructor.js @@ -10,8 +10,7 @@ /** * Checks whether a given array of statements is a single call of `super`. - * - * @param {ASTNode[]} body - An array of statements to check. + * @param {ASTNode[]} body An array of statements to check. * @returns {boolean} `true` if the body is a single call of `super`. */ function isSingleSuperCall(body) { @@ -26,8 +25,7 @@ function isSingleSuperCall(body) { /** * Checks whether a given node is a pattern which doesn't have any side effects. * Default parameters and Destructuring parameters can have side effects. - * - * @param {ASTNode} node - A pattern node. + * @param {ASTNode} node A pattern node. * @returns {boolean} `true` if the node doesn't have any side effects. */ function isSimple(node) { @@ -37,8 +35,7 @@ function isSimple(node) { /** * Checks whether a given array of expressions is `...arguments` or not. * `super(...arguments)` passes all arguments through. - * - * @param {ASTNode[]} superArgs - An array of expressions to check. + * @param {ASTNode[]} superArgs An array of expressions to check. * @returns {boolean} `true` if the superArgs is `...arguments`. */ function isSpreadArguments(superArgs) { @@ -52,9 +49,8 @@ function isSpreadArguments(superArgs) { /** * Checks whether given 2 nodes are identifiers which have the same name or not. - * - * @param {ASTNode} ctorParam - A node to check. - * @param {ASTNode} superArg - A node to check. + * @param {ASTNode} ctorParam A node to check. + * @param {ASTNode} superArg A node to check. * @returns {boolean} `true` if the nodes are identifiers which have the same * name. */ @@ -68,9 +64,8 @@ function isValidIdentifierPair(ctorParam, superArg) { /** * Checks whether given 2 nodes are a rest/spread pair which has the same values. - * - * @param {ASTNode} ctorParam - A node to check. - * @param {ASTNode} superArg - A node to check. + * @param {ASTNode} ctorParam A node to check. + * @param {ASTNode} superArg A node to check. * @returns {boolean} `true` if the nodes are a rest/spread pair which has the * same values. */ @@ -84,9 +79,8 @@ function isValidRestSpreadPair(ctorParam, superArg) { /** * Checks whether given 2 nodes have the same value or not. - * - * @param {ASTNode} ctorParam - A node to check. - * @param {ASTNode} superArg - A node to check. + * @param {ASTNode} ctorParam A node to check. + * @param {ASTNode} superArg A node to check. * @returns {boolean} `true` if the nodes have the same value or not. */ function isValidPair(ctorParam, superArg) { @@ -99,9 +93,8 @@ function isValidPair(ctorParam, superArg) { /** * Checks whether the parameters of a constructor and the arguments of `super()` * have the same values or not. - * - * @param {ASTNode} ctorParams - The parameters of a constructor to check. - * @param {ASTNode} superArgs - The arguments of `super()` to check. + * @param {ASTNode} ctorParams The parameters of a constructor to check. + * @param {ASTNode} superArgs The arguments of `super()` to check. * @returns {boolean} `true` if those have the same values. */ function isPassingThrough(ctorParams, superArgs) { @@ -120,9 +113,8 @@ 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. + * @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 */ function isRedundantSuperCall(body, ctorParams) { @@ -158,7 +150,7 @@ module.exports = { /** * Checks whether a node is a redundant constructor - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {void} */ function checkForConstructor(node) { diff --git a/lib/rules/no-useless-escape.js b/lib/rules/no-useless-escape.js index e161e4acedf..ebfe4cba38a 100644 --- a/lib/rules/no-useless-escape.js +++ b/lib/rules/no-useless-escape.js @@ -117,10 +117,9 @@ module.exports = { /** * Checks if the escape character in given string slice is unnecessary. - * * @private - * @param {ASTNode} node - node to validate. - * @param {string} match - string slice to validate. + * @param {ASTNode} node node to validate. + * @param {string} match string slice to validate. * @returns {void} */ function validateString(node, match) { @@ -156,8 +155,7 @@ module.exports = { /** * Checks if a node has an escape. - * - * @param {ASTNode} node - node to check. + * @param {ASTNode} node node to check. * @returns {void} */ function check(node) { diff --git a/lib/rules/no-useless-rename.js b/lib/rules/no-useless-rename.js index f31459bd8ae..eb570a3ef5c 100644 --- a/lib/rules/no-useless-rename.js +++ b/lib/rules/no-useless-rename.js @@ -48,10 +48,10 @@ module.exports = { /** * Reports error for unnecessarily renamed assignments - * @param {ASTNode} node - node to report - * @param {ASTNode} initial - node with initial name value - * @param {ASTNode} result - node with new name value - * @param {string} type - the type of the offending node + * @param {ASTNode} node node to report + * @param {ASTNode} initial node with initial name value + * @param {ASTNode} result node with new name value + * @param {string} type the type of the offending node * @returns {void} */ function reportError(node, initial, result, type) { @@ -83,7 +83,7 @@ module.exports = { /** * Checks whether a destructured assignment is unnecessarily renamed - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {void} */ function checkDestructured(node) { @@ -120,7 +120,7 @@ module.exports = { /** * Checks whether an import is unnecessarily renamed - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {void} */ function checkImport(node) { @@ -136,7 +136,7 @@ module.exports = { /** * Checks whether an export is unnecessarily renamed - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {void} */ function checkExport(node) { diff --git a/lib/rules/no-useless-return.js b/lib/rules/no-useless-return.js index 7b12e85091c..942d4eede99 100644 --- a/lib/rules/no-useless-return.js +++ b/lib/rules/no-useless-return.js @@ -17,9 +17,8 @@ const astUtils = require("./utils/ast-utils"), /** * Removes the given element from the array. - * - * @param {Array} array - The source array to remove. - * @param {any} element - The target item to remove. + * @param {Array} array The source array to remove. + * @param {any} element The target item to remove. * @returns {void} */ function remove(array, element) { @@ -32,8 +31,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. + * @param {ASTNode} node The return statement node to check. * @returns {boolean} `true` if the node is removeable. */ function isRemovable(node) { @@ -42,8 +40,7 @@ function isRemovable(node) { /** * Checks whether the given return statement is in a `finally` block or not. - * - * @param {ASTNode} node - The return statement node to check. + * @param {ASTNode} node The return statement node to check. * @returns {boolean} `true` if the node is in a `finally` block. */ function isInFinally(node) { @@ -87,8 +84,7 @@ module.exports = { /** * Checks whether the given segment is terminated by a return statement or not. - * - * @param {CodePathSegment} segment - The segment to check. + * @param {CodePathSegment} segment The segment to check. * @returns {boolean} `true` if the segment is terminated by a return statement, or if it's still a part of unreachable. */ function isReturned(segment) { @@ -110,9 +106,8 @@ module.exports = { * * This behavior would simulate code paths for the case that the return * statement does not exist. - * - * @param {ASTNode[]} uselessReturns - The collected return statements. - * @param {CodePathSegment[]} prevSegments - The previous segments to traverse. + * @param {ASTNode[]} uselessReturns The collected return statements. + * @param {CodePathSegment[]} prevSegments The previous segments to traverse. * @param {WeakSet} [providedTraversedSegments] A set of segments that have already been traversed in this call * @returns {ASTNode[]} `uselessReturns`. */ @@ -152,8 +147,7 @@ module.exports = { * * This behavior would simulate code paths for the case that the return * statement does not exist. - * - * @param {CodePathSegment} segment - The segment to get return statements. + * @param {CodePathSegment} segment The segment to get return statements. * @returns {void} */ function markReturnStatementsOnSegmentAsUsed(segment) { @@ -184,7 +178,6 @@ module.exports = { * - FunctionDeclarations are always executed whether it's returned or not. * - BlockStatements do nothing. * - BreakStatements go the next merely. - * * @returns {void} */ function markReturnStatementsOnCurrentSegmentsAsUsed() { diff --git a/lib/rules/no-var.js b/lib/rules/no-var.js index a3c750f9011..74203f8bf3b 100644 --- a/lib/rules/no-var.js +++ b/lib/rules/no-var.js @@ -27,8 +27,7 @@ function isGlobal(variable) { /** * Finds the nearest function scope or global scope walking up the scope * hierarchy. - * - * @param {eslint-scope.Scope} scope - The scope to traverse. + * @param {eslint-scope.Scope} scope The scope to traverse. * @returns {eslint-scope.Scope} a function scope or global scope containing the given * scope. */ @@ -44,8 +43,7 @@ function getEnclosingFunctionScope(scope) { /** * Checks whether the given variable has any references from a more specific * function expression (i.e. a closure). - * - * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Variable} variable A variable to check. * @returns {boolean} `true` if the variable is used from a closure. */ function isReferencedInClosure(variable) { @@ -57,8 +55,7 @@ function isReferencedInClosure(variable) { /** * Checks whether the given node is the assignee of a loop. - * - * @param {ASTNode} node - A VariableDeclaration node to check. + * @param {ASTNode} node A VariableDeclaration node to check. * @returns {boolean} `true` if the declaration is assigned as part of loop * iteration. */ @@ -69,8 +66,7 @@ function isLoopAssignee(node) { /** * Checks whether the given variable declaration is immediately initialized. - * - * @param {ASTNode} node - A VariableDeclaration node to check. + * @param {ASTNode} node A VariableDeclaration node to check. * @returns {boolean} `true` if the declaration has an initializer. */ function isDeclarationInitialized(node) { @@ -81,8 +77,7 @@ const SCOPE_NODE_TYPE = /^(?:Program|BlockStatement|SwitchStatement|ForStatement /** * Gets the scope node which directly contains a given node. - * - * @param {ASTNode} node - A node to get. This is a `VariableDeclaration` or + * @param {ASTNode} node A node to get. This is a `VariableDeclaration` or * an `Identifier`. * @returns {ASTNode} A scope node. This is one of `Program`, `BlockStatement`, * `SwitchStatement`, `ForStatement`, `ForInStatement`, and @@ -101,8 +96,7 @@ function getScopeNode(node) { /** * Checks whether a given variable is redeclared or not. - * - * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Variable} variable A variable to check. * @returns {boolean} `true` if the variable is redeclared. */ function isRedeclared(variable) { @@ -111,8 +105,7 @@ function isRedeclared(variable) { /** * Checks whether a given variable is used from outside of the specified scope. - * - * @param {ASTNode} scopeNode - A scope node to check. + * @param {ASTNode} scopeNode A scope node to check. * @returns {Function} The predicate function which checks whether a given * variable is used from outside of the specified scope. */ @@ -120,8 +113,7 @@ function isUsedFromOutsideOf(scopeNode) { /** * Checks whether a given reference is inside of the specified scope or not. - * - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the reference is inside of the specified * scope. */ @@ -145,8 +137,7 @@ function isUsedFromOutsideOf(scopeNode) { * - if a reference is before the declarator. E.g. (var a = b, b = 1;)(var {a = b, b} = {};) * - if a reference is in the expression of their default value. E.g. (var {a = a} = {};) * - if a reference is in the expression of their initializer. E.g. (var a = a;) - * - * @param {ASTNode} node - The initializer node of VariableDeclarator. + * @param {ASTNode} node The initializer node of VariableDeclarator. * @returns {Function} The predicate function. * @private */ @@ -177,7 +168,6 @@ function hasReferenceInTDZ(node) { /** * Checks whether a given variable has name that is allowed for 'var' declarations, * but disallowed for `let` declarations. - * * @param {eslint-scope.Variable} variable The variable to check. * @returns {boolean} `true` if the variable has a disallowed name. */ @@ -209,8 +199,7 @@ module.exports = { /** * Checks whether the variables which are defined by the given declarator node have their references in TDZ. - * - * @param {ASTNode} declarator - The VariableDeclarator node to check. + * @param {ASTNode} declarator The VariableDeclarator node to check. * @returns {boolean} `true` if one of the variables which are defined by the given declarator node have their references in TDZ. */ function hasSelfReferenceInTDZ(declarator) { @@ -271,8 +260,7 @@ module.exports = { * the implementation simple, we only convert `var` to `let` within * loops when the variable is a loop assignee or the declaration has an * initializer. - * - * @param {ASTNode} node - A variable declaration node to check. + * @param {ASTNode} node A variable declaration node to check. * @returns {boolean} `true` if it can fix the node. */ function canFix(node) { @@ -313,8 +301,7 @@ module.exports = { /** * Reports a given variable declaration node. - * - * @param {ASTNode} node - A variable declaration node to report. + * @param {ASTNode} node A variable declaration node to report. * @returns {void} */ function report(node) { diff --git a/lib/rules/no-warning-comments.js b/lib/rules/no-warning-comments.js index 5a8e0bc7ec2..a400c446767 100644 --- a/lib/rules/no-warning-comments.js +++ b/lib/rules/no-warning-comments.js @@ -54,7 +54,6 @@ module.exports = { * Convert a warning term into a RegExp which will match a comment containing that whole word in the specified * location ("start" or "anywhere"). If the term starts or ends with non word characters, then the match will not * require word boundaries on that side. - * * @param {string} term A term to convert to a RegExp * @returns {RegExp} The term converted to a RegExp */ diff --git a/lib/rules/no-whitespace-before-property.js b/lib/rules/no-whitespace-before-property.js index 83ff801b2b8..9541401a317 100644 --- a/lib/rules/no-whitespace-before-property.js +++ b/lib/rules/no-whitespace-before-property.js @@ -38,9 +38,9 @@ module.exports = { /** * Reports whitespace before property token - * @param {ASTNode} node - the node to report in the event of an error - * @param {Token} leftToken - the left token - * @param {Token} rightToken - the right token + * @param {ASTNode} node the node to report in the event of an error + * @param {Token} leftToken the left token + * @param {Token} rightToken the right token * @returns {void} * @private */ diff --git a/lib/rules/object-curly-newline.js b/lib/rules/object-curly-newline.js index be9ae23a6f4..e870a69a954 100644 --- a/lib/rules/object-curly-newline.js +++ b/lib/rules/object-curly-newline.js @@ -44,8 +44,7 @@ const OPTION_VALUE = { /** * Normalizes a given option value. - * - * @param {string|Object|undefined} value - An option value to parse. + * @param {string|Object|undefined} value An option value to parse. * @returns {{multiline: boolean, minProperties: number, consistent: boolean}} Normalized option object. */ function normalizeOptionValue(value) { @@ -72,8 +71,7 @@ function normalizeOptionValue(value) { /** * Normalizes a given option value. - * - * @param {string|Object|undefined} options - An option value to parse. + * @param {string|Object|undefined} options An option value to parse. * @returns {{ * ObjectExpression: {multiline: boolean, minProperties: number, consistent: boolean}, * ObjectPattern: {multiline: boolean, minProperties: number, consistent: boolean}, @@ -101,11 +99,10 @@ function normalizeOptions(options) { /** * Determines if ObjectExpression, ObjectPattern, ImportDeclaration or ExportNamedDeclaration * node needs to be checked for missing line breaks - * - * @param {ASTNode} node - Node under inspection - * @param {Object} options - option specific to node type - * @param {Token} first - First object property - * @param {Token} last - Last object property + * @param {ASTNode} node Node under inspection + * @param {Object} options option specific to node type + * @param {Token} first First object property + * @param {Token} last Last object property * @returns {boolean} `true` if node needs to be checked for missing line breaks */ function areLineBreaksRequired(node, options, first, last) { @@ -171,7 +168,7 @@ module.exports = { /** * Reports a given node if it violated this rule. - * @param {ASTNode} node - A node to check. This is an ObjectExpression, ObjectPattern, ImportDeclaration or ExportNamedDeclaration node. + * @param {ASTNode} node A node to check. This is an ObjectExpression, ObjectPattern, ImportDeclaration or ExportNamedDeclaration node. * @returns {void} */ function check(node) { diff --git a/lib/rules/object-curly-spacing.js b/lib/rules/object-curly-spacing.js index 48a7dd953b7..53ddaaa24ad 100644 --- a/lib/rules/object-curly-spacing.js +++ b/lib/rules/object-curly-spacing.js @@ -50,7 +50,7 @@ module.exports = { * Determines whether an option is set, relative to the spacing option. * If spaced is "always", then check whether option is set to false. * If spaced is "never", then check whether option is set to true. - * @param {Object} option - The option to exclude. + * @param {Object} option The option to exclude. * @returns {boolean} Whether or not the property is excluded. */ function isOptionSet(option) { @@ -69,8 +69,8 @@ module.exports = { /** * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoBeginningSpace(node, token) { @@ -91,8 +91,8 @@ module.exports = { /** * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoEndingSpace(node, token) { @@ -113,8 +113,8 @@ module.exports = { /** * Reports that there should be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredBeginningSpace(node, token) { @@ -133,8 +133,8 @@ module.exports = { /** * Reports that there should be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredEndingSpace(node, token) { @@ -201,8 +201,7 @@ module.exports = { * Because the last token of object patterns might be a type annotation, * this traverses tokens preceded by the last property, then returns the * first '}' token. - * - * @param {ASTNode} node - The node to get. This node is an + * @param {ASTNode} node The node to get. This node is an * ObjectExpression or an ObjectPattern. And this node has one or * more properties. * @returns {Token} '}' token. @@ -215,7 +214,7 @@ module.exports = { /** * Reports a given object node if spacing in curly braces is invalid. - * @param {ASTNode} node - An ObjectExpression or ObjectPattern node to check. + * @param {ASTNode} node An ObjectExpression or ObjectPattern node to check. * @returns {void} */ function checkForObject(node) { @@ -233,7 +232,7 @@ module.exports = { /** * Reports a given import node if spacing in curly braces is invalid. - * @param {ASTNode} node - An ImportDeclaration node to check. + * @param {ASTNode} node An ImportDeclaration node to check. * @returns {void} */ function checkForImport(node) { @@ -261,7 +260,7 @@ module.exports = { /** * Reports a given export node if spacing in curly braces is invalid. - * @param {ASTNode} node - An ExportNamedDeclaration node to check. + * @param {ASTNode} node An ExportNamedDeclaration node to check. * @returns {void} */ function checkForExport(node) { diff --git a/lib/rules/object-shorthand.js b/lib/rules/object-shorthand.js index df302b5e872..d4afd09c5a5 100644 --- a/lib/rules/object-shorthand.js +++ b/lib/rules/object-shorthand.js @@ -147,7 +147,7 @@ module.exports = { /** * Checks whether a node is a string literal. - * @param {ASTNode} node - Any AST node. + * @param {ASTNode} node Any AST node. * @returns {boolean} `true` if it is a string literal. */ function isStringLiteral(node) { diff --git a/lib/rules/one-var-declaration-per-line.js b/lib/rules/one-var-declaration-per-line.js index e7e40d66c0c..b64656eefed 100644 --- a/lib/rules/one-var-declaration-per-line.js +++ b/lib/rules/one-var-declaration-per-line.js @@ -41,7 +41,7 @@ module.exports = { /** * Determine if provided keyword is a variant of for specifiers * @private - * @param {string} keyword - keyword to test + * @param {string} keyword keyword to test * @returns {boolean} True if `keyword` is a variant of for specifier */ function isForTypeSpecifier(keyword) { @@ -51,7 +51,7 @@ module.exports = { /** * Checks newlines around variable declarations. * @private - * @param {ASTNode} node - `VariableDeclaration` node to test + * @param {ASTNode} node `VariableDeclaration` node to test * @returns {void} */ function checkForNewLine(node) { diff --git a/lib/rules/padded-blocks.js b/lib/rules/padded-blocks.js index d5bd5499c6e..dafa88115ed 100644 --- a/lib/rules/padded-blocks.js +++ b/lib/rules/padded-blocks.js @@ -97,7 +97,7 @@ module.exports = { /** * Gets the open brace token from a given node. - * @param {ASTNode} node - A BlockStatement or SwitchStatement node from which to get the open brace. + * @param {ASTNode} node A BlockStatement or SwitchStatement node from which to get the open brace. * @returns {Token} The token of the open brace. */ function getOpenBrace(node) { diff --git a/lib/rules/padding-line-between-statements.js b/lib/rules/padding-line-between-statements.js index d98cb1f247f..350a9dbf2ab 100644 --- a/lib/rules/padding-line-between-statements.js +++ b/lib/rules/padding-line-between-statements.js @@ -25,7 +25,6 @@ const CJS_IMPORT = /^require\(/u; /** * Creates tester which check if a node starts with specific keyword. - * * @param {string} keyword The keyword to test. * @returns {Object} the created tester. * @private @@ -39,7 +38,6 @@ function newKeywordTester(keyword) { /** * Creates tester which check if a node starts with specific keyword and spans a single line. - * * @param {string} keyword The keyword to test. * @returns {Object} the created tester. * @private @@ -54,7 +52,6 @@ function newSinglelineKeywordTester(keyword) { /** * Creates tester which check if a node starts with specific keyword and spans multiple lines. - * * @param {string} keyword The keyword to test. * @returns {Object} the created tester. * @private @@ -69,7 +66,6 @@ function newMultilineKeywordTester(keyword) { /** * Creates tester which check if a node is specific type. - * * @param {string} type The node type to test. * @returns {Object} the created tester. * @private @@ -83,7 +79,6 @@ function newNodeTypeTester(type) { /** * Checks the given node is an expression statement of IIFE. - * * @param {ASTNode} node The node to check. * @returns {boolean} `true` if the node is an expression statement of IIFE. * @private @@ -103,7 +98,6 @@ function isIIFEStatement(node) { /** * Checks whether the given node is a block-like statement. * This checks the last token of the node is the closing brace of a block. - * * @param {SourceCode} sourceCode The source code to get tokens. * @param {ASTNode} node The node to check. * @returns {boolean} `true` if the node is a block-like statement. @@ -187,7 +181,6 @@ function isDirectivePrologue(node, sourceCode) { * * foo() * ;[1, 2, 3].forEach(bar) - * * @param {SourceCode} sourceCode The source code to get tokens. * @param {ASTNode} node The node to get. * @returns {Token} The actual last token. @@ -224,7 +217,6 @@ function replacerToRemovePaddingLines(_, trailingSpaces, indentSpaces) { /** * Check and report statements for `any` configuration. * It does nothing. - * * @returns {void} * @private */ @@ -236,7 +228,6 @@ function verifyForAny() { * This autofix removes blank lines between the given 2 statements. * However, if comments exist between 2 blank lines, it does not remove those * blank lines automatically. - * * @param {RuleContext} context The rule context to report. * @param {ASTNode} _ Unused. The previous node to check. * @param {ASTNode} nextNode The next node to check. @@ -276,7 +267,6 @@ function verifyForNever(context, _, nextNode, paddingLines) { * This autofix inserts a blank line between the given 2 statements. * If the `prevNode` has trailing comments, it inserts a blank line after the * trailing comments. - * * @param {RuleContext} context The rule context to report. * @param {ASTNode} prevNode The previous node to check. * @param {ASTNode} nextNode The next node to check. @@ -318,7 +308,6 @@ function verifyForAlways(context, prevNode, nextNode, paddingLines) { * * // comment. * bar(); - * * @param {Token} token The token to check. * @returns {boolean} `true` if the token is not a trailing comment. * @private @@ -511,7 +500,6 @@ module.exports = { /** * Checks whether the given node matches the given type. - * * @param {ASTNode} node The statement node to check. * @param {string|string[]} type The statement type to check. * @returns {boolean} `true` if the statement node matched the type. @@ -531,7 +519,6 @@ module.exports = { /** * Finds the last matched configure from configureList. - * * @param {ASTNode} prevNode The previous statement to match. * @param {ASTNode} nextNode The current statement to match. * @returns {Object} The tester of the last matched configure. @@ -554,7 +541,6 @@ module.exports = { /** * Gets padding line sequences between the given 2 statements. * Comments are separators of the padding line sequences. - * * @param {ASTNode} prevNode The previous statement to count. * @param {ASTNode} nextNode The current statement to count. * @returns {Array} The array of token pairs. @@ -584,7 +570,6 @@ module.exports = { /** * Verify padding lines between the given node and the previous node. - * * @param {ASTNode} node The node to verify. * @returns {void} * @private @@ -616,7 +601,6 @@ module.exports = { /** * Verify padding lines between the given node and the previous node. * Then process to enter to new scope. - * * @param {ASTNode} node The node to verify. * @returns {void} * @private diff --git a/lib/rules/prefer-arrow-callback.js b/lib/rules/prefer-arrow-callback.js index a0957399ea5..08126e5b1a5 100644 --- a/lib/rules/prefer-arrow-callback.js +++ b/lib/rules/prefer-arrow-callback.js @@ -11,7 +11,7 @@ /** * Checks whether or not a given variable is a function name. - * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Variable} variable A variable to check. * @returns {boolean} `true` if the variable is a function name. */ function isFunctionName(variable) { @@ -20,9 +20,9 @@ function isFunctionName(variable) { /** * Checks whether or not a given MetaProperty node equals to a given value. - * @param {ASTNode} node - A MetaProperty node to check. - * @param {string} metaName - The name of `MetaProperty.meta`. - * @param {string} propertyName - The name of `MetaProperty.property`. + * @param {ASTNode} node A MetaProperty node to check. + * @param {string} metaName The name of `MetaProperty.meta`. + * @param {string} propertyName The name of `MetaProperty.property`. * @returns {boolean} `true` if the node is the specific value. */ function checkMetaProperty(node, metaName, propertyName) { @@ -31,7 +31,7 @@ function checkMetaProperty(node, metaName, propertyName) { /** * Gets the variable object of `arguments` which is defined implicitly. - * @param {eslint-scope.Scope} scope - A scope to get. + * @param {eslint-scope.Scope} scope A scope to get. * @returns {eslint-scope.Variable} The found variable object. */ function getVariableOfArguments(scope) { @@ -57,7 +57,7 @@ function getVariableOfArguments(scope) { /** * Checkes whether or not a given node is a callback. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {Object} * {boolean} retv.isCallback - `true` if the node is a callback. * {boolean} retv.isLexicalThis - `true` if the node is with `.bind(this)`. diff --git a/lib/rules/prefer-const.js b/lib/rules/prefer-const.js index 854da310e4b..87f83892126 100644 --- a/lib/rules/prefer-const.js +++ b/lib/rules/prefer-const.js @@ -17,8 +17,7 @@ const DESTRUCTURING_HOST_TYPE = /^(?:VariableDeclarator|AssignmentExpression)$/u /** * Checks whether a given node is located at `ForStatement.init` or not. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is located at `ForStatement.init`. */ function isInitOfForStatement(node) { @@ -27,8 +26,7 @@ function isInitOfForStatement(node) { /** * Checks whether a given Identifier node becomes a VariableDeclaration or not. - * - * @param {ASTNode} identifier - An Identifier node to check. + * @param {ASTNode} identifier An Identifier node to check. * @returns {boolean} `true` if the node can become a VariableDeclaration. */ function canBecomeVariableDeclaration(identifier) { @@ -51,9 +49,8 @@ function canBecomeVariableDeclaration(identifier) { /** * Checks if an property or element is from outer scope or function parameters * in destructing pattern. - * - * @param {string} name - A variable name to be checked. - * @param {eslint-scope.Scope} initScope - A scope to start find. + * @param {string} name A variable name to be checked. + * @param {eslint-scope.Scope} initScope A scope to start find. * @returns {boolean} Indicates if the variable is from outer scope or function parameters. */ function isOuterVariableInDestructing(name, initScope) { @@ -76,8 +73,7 @@ function isOuterVariableInDestructing(name, initScope) { * belongs to. * This is used to detect a mix of reassigned and never reassigned in a * destructuring. - * - * @param {eslint-scope.Reference} reference - A reference to get. + * @param {eslint-scope.Reference} reference A reference to get. * @returns {ASTNode|null} A VariableDeclarator/AssignmentExpression node or * null. */ @@ -162,9 +158,8 @@ function hasMemberExpressionAssignment(node) { * `/*exported foo` directive comment makes such variables. This rule does not * warn such variables because this rule cannot distinguish whether the * exported variables are reassigned or not. - * - * @param {eslint-scope.Variable} variable - A variable to get. - * @param {boolean} ignoreReadBeforeAssign - + * @param {eslint-scope.Variable} variable A variable to get. + * @param {boolean} ignoreReadBeforeAssign * The value of `ignoreReadBeforeAssign` option. * @returns {ASTNode|null} * An Identifier node if the variable should change to const. @@ -262,9 +257,8 @@ function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) { * reference of given variables belongs to. * This is used to detect a mix of reassigned and never reassigned in a * destructuring. - * - * @param {eslint-scope.Variable[]} variables - Variables to group by destructuring. - * @param {boolean} ignoreReadBeforeAssign - + * @param {eslint-scope.Variable[]} variables Variables to group by destructuring. + * @param {boolean} ignoreReadBeforeAssign * The value of `ignoreReadBeforeAssign` option. * @returns {Map} Grouped identifier nodes. */ @@ -308,10 +302,9 @@ function groupByDestructuring(variables, ignoreReadBeforeAssign) { /** * Finds the nearest parent of node with a given type. - * - * @param {ASTNode} node – The node to search from. - * @param {string} type – The type field of the parent node. - * @param {Function} shouldStop – a predicate that returns true if the traversal should stop, and false otherwise. + * @param {ASTNode} node The node to search from. + * @param {string} type The type field of the parent node. + * @param {Function} shouldStop A predicate that returns true if the traversal should stop, and false otherwise. * @returns {ASTNode} The closest ancestor with the specified type; null if no such ancestor exists. */ function findUp(node, type, shouldStop) { @@ -374,8 +367,7 @@ module.exports = { * nullable. In simple declaration or assignment cases, the length of * the array is 1. In destructuring cases, the length of the array can * be 2 or more. - * - * @param {(eslint-scope.Reference|null)[]} nodes - + * @param {(eslint-scope.Reference|null)[]} nodes * References which are grouped by destructuring to report. * @returns {void} */ diff --git a/lib/rules/prefer-destructuring.js b/lib/rules/prefer-destructuring.js index dec93d51f2d..6fc9128b9bc 100644 --- a/lib/rules/prefer-destructuring.js +++ b/lib/rules/prefer-destructuring.js @@ -119,7 +119,6 @@ module.exports = { * * This is used to differentiate array index access from object property * access. - * * @param {ASTNode} node the node to evaluate * @returns {boolean} whether or not the node is an integer */ @@ -129,7 +128,6 @@ module.exports = { /** * Report that the given node should use destructuring - * * @param {ASTNode} reportNode the node to report * @param {string} type the type of destructuring that should have been done * @param {Function|null} fix the fix function or null to pass to context.report @@ -153,7 +151,6 @@ module.exports = { * Assignment expression is not fixed. * Array destructuring is not fixed. * Renamed property is not fixed. - * * @param {ASTNode} node the the node to evaluate * @returns {boolean} whether or not the node should be fixed */ @@ -168,7 +165,6 @@ module.exports = { * Fix a node into object destructuring. * This function only handles the simplest case of object destructuring, * see {@link shouldFix}. - * * @param {SourceCodeFixer} fixer the fixer object * @param {ASTNode} node the node to be fixed. * @returns {Object} a fix for the node @@ -189,7 +185,6 @@ module.exports = { * * Pulled out into a separate method so that VariableDeclarators and * AssignmentExpressions can share the same verification logic. - * * @param {ASTNode} leftNode the left-hand side of the assignment * @param {ASTNode} rightNode the right-hand side of the assignment * @param {ASTNode} reportNode the node to report the error on @@ -231,7 +226,6 @@ module.exports = { /** * Check if a given variable declarator is coming from an property access * that should be using destructuring instead - * * @param {ASTNode} node the variable declarator to check * @returns {void} */ @@ -252,7 +246,6 @@ module.exports = { /** * Run the `prefer-destructuring` check on an AssignmentExpression - * * @param {ASTNode} node the AssignmentExpression node * @returns {void} */ diff --git a/lib/rules/prefer-named-capture-group.js b/lib/rules/prefer-named-capture-group.js index 7f4a9c3c8e3..c8af043c1b5 100644 --- a/lib/rules/prefer-named-capture-group.js +++ b/lib/rules/prefer-named-capture-group.js @@ -49,7 +49,6 @@ module.exports = { /** * Function to check regular expression. - * * @param {string} pattern The regular expression pattern to be check. * @param {ASTNode} node AST node which contains regular expression. * @param {boolean} uFlag Flag indicates whether unicode mode is enabled or not. diff --git a/lib/rules/prefer-object-spread.js b/lib/rules/prefer-object-spread.js index 214f950c642..bbcd88bee3d 100644 --- a/lib/rules/prefer-object-spread.js +++ b/lib/rules/prefer-object-spread.js @@ -18,7 +18,7 @@ const ANY_SPACE = /\s/u; /** * Helper that checks if the Object.assign call has array spread - * @param {ASTNode} node - The node that the rule warns on + * @param {ASTNode} node The node that the rule warns on * @returns {boolean} - Returns true if the Object.assign call has array spread */ function hasArraySpread(node) { @@ -28,8 +28,8 @@ function hasArraySpread(node) { /** * Helper that checks if the node needs parentheses to be valid JS. * The default is to wrap the node in parentheses to avoid parsing errors. - * @param {ASTNode} node - The node that the rule warns on - * @param {Object} sourceCode - in context sourcecode object + * @param {ASTNode} node The node that the rule warns on + * @param {Object} sourceCode in context sourcecode object * @returns {boolean} - Returns true if the node needs parentheses */ function needsParens(node, sourceCode) { @@ -51,8 +51,8 @@ function needsParens(node, sourceCode) { /** * Determines if an argument needs parentheses. The default is to not add parens. - * @param {ASTNode} node - The node to be checked. - * @param {Object} sourceCode - in context sourcecode object + * @param {ASTNode} node The node to be checked. + * @param {Object} sourceCode in context sourcecode object * @returns {boolean} True if the node needs parentheses */ function argNeedsParens(node, sourceCode) { @@ -142,8 +142,8 @@ function getEndWithSpaces(token, sourceCode) { /** * Autofixes the Object.assign call to use an object spread instead. - * @param {ASTNode|null} node - The node that the rule warns on, i.e. the Object.assign call - * @param {string} sourceCode - sourceCode of the Object.assign call + * @param {ASTNode|null} node The node that the rule warns on, i.e. the Object.assign call + * @param {string} sourceCode sourceCode of the Object.assign call * @returns {Function} autofixer - replaces the Object.assign with a spread object. */ function defineFixer(node, sourceCode) { diff --git a/lib/rules/prefer-rest-params.js b/lib/rules/prefer-rest-params.js index 95a562c4a2f..3a28584f6bc 100644 --- a/lib/rules/prefer-rest-params.js +++ b/lib/rules/prefer-rest-params.js @@ -11,7 +11,7 @@ /** * Gets the variable object of `arguments` which is defined implicitly. - * @param {eslint-scope.Scope} scope - A scope to get. + * @param {eslint-scope.Scope} scope A scope to get. * @returns {eslint-scope.Variable} The found variable object. */ function getVariableOfArguments(scope) { @@ -41,8 +41,7 @@ function getVariableOfArguments(scope) { * - arguments[i] .... true // computed member access * - arguments[0] .... true // computed member access * - arguments.length .... false // normal member access - * - * @param {eslint-scope.Reference} reference - The reference to check. + * @param {eslint-scope.Reference} reference The reference to check. * @returns {boolean} `true` if the reference is not normal member access. */ function isNotNormalMemberAccess(reference) { @@ -78,8 +77,7 @@ module.exports = { /** * Reports a given reference. - * - * @param {eslint-scope.Reference} reference - A reference to report. + * @param {eslint-scope.Reference} reference A reference to report. * @returns {void} */ function report(reference) { @@ -92,7 +90,6 @@ module.exports = { /** * Reports references of the implicit `arguments` variable if exist. - * * @returns {void} */ function checkForArguments() { diff --git a/lib/rules/prefer-spread.js b/lib/rules/prefer-spread.js index 9368c972c08..14c05bd9710 100644 --- a/lib/rules/prefer-spread.js +++ b/lib/rules/prefer-spread.js @@ -13,7 +13,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a node is a `.apply()` for variadic. - * @param {ASTNode} node - A CallExpression node to check. + * @param {ASTNode} node A CallExpression node to check. * @returns {boolean} Whether or not the node is a `.apply()` for variadic. */ function isVariadicApplyCalling(node) { @@ -31,9 +31,9 @@ function isVariadicApplyCalling(node) { /** * Checks whether or not `thisArg` is not changed by `.apply()`. - * @param {ASTNode|null} expectedThis - The node that is the owner of the applied function. - * @param {ASTNode} thisArg - The node that is given to the first argument of the `.apply()`. - * @param {RuleContext} context - The ESLint rule context object. + * @param {ASTNode|null} expectedThis The node that is the owner of the applied function. + * @param {ASTNode} thisArg The node that is given to the first argument of the `.apply()`. + * @param {RuleContext} context The ESLint rule context object. * @returns {boolean} Whether or not `thisArg` is not changed by `.apply()`. */ function isValidThisArg(expectedThis, thisArg, context) { diff --git a/lib/rules/prefer-template.js b/lib/rules/prefer-template.js index a2507d452c6..fa6e58d9721 100644 --- a/lib/rules/prefer-template.js +++ b/lib/rules/prefer-template.js @@ -17,7 +17,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a given node is a concatenation. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a concatenation. */ function isConcatenation(node) { @@ -26,7 +26,7 @@ function isConcatenation(node) { /** * Gets the top binary expression node for concatenation in parents of a given node. - * @param {ASTNode} node - A node to get. + * @param {ASTNode} node A node to get. * @returns {ASTNode} the top binary expression node in parents of a given node. */ function getTopConcatBinaryExpression(node) { @@ -70,7 +70,7 @@ function hasOctalEscapeSequence(node) { /** * Checks whether or not a given binary expression has string literals. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node has string literals. */ function hasStringLiteral(node) { @@ -84,7 +84,7 @@ function hasStringLiteral(node) { /** * Checks whether or not a given binary expression has non string literals. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node has non string literals. */ function hasNonStringLiteral(node) { @@ -242,8 +242,7 @@ module.exports = { /** * Reports if a given node is string concatenation with non string literals. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function checkForStringConcat(node) { diff --git a/lib/rules/quote-props.js b/lib/rules/quote-props.js index 79493b2499e..ab09b8fa938 100644 --- a/lib/rules/quote-props.js +++ b/lib/rules/quote-props.js @@ -85,7 +85,7 @@ module.exports = { /** * Checks whether a certain string constitutes an ES3 token - * @param {string} tokenStr - The string to be checked. + * @param {string} tokenStr The string to be checked. * @returns {boolean} `true` if it is an ES3 token. */ function isKeyword(tokenStr) { diff --git a/lib/rules/quotes.js b/lib/rules/quotes.js index 5f260e55f0a..f78d1129425 100644 --- a/lib/rules/quotes.js +++ b/lib/rules/quotes.js @@ -41,7 +41,7 @@ const UNESCAPED_LINEBREAK_PATTERN = new RegExp(String.raw`(^|[^\\])(\\\\)*[${Arr * escaping and unescaping as necessary. * Only escaping of the minimal set of characters is changed. * Note: escaping of newlines when switching from backtick to other quotes is not handled. - * @param {string} str - A string to convert. + * @param {string} str A string to convert. * @returns {string} The string with changed quotes. * @private */ @@ -143,7 +143,6 @@ module.exports = { * * In both cases, inside of the braces is handled as normal JavaScript. * The braces are `JSXExpressionContainer` nodes. - * * @param {ASTNode} node The Literal node to check. * @returns {boolean} True if the node is a part of JSX, false if not. * @private @@ -155,7 +154,7 @@ module.exports = { /** * Checks whether or not a given node is a directive. * The directive is a `ExpressionStatement` which has only a string literal. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is a directive. * @private */ @@ -170,7 +169,7 @@ module.exports = { /** * Checks whether or not a given node is a part of directive prologues. * See also: http://www.ecma-international.org/ecma-262/6.0/#sec-directive-prologues-and-the-use-strict-directive - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is a part of directive prologues. * @private */ @@ -198,7 +197,7 @@ module.exports = { /** * Checks whether or not a given node is allowed as non backtick. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is allowed as non backtick. * @private */ @@ -230,7 +229,7 @@ module.exports = { /** * Checks whether or not a given TemplateLiteral node is actually using any of the special features provided by template literal strings. - * @param {ASTNode} node - A TemplateLiteral node to check. + * @param {ASTNode} node A TemplateLiteral node to check. * @returns {boolean} Whether or not the TemplateLiteral node is using any of the special features provided by template literal strings. * @private */ diff --git a/lib/rules/radix.js b/lib/rules/radix.js index b7b296f4515..ed3c5cb66b8 100644 --- a/lib/rules/radix.js +++ b/lib/rules/radix.js @@ -20,8 +20,7 @@ const MODE_ALWAYS = "always", /** * Checks whether a given variable is shadowed or not. - * - * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Variable} variable A variable to check. * @returns {boolean} `true` if the variable is shadowed. */ function isShadowed(variable) { @@ -30,8 +29,7 @@ function isShadowed(variable) { /** * Checks whether a given node is a MemberExpression of `parseInt` method or not. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a MemberExpression of `parseInt` * method. */ @@ -51,8 +49,7 @@ function isParseIntMethod(node) { * * - A literal except numbers. * - undefined. - * - * @param {ASTNode} radix - A node of radix to check. + * @param {ASTNode} radix A node of radix to check. * @returns {boolean} `true` if the node is valid. */ function isValidRadix(radix) { @@ -64,8 +61,7 @@ function isValidRadix(radix) { /** * Checks whether a given node is a default value of radix or not. - * - * @param {ASTNode} radix - A node of radix to check. + * @param {ASTNode} radix A node of radix to check. * @returns {boolean} `true` if the node is the literal node of `10`. */ function isDefaultRadix(radix) { @@ -100,8 +96,7 @@ module.exports = { /** * Checks the arguments of a given CallExpression node and reports it if it * offends this rule. - * - * @param {ASTNode} node - A CallExpression node to check. + * @param {ASTNode} node A CallExpression node to check. * @returns {void} */ function checkArguments(node) { diff --git a/lib/rules/require-await.js b/lib/rules/require-await.js index 298cb951de3..0aa6fce7e19 100644 --- a/lib/rules/require-await.js +++ b/lib/rules/require-await.js @@ -17,8 +17,7 @@ const astUtils = require("./utils/ast-utils"); /** * Capitalize the 1st letter of the given text. - * - * @param {string} text - The text to capitalize. + * @param {string} text The text to capitalize. * @returns {string} The text that the 1st letter was capitalized. */ function capitalizeFirstLetter(text) { @@ -49,7 +48,6 @@ module.exports = { /** * Push the scope info object to the stack. - * * @returns {void} */ function enterFunction() { @@ -62,8 +60,7 @@ module.exports = { /** * Pop the top scope info object from the stack. * Also, it reports the function if needed. - * - * @param {ASTNode} node - The node to report. + * @param {ASTNode} node The node to report. * @returns {void} */ function exitFunction(node) { diff --git a/lib/rules/require-yield.js b/lib/rules/require-yield.js index 7bb7cf9a872..dbfd759948a 100644 --- a/lib/rules/require-yield.js +++ b/lib/rules/require-yield.js @@ -28,7 +28,7 @@ module.exports = { /** * If the node is a generator function, start counting `yield` keywords. - * @param {Node} node - A function node to check. + * @param {Node} node A function node to check. * @returns {void} */ function beginChecking(node) { @@ -40,7 +40,7 @@ module.exports = { /** * If the node is a generator function, end counting `yield` keywords, then * reports result. - * @param {Node} node - A function node to check. + * @param {Node} node A function node to check. * @returns {void} */ function endChecking(node) { diff --git a/lib/rules/rest-spread-spacing.js b/lib/rules/rest-spread-spacing.js index 04539395ef4..cd740fd3a99 100644 --- a/lib/rules/rest-spread-spacing.js +++ b/lib/rules/rest-spread-spacing.js @@ -39,7 +39,7 @@ module.exports = { /** * Checks whitespace between rest/spread operators and their expressions - * @param {ASTNode} node - The node to check + * @param {ASTNode} node The node to check * @returns {void} */ function checkWhiteSpace(node) { diff --git a/lib/rules/sort-imports.js b/lib/rules/sort-imports.js index 05e643ca061..3b7f1d01034 100644 --- a/lib/rules/sort-imports.js +++ b/lib/rules/sort-imports.js @@ -70,8 +70,7 @@ module.exports = { * import * as myModule from "my-module.js" --> all * import {myMember} from "my-module.js" --> single * import {foo, bar} from "my-module.js" --> multiple - * - * @param {ASTNode} node - the ImportDeclaration node. + * @param {ASTNode} node the ImportDeclaration node. * @returns {string} used member parameter style, ["all", "multiple", "single"] */ function usedMemberSyntax(node) { @@ -90,7 +89,7 @@ module.exports = { /** * Gets the group by member parameter index for given declaration. - * @param {ASTNode} node - the ImportDeclaration node. + * @param {ASTNode} node the ImportDeclaration node. * @returns {number} the declaration group by member index. */ function getMemberParameterGroupIndex(node) { @@ -99,7 +98,7 @@ module.exports = { /** * Gets the local name of the first imported module. - * @param {ASTNode} node - the ImportDeclaration node. + * @param {ASTNode} node the ImportDeclaration node. * @returns {?string} the local name of the first imported module. */ function getFirstLocalMemberName(node) { diff --git a/lib/rules/sort-keys.js b/lib/rules/sort-keys.js index c314d4a6361..a5ce445f71a 100644 --- a/lib/rules/sort-keys.js +++ b/lib/rules/sort-keys.js @@ -23,8 +23,7 @@ const astUtils = require("./utils/ast-utils"), * whether it's a computed property or not. * - If the property has a static name, this returns the static name. * - Otherwise, this returns null. - * - * @param {ASTNode} node - The `Property` node to get. + * @param {ASTNode} node The `Property` node to get. * @returns {string|null} The property name or null. * @private */ @@ -43,7 +42,6 @@ function getPropertyName(node) { * * Postfix `I` is meant insensitive. * Postfix `N` is meant natual. - * * @private */ const isValidOrders = { diff --git a/lib/rules/space-before-blocks.js b/lib/rules/space-before-blocks.js index 527366aaccf..038e88db521 100644 --- a/lib/rules/space-before-blocks.js +++ b/lib/rules/space-before-blocks.js @@ -79,8 +79,7 @@ module.exports = { /** * Checks whether or not a given token is an arrow operator (=>) or a keyword * in order to avoid to conflict with `arrow-spacing` and `keyword-spacing`. - * - * @param {Token} token - A token to check. + * @param {Token} token A token to check. * @returns {boolean} `true` if the token is an arrow operator. */ function isConflicted(token) { diff --git a/lib/rules/space-infix-ops.js b/lib/rules/space-infix-ops.js index 8d1d172c669..b2fbe47b476 100644 --- a/lib/rules/space-infix-ops.js +++ b/lib/rules/space-infix-ops.js @@ -41,9 +41,9 @@ module.exports = { /** * Returns the first token which violates the rule - * @param {ASTNode} left - The left node of the main node - * @param {ASTNode} right - The right node of the main node - * @param {string} op - The operator of the main node + * @param {ASTNode} left The left node of the main node + * @param {ASTNode} right The right node of the main node + * @param {string} op The operator of the main node * @returns {Object} The violator token or null * @private */ @@ -61,8 +61,8 @@ module.exports = { /** * Reports an AST node as a rule violation - * @param {ASTNode} mainNode - The node to report - * @param {Object} culpritToken - The token which has a problem + * @param {ASTNode} mainNode The node to report + * @param {Object} culpritToken The token which has a problem * @returns {void} * @private */ diff --git a/lib/rules/spaced-comment.js b/lib/rules/spaced-comment.js index 731bd212e3e..958bb2c6444 100644 --- a/lib/rules/spaced-comment.js +++ b/lib/rules/spaced-comment.js @@ -13,7 +13,7 @@ const astUtils = require("./utils/ast-utils"); /** * Escapes the control characters of a given string. - * @param {string} s - A string to escape. + * @param {string} s A string to escape. * @returns {string} An escaped string. */ function escape(s) { @@ -23,7 +23,7 @@ function escape(s) { /** * Escapes the control characters of a given string. * And adds a repeat flag. - * @param {string} s - A string to escape. + * @param {string} s A string to escape. * @returns {string} An escaped string. */ function escapeAndRepeat(s) { @@ -33,7 +33,7 @@ function escapeAndRepeat(s) { /** * Parses `markers` option. * If markers don't include `"*"`, this adds `"*"` to allow JSDoc comments. - * @param {string[]} [markers] - A marker list. + * @param {string[]} [markers] A marker list. * @returns {string[]} A marker list. */ function parseMarkersOption(markers) { @@ -51,8 +51,7 @@ function parseMarkersOption(markers) { * Generated pattern: * * 1. A space or an exception pattern sequence. - * - * @param {string[]} exceptions - An exception pattern list. + * @param {string[]} exceptions An exception pattern list. * @returns {string} A regular expression string for exceptions. */ function createExceptionsPattern(exceptions) { @@ -97,9 +96,8 @@ function createExceptionsPattern(exceptions) { * * 1. First, a marker or nothing. * 2. Next, a space or an exception pattern sequence. - * - * @param {string[]} markers - A marker list. - * @param {string[]} exceptions - An exception pattern list. + * @param {string[]} markers A marker list. + * @param {string[]} exceptions An exception pattern list. * @returns {RegExp} A RegExp object for the beginning of a comment in `always` mode. */ function createAlwaysStylePattern(markers, exceptions) { @@ -135,8 +133,7 @@ function createAlwaysStylePattern(markers, exceptions) { * * 1. First, a marker or nothing (captured). * 2. Next, a space or a tab. - * - * @param {string[]} markers - A marker list. + * @param {string[]} markers A marker list. * @returns {RegExp} A RegExp object for `never` mode. */ function createNeverStylePattern(markers) { @@ -260,10 +257,10 @@ module.exports = { /** * Reports a beginning spacing error with an appropriate message. - * @param {ASTNode} node - A comment node to check. - * @param {string} message - An error message to report. - * @param {Array} match - An array of match results for markers. - * @param {string} refChar - Character used for reference in the error message. + * @param {ASTNode} node A comment node to check. + * @param {string} message An error message to report. + * @param {Array} match An array of match results for markers. + * @param {string} refChar Character used for reference in the error message. * @returns {void} */ function reportBegin(node, message, match, refChar) { @@ -293,9 +290,9 @@ module.exports = { /** * Reports an ending spacing error with an appropriate message. - * @param {ASTNode} node - A comment node to check. - * @param {string} message - An error message to report. - * @param {string} match - An array of the matched whitespace characters. + * @param {ASTNode} node A comment node to check. + * @param {string} message An error message to report. + * @param {string} match An array of the matched whitespace characters. * @returns {void} */ function reportEnd(node, message, match) { @@ -317,7 +314,7 @@ module.exports = { /** * Reports a given comment if it's invalid. - * @param {ASTNode} node - a comment node to check. + * @param {ASTNode} node a comment node to check. * @returns {void} */ function checkCommentForSpace(node) { diff --git a/lib/rules/strict.js b/lib/rules/strict.js index b93a6a1a17a..b0d6cf9172a 100644 --- a/lib/rules/strict.js +++ b/lib/rules/strict.js @@ -43,8 +43,7 @@ function getUseStrictDirectives(statements) { /** * Checks whether a given parameter is a simple parameter. - * - * @param {ASTNode} node - A pattern node to check. + * @param {ASTNode} node A pattern node to check. * @returns {boolean} `true` if the node is an Identifier node. */ function isSimpleParameter(node) { @@ -53,8 +52,7 @@ function isSimpleParameter(node) { /** * Checks whether a given parameter list is a simple parameter list. - * - * @param {ASTNode[]} params - A parameter list to check. + * @param {ASTNode[]} params A parameter list to check. * @returns {boolean} `true` if the every parameter is an Identifier node. */ function isSimpleParameterList(params) { diff --git a/lib/rules/symbol-description.js b/lib/rules/symbol-description.js index 3fd5a359671..155cea4dc0b 100644 --- a/lib/rules/symbol-description.js +++ b/lib/rules/symbol-description.js @@ -38,8 +38,7 @@ module.exports = { /** * Reports if node does not conform the rule in case rule is set to * report missing description - * - * @param {ASTNode} node - A CallExpression node to check. + * @param {ASTNode} node A CallExpression node to check. * @returns {void} */ function checkArgument(node) { diff --git a/lib/rules/template-curly-spacing.js b/lib/rules/template-curly-spacing.js index 2794b45cf78..07da6a39b0e 100644 --- a/lib/rules/template-curly-spacing.js +++ b/lib/rules/template-curly-spacing.js @@ -53,7 +53,7 @@ module.exports = { /** * Checks spacing before `}` of a given token. - * @param {Token} token - A token to check. This is a Template token. + * @param {Token} token A token to check. This is a Template token. * @returns {void} */ function checkSpacingBefore(token) { @@ -82,7 +82,7 @@ module.exports = { /** * Checks spacing after `${` of a given token. - * @param {Token} token - A token to check. This is a Template token. + * @param {Token} token A token to check. This is a Template token. * @returns {void} */ function checkSpacingAfter(token) { diff --git a/lib/rules/utils/ast-utils.js b/lib/rules/utils/ast-utils.js index f0b926e3298..17e056c240c 100644 --- a/lib/rules/utils/ast-utils.js +++ b/lib/rules/utils/ast-utils.js @@ -42,9 +42,9 @@ const OCTAL_ESCAPE_PATTERN = /^(?:[^\\]|\\[^0-7]|\\0(?![0-9]))*\\(?:[1-7]|0[0-9] /** * Checks reference if is non initializer and writable. - * @param {Reference} reference - A reference to check. - * @param {int} index - The index of the reference in the references. - * @param {Reference[]} references - The array that the reference belongs to. + * @param {Reference} reference A reference to check. + * @param {int} index The index of the reference in the references. + * @param {Reference[]} references The array that the reference belongs to. * @returns {boolean} Success/Failure * @private */ @@ -68,8 +68,7 @@ function isModifyingReference(reference, index, references) { /** * Checks whether the given string starts with uppercase or not. - * - * @param {string} s - The string to check. + * @param {string} s The string to check. * @returns {boolean} `true` if the string starts with uppercase. */ function startsWithUpperCase(s) { @@ -78,7 +77,7 @@ function startsWithUpperCase(s) { /** * Checks whether or not a node is a constructor. - * @param {ASTNode} node - A function node to check. + * @param {ASTNode} node A function node to check. * @returns {boolean} Wehether or not a node is a constructor. */ function isES5Constructor(node) { @@ -87,7 +86,7 @@ function isES5Constructor(node) { /** * Finds a function node from ancestors of a node. - * @param {ASTNode} node - A start node to find. + * @param {ASTNode} node A start node to find. * @returns {Node|null} A found function node. */ function getUpperFunction(node) { @@ -106,8 +105,7 @@ function getUpperFunction(node) { * - ArrowFunctionExpression * - FunctionDeclaration * - FunctionExpression - * - * @param {ASTNode|null} node - A node to check. + * @param {ASTNode|null} node A node to check. * @returns {boolean} `true` if the node is a function node. */ function isFunction(node) { @@ -123,8 +121,7 @@ function isFunction(node) { * - ForOfStatement * - ForStatement * - WhileStatement - * - * @param {ASTNode|null} node - A node to check. + * @param {ASTNode|null} node A node to check. * @returns {boolean} `true` if the node is a loop node. */ function isLoop(node) { @@ -133,8 +130,7 @@ function isLoop(node) { /** * Checks whether the given node is in a loop or not. - * - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} `true` if the node is in a loop. */ function isInLoop(node) { @@ -149,7 +145,7 @@ function isInLoop(node) { /** * Checks whether or not a node is `null` or `undefined`. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is a `null` or `undefined`. * @public */ @@ -163,7 +159,7 @@ function isNullOrUndefined(node) { /** * Checks whether or not a node is callee. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is callee. */ function isCallee(node) { @@ -172,7 +168,7 @@ function isCallee(node) { /** * Checks whether or not a node is `Reflect.apply`. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is a `Reflect.apply`. */ function isReflectApply(node) { @@ -188,7 +184,7 @@ function isReflectApply(node) { /** * Checks whether or not a node is `Array.from`. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is a `Array.from`. */ function isArrayFromMethod(node) { @@ -204,7 +200,7 @@ function isArrayFromMethod(node) { /** * Checks whether or not a node is a method which has `thisArg`. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is a method which has `thisArg`. */ function isMethodWhichHasThisArg(node) { @@ -223,7 +219,7 @@ function isMethodWhichHasThisArg(node) { /** * Creates the negate function of the given function. - * @param {Function} f - The function to negate. + * @param {Function} f The function to negate. * @returns {Function} Negated function. */ function negate(f) { @@ -232,8 +228,8 @@ function negate(f) { /** * Checks whether or not a node has a `@this` tag in its comments. - * @param {ASTNode} node - A node to check. - * @param {SourceCode} sourceCode - A SourceCode instance to get comments. + * @param {ASTNode} node A node to check. + * @param {SourceCode} sourceCode A SourceCode instance to get comments. * @returns {boolean} Whether or not the node has a `@this` tag in its comments. */ function hasJSDocThisTag(node, sourceCode) { @@ -268,8 +264,7 @@ function isParenthesised(sourceCode, node) { /** * Checks if the given token is an arrow token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is an arrow token. */ function isArrowToken(token) { @@ -278,8 +273,7 @@ function isArrowToken(token) { /** * Checks if the given token is a comma token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a comma token. */ function isCommaToken(token) { @@ -288,8 +282,7 @@ function isCommaToken(token) { /** * Checks if the given token is a dot token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a dot token. */ function isDotToken(token) { @@ -298,8 +291,7 @@ function isDotToken(token) { /** * Checks if the given token is a semicolon token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a semicolon token. */ function isSemicolonToken(token) { @@ -308,8 +300,7 @@ function isSemicolonToken(token) { /** * Checks if the given token is a colon token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a colon token. */ function isColonToken(token) { @@ -318,8 +309,7 @@ function isColonToken(token) { /** * Checks if the given token is an opening parenthesis token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is an opening parenthesis token. */ function isOpeningParenToken(token) { @@ -328,8 +318,7 @@ function isOpeningParenToken(token) { /** * Checks if the given token is a closing parenthesis token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a closing parenthesis token. */ function isClosingParenToken(token) { @@ -338,8 +327,7 @@ function isClosingParenToken(token) { /** * Checks if the given token is an opening square bracket token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is an opening square bracket token. */ function isOpeningBracketToken(token) { @@ -348,8 +336,7 @@ function isOpeningBracketToken(token) { /** * Checks if the given token is a closing square bracket token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a closing square bracket token. */ function isClosingBracketToken(token) { @@ -358,8 +345,7 @@ function isClosingBracketToken(token) { /** * Checks if the given token is an opening brace token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is an opening brace token. */ function isOpeningBraceToken(token) { @@ -368,8 +354,7 @@ function isOpeningBraceToken(token) { /** * Checks if the given token is a closing brace token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a closing brace token. */ function isClosingBraceToken(token) { @@ -378,8 +363,7 @@ function isClosingBraceToken(token) { /** * Checks if the given token is a comment token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a comment token. */ function isCommentToken(token) { @@ -388,8 +372,7 @@ function isCommentToken(token) { /** * Checks if the given token is a keyword token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a keyword token. */ function isKeywordToken(token) { @@ -398,9 +381,8 @@ function isKeywordToken(token) { /** * Gets the `(` token of the given function node. - * - * @param {ASTNode} node - The function node to get. - * @param {SourceCode} sourceCode - The source code object to get tokens. + * @param {ASTNode} node The function node to get. + * @param {SourceCode} sourceCode The source code object to get tokens. * @returns {Token} `(` token. */ function getOpeningParenOfParams(node, sourceCode) { @@ -411,9 +393,9 @@ function getOpeningParenOfParams(node, sourceCode) { /** * Checks whether or not the tokens of two given nodes are same. - * @param {ASTNode} left - A node 1 to compare. - * @param {ASTNode} right - A node 2 to compare. - * @param {SourceCode} sourceCode - The ESLint source code object. + * @param {ASTNode} left A node 1 to compare. + * @param {ASTNode} right A node 2 to compare. + * @param {SourceCode} sourceCode The ESLint source code object. * @returns {boolean} the source code for the given node. */ function equalTokens(left, right, sourceCode) { @@ -447,8 +429,8 @@ module.exports = { /** * Determines whether two adjacent tokens are on the same line. - * @param {Object} left - The left token object. - * @param {Object} right - The right token object. + * @param {Object} left The left token object. + * @param {Object} right The right token object. * @returns {boolean} Whether or not the tokens are on the same line. * @public */ @@ -494,7 +476,7 @@ module.exports = { /** * Checks whether or not a given node is a string literal. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a string literal. */ isStringLiteral(node) { @@ -514,8 +496,7 @@ module.exports = { * - ForStatement * - SwitchStatement * - WhileStatement - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is breakable. */ isBreakableStatement(node) { @@ -524,7 +505,7 @@ module.exports = { /** * Gets references which are non initializer and writable. - * @param {Reference[]} references - An array of references. + * @param {Reference[]} references An array of references. * @returns {Reference[]} An array of only references which are non initializer and writable. * @public */ @@ -568,7 +549,6 @@ module.exports = { * consequent; * * When taking this `IfStatement`, returns `consequent;` statement. - * * @param {ASTNode} A node to get. * @returns {ASTNode|null} The trailing statement's node. */ @@ -576,9 +556,8 @@ module.exports = { /** * Finds the variable by a given name in a given scope and its upper scopes. - * - * @param {eslint-scope.Scope} initScope - A scope to start find. - * @param {string} name - A variable name to find. + * @param {eslint-scope.Scope} initScope A scope to start find. + * @param {string} name A variable name to find. * @returns {eslint-scope.Variable|null} A found variable or `null`. */ getVariableByName(initScope, name) { @@ -613,9 +592,8 @@ module.exports = { * - The location is not on an ES2015 class. * - Its `bind`/`call`/`apply` method is not called directly. * - The function is not a callback of array methods (such as `.forEach()`) if `thisArg` is given. - * - * @param {ASTNode} node - A function node to check. - * @param {SourceCode} sourceCode - A SourceCode instance to get comments. + * @param {ASTNode} node A function node to check. + * @param {SourceCode} sourceCode A SourceCode instance to get comments. * @returns {boolean} The function node is the default `this` binding. */ isDefaultThisBinding(node, sourceCode) { @@ -861,8 +839,7 @@ module.exports = { /** * Checks whether the given node is an empty block node or not. - * - * @param {ASTNode|null} node - The node to check. + * @param {ASTNode|null} node The node to check. * @returns {boolean} `true` if the node is an empty block. */ isEmptyBlock(node) { @@ -871,8 +848,7 @@ module.exports = { /** * Checks whether the given node is an empty function node or not. - * - * @param {ASTNode|null} node - The node to check. + * @param {ASTNode|null} node The node to check. * @returns {boolean} `true` if the node is an empty function. */ isEmptyFunction(node) { @@ -906,8 +882,7 @@ module.exports = { * let a = {["a" + "b"]: 1} // => null * let a = {[tag`b`]: 1} // => null * let a = {[`${b}`]: 1} // => null - * - * @param {ASTNode} node - The node to get. + * @param {ASTNode} node The node to get. * @returns {string|null} The property name if static. Otherwise, null. */ getStaticPropertyName(node) { @@ -950,7 +925,7 @@ module.exports = { /** * Get directives from directive prologue of a Program or Function node. - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {ASTNode[]} The directives found in the directive prologue. */ getDirectivePrologue(node) { @@ -989,7 +964,7 @@ module.exports = { /** * Determines whether this node is a decimal integer literal. If a node is a decimal integer literal, a dot added * after the node will be parsed as a decimal point, rather than a property-access dot. - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} `true` if this node is a decimal integer. * @example * @@ -1011,7 +986,7 @@ module.exports = { /** * Determines whether this token is a decimal integer numeric token. * This is similar to isDecimalInteger(), but for tokens. - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if this token is a decimal integer. */ isDecimalIntegerNumericToken(token) { @@ -1063,8 +1038,7 @@ module.exports = { * - `class A { static async foo() {} }` .... `static async method 'foo'` * - `class A { static get foo() {} }` ...... `static getter 'foo'` * - `class A { static set foo(a) {} }` ..... `static setter 'foo'` - * - * @param {ASTNode} node - The function node to get. + * @param {ASTNode} node The function node to get. * @returns {string} The name and kind of the function node. */ getFunctionNameWithKind(node) { @@ -1198,9 +1172,8 @@ module.exports = { * ^^^^^^^^^^^^^^ * - `class A { static set foo(a) {} }` * ^^^^^^^^^^^^^^ - * - * @param {ASTNode} node - The function node to get. - * @param {SourceCode} sourceCode - The source code object to get tokens. + * @param {ASTNode} node The function node to get. + * @param {SourceCode} sourceCode The source code object to get tokens. * @returns {string} The location of the function node for reporting. */ getFunctionHeadLoc(node, sourceCode) { @@ -1384,7 +1357,6 @@ module.exports = { * "\00", "\01" ... "\09" * * "\0", when not followed by a digit, is not an octal escape sequence. - * * @param {string} rawString A string in its raw representation. * @returns {boolean} `true` if the string contains at least one octal escape sequence. */ diff --git a/lib/rules/utils/fix-tracker.js b/lib/rules/utils/fix-tracker.js index c987a28ca6c..589870b39b5 100644 --- a/lib/rules/utils/fix-tracker.js +++ b/lib/rules/utils/fix-tracker.js @@ -23,7 +23,6 @@ class FixTracker { /** * Create a new FixTracker. - * * @param {ruleFixer} fixer A ruleFixer instance. * @param {SourceCode} sourceCode A SourceCode object for the current code. */ @@ -36,7 +35,6 @@ class FixTracker { /** * Mark the given range as "retained", meaning that other fixes may not * may not modify this region in the same pass. - * * @param {int[]} range The range to retain. * @returns {FixTracker} The same RuleFixer, for chained calls. */ @@ -50,7 +48,6 @@ class FixTracker { * mark it as retained, meaning that other fixes may not modify it in this * pass. This is useful for avoiding conflicts in fixes that modify control * flow. - * * @param {ASTNode} node The node to use as a starting point. * @returns {FixTracker} The same RuleFixer, for chained calls. */ @@ -65,7 +62,6 @@ class FixTracker { * range as retained, meaning that other fixes may not modify it in this * pass. This is useful for avoiding conflicts in fixes that make a small * change to the code where the AST should not be changed. - * * @param {ASTNode|Token} nodeOrToken The node or token to use as a starting * point. The token to the left and right are use in the range. * @returns {FixTracker} The same RuleFixer, for chained calls. @@ -80,7 +76,6 @@ class FixTracker { /** * Create a fix command that replaces the given range with the given text, * accounting for any retained ranges. - * * @param {int[]} range The range to remove in the fix. * @param {string} text The text to insert in place of the range. * @returns {Object} The fix command. @@ -108,7 +103,6 @@ class FixTracker { /** * Create a fix command that removes the given node or token, accounting for * any retained ranges. - * * @param {ASTNode|Token} nodeOrToken The node or token to remove. * @returns {Object} The fix command. */ diff --git a/lib/rules/utils/lazy-loading-rule-map.js b/lib/rules/utils/lazy-loading-rule-map.js index e0caddb9b28..d426d85c59a 100644 --- a/lib/rules/utils/lazy-loading-rule-map.js +++ b/lib/rules/utils/lazy-loading-rule-map.js @@ -10,7 +10,6 @@ const debug = require("debug")("eslint:rules"); /** * The `Map` object that loads each rule when it's accessed. - * * @example * const rules = new LazyLoadingRuleMap([ * ["eqeqeq", () => require("eqeqeq")], diff --git a/lib/rules/vars-on-top.js b/lib/rules/vars-on-top.js index e919d02da00..6974cb2248f 100644 --- a/lib/rules/vars-on-top.js +++ b/lib/rules/vars-on-top.js @@ -33,7 +33,7 @@ module.exports = { //-------------------------------------------------------------------------- /** - * @param {ASTNode} node - any node + * @param {ASTNode} node any node * @returns {boolean} whether the given node structurally represents a directive */ function looksLikeDirective(node) { @@ -43,7 +43,7 @@ module.exports = { /** * Check to see if its a ES6 import declaration - * @param {ASTNode} node - any node + * @param {ASTNode} node any node * @returns {boolean} whether the given node represents a import declaration */ function looksLikeImport(node) { @@ -53,8 +53,7 @@ module.exports = { /** * Checks whether a given node is a variable declaration or not. - * - * @param {ASTNode} node - any node + * @param {ASTNode} node any node * @returns {boolean} `true` if the node is a variable declaration. */ function isVariableDeclaration(node) { @@ -70,8 +69,8 @@ module.exports = { /** * Checks whether this variable is on top of the block body - * @param {ASTNode} node - The node to check - * @param {ASTNode[]} statements - collection of ASTNodes for the parent node block + * @param {ASTNode} node The node to check + * @param {ASTNode[]} statements collection of ASTNodes for the parent node block * @returns {boolean} True if var is on top otherwise false */ function isVarOnTop(node, statements) { @@ -99,8 +98,8 @@ module.exports = { /** * Checks whether variable is on top at the global level - * @param {ASTNode} node - The node to check - * @param {ASTNode} parent - Parent of the node + * @param {ASTNode} node The node to check + * @param {ASTNode} parent Parent of the node * @returns {void} */ function globalVarCheck(node, parent) { @@ -111,9 +110,9 @@ module.exports = { /** * Checks whether variable is on top at functional block scope level - * @param {ASTNode} node - The node to check - * @param {ASTNode} parent - Parent of the node - * @param {ASTNode} grandParent - Parent of the node's parent + * @param {ASTNode} node The node to check + * @param {ASTNode} parent Parent of the node + * @param {ASTNode} grandParent Parent of the node's parent * @returns {void} */ function blockScopeVarCheck(node, parent, grandParent) { diff --git a/lib/shared/config-ops.js b/lib/shared/config-ops.js index d2ffda4b5ff..3b4d5699d86 100644 --- a/lib/shared/config-ops.js +++ b/lib/shared/config-ops.js @@ -77,7 +77,7 @@ module.exports = { /** * Checks whether a given config has valid severity or not. - * @param {number|string|Array} ruleConfig - The configuration for an individual rule. + * @param {number|string|Array} ruleConfig The configuration for an individual rule. * @returns {boolean} `true` if the configuration has valid severity. */ isValidSeverity(ruleConfig) { @@ -91,7 +91,7 @@ module.exports = { /** * Checks whether every rule of a given config has valid severity or not. - * @param {Object} config - The configuration for rules. + * @param {Object} config The configuration for rules. * @returns {boolean} `true` if the configuration has valid severity. */ isEverySeverityValid(config) { diff --git a/lib/shared/runtime-info.js b/lib/shared/runtime-info.js index 169bbc58f13..feed005330e 100644 --- a/lib/shared/runtime-info.js +++ b/lib/shared/runtime-info.js @@ -28,8 +28,8 @@ function environment() { /** * Checks if a path is a child of a directory. - * @param {string} parentPath - The parent path to check. - * @param {string} childPath - The path to check. + * @param {string} parentPath The parent path to check. + * @param {string} childPath The path to check. * @returns {boolean} Whether or not the given path is a child of a directory. */ function isChildOfDirectory(parentPath, childPath) { @@ -38,8 +38,8 @@ function environment() { /** * Synchronously executes a shell command and formats the result. - * @param {string} cmd - The command to execute. - * @param {Array} args - The arguments to be executed with the command. + * @param {string} cmd The command to execute. + * @param {Array} args The arguments to be executed with the command. * @returns {string} The version returned by the command. */ function execCommand(cmd, args) { @@ -63,7 +63,7 @@ function environment() { /** * Normalizes a version number. - * @param {string} versionStr - The string to normalize. + * @param {string} versionStr The string to normalize. * @returns {string} The normalized version number. */ function normalizeVersionStr(versionStr) { @@ -72,7 +72,7 @@ function environment() { /** * Gets bin version. - * @param {string} bin - The bin to check. + * @param {string} bin The bin to check. * @returns {string} The normalized version returned by the command. */ function getBinVersion(bin) { @@ -88,8 +88,8 @@ function environment() { /** * Gets installed npm package version. - * @param {string} pkg - The package to check. - * @param {boolean} global - Whether to check globally or not. + * @param {string} pkg The package to check. + * @param {boolean} global Whether to check globally or not. * @returns {string} The normalized version returned by the command. */ function getNpmPackageVersion(pkg, { global = false } = {}) { diff --git a/lib/source-code/source-code.js b/lib/source-code/source-code.js index 42e7b0c2f47..450dc24a163 100644 --- a/lib/source-code/source-code.js +++ b/lib/source-code/source-code.js @@ -86,13 +86,13 @@ class SourceCode extends TokenStore { /** * Represents parsed source code. - * @param {string|Object} textOrConfig - The source code text or config object. - * @param {string} textOrConfig.text - The source code text. - * @param {ASTNode} textOrConfig.ast - The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. - * @param {Object|null} textOrConfig.parserServices - The parser services. - * @param {ScopeManager|null} textOrConfig.scopeManager - The scope of this source code. - * @param {Object|null} textOrConfig.visitorKeys - The visitor keys to traverse AST. - * @param {ASTNode} [astIfNoConfig] - The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. + * @param {string|Object} textOrConfig The source code text or config object. + * @param {string} textOrConfig.text The source code text. + * @param {ASTNode} textOrConfig.ast The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. + * @param {Object|null} textOrConfig.parserServices The parser services. + * @param {ScopeManager|null} textOrConfig.scopeManager The scope of this source code. + * @param {Object|null} textOrConfig.visitorKeys The visitor keys to traverse AST. + * @param {ASTNode} [astIfNoConfig] The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. */ constructor(textOrConfig, astIfNoConfig) { let text, ast, parserServices, scopeManager, visitorKeys; diff --git a/lib/source-code/token-store/backward-token-comment-cursor.js b/lib/source-code/token-store/backward-token-comment-cursor.js index 7c2137a176f..7255a62260b 100644 --- a/lib/source-code/token-store/backward-token-comment-cursor.js +++ b/lib/source-code/token-store/backward-token-comment-cursor.js @@ -22,11 +22,11 @@ module.exports = class BackwardTokenCommentCursor extends Cursor { /** * Initializes this cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. */ constructor(tokens, comments, indexMap, startLoc, endLoc) { super(); diff --git a/lib/source-code/token-store/backward-token-cursor.js b/lib/source-code/token-store/backward-token-cursor.js index 93973bce443..454a2449701 100644 --- a/lib/source-code/token-store/backward-token-cursor.js +++ b/lib/source-code/token-store/backward-token-cursor.js @@ -22,11 +22,11 @@ module.exports = class BackwardTokenCursor extends Cursor { /** * Initializes this cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. */ constructor(tokens, comments, indexMap, startLoc, endLoc) { super(); diff --git a/lib/source-code/token-store/cursors.js b/lib/source-code/token-store/cursors.js index b315c7e65e1..30c72b69b8f 100644 --- a/lib/source-code/token-store/cursors.js +++ b/lib/source-code/token-store/cursors.js @@ -28,8 +28,8 @@ class CursorFactory { /** * Initializes this cursor. - * @param {Function} TokenCursor - The class of the cursor which iterates tokens only. - * @param {Function} TokenCommentCursor - The class of the cursor which iterates the mix of tokens and comments. + * @param {Function} TokenCursor The class of the cursor which iterates tokens only. + * @param {Function} TokenCommentCursor The class of the cursor which iterates the mix of tokens and comments. */ constructor(TokenCursor, TokenCommentCursor) { this.TokenCursor = TokenCursor; @@ -38,13 +38,12 @@ class CursorFactory { /** * Creates a base cursor instance that can be decorated by createCursor. - * - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {boolean} includeComments - The flag to iterate comments as well. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {boolean} includeComments The flag to iterate comments as well. * @returns {Cursor} The created base cursor. */ createBaseCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments) { @@ -55,16 +54,15 @@ class CursorFactory { /** * Creates a cursor that iterates tokens with normalized options. - * - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {boolean} includeComments - The flag to iterate comments as well. - * @param {Function|null} filter - The predicate function to choose tokens. - * @param {number} skip - The count of tokens the cursor skips. - * @param {number} count - The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {boolean} includeComments The flag to iterate comments as well. + * @param {Function|null} filter The predicate function to choose tokens. + * @param {number} skip The count of tokens the cursor skips. + * @param {number} count The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. * @returns {Cursor} The created cursor. */ createCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments, filter, skip, count) { diff --git a/lib/source-code/token-store/decorative-cursor.js b/lib/source-code/token-store/decorative-cursor.js index f0bff9c51db..3ee7b0b3975 100644 --- a/lib/source-code/token-store/decorative-cursor.js +++ b/lib/source-code/token-store/decorative-cursor.js @@ -21,7 +21,7 @@ module.exports = class DecorativeCursor extends Cursor { /** * Initializes this cursor. - * @param {Cursor} cursor - The cursor to be decorated. + * @param {Cursor} cursor The cursor to be decorated. */ constructor(cursor) { super(); diff --git a/lib/source-code/token-store/filter-cursor.js b/lib/source-code/token-store/filter-cursor.js index 7133627bd39..08c4f22031a 100644 --- a/lib/source-code/token-store/filter-cursor.js +++ b/lib/source-code/token-store/filter-cursor.js @@ -21,8 +21,8 @@ module.exports = class FilterCursor extends DecorativeCursor { /** * Initializes this cursor. - * @param {Cursor} cursor - The cursor to be decorated. - * @param {Function} predicate - The predicate function to decide tokens this cursor iterates. + * @param {Cursor} cursor The cursor to be decorated. + * @param {Function} predicate The predicate function to decide tokens this cursor iterates. */ constructor(cursor, predicate) { super(cursor); diff --git a/lib/source-code/token-store/forward-token-comment-cursor.js b/lib/source-code/token-store/forward-token-comment-cursor.js index be08552970f..50c7a394f38 100644 --- a/lib/source-code/token-store/forward-token-comment-cursor.js +++ b/lib/source-code/token-store/forward-token-comment-cursor.js @@ -22,11 +22,11 @@ module.exports = class ForwardTokenCommentCursor extends Cursor { /** * Initializes this cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. */ constructor(tokens, comments, indexMap, startLoc, endLoc) { super(); diff --git a/lib/source-code/token-store/forward-token-cursor.js b/lib/source-code/token-store/forward-token-cursor.js index 523ed398fa3..e8c18609621 100644 --- a/lib/source-code/token-store/forward-token-cursor.js +++ b/lib/source-code/token-store/forward-token-cursor.js @@ -22,11 +22,11 @@ module.exports = class ForwardTokenCursor extends Cursor { /** * Initializes this cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. */ constructor(tokens, comments, indexMap, startLoc, endLoc) { super(); diff --git a/lib/source-code/token-store/index.js b/lib/source-code/token-store/index.js index 8f9b09e95ef..25db8a4f4db 100644 --- a/lib/source-code/token-store/index.js +++ b/lib/source-code/token-store/index.js @@ -28,9 +28,8 @@ const INDEX_MAP = Symbol("indexMap"); * * The first/last location of tokens is mapped to the index of the token. * The first/last location of comments is mapped to the index of the next token of each comment. - * - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. * @returns {Object} The map from locations to indices in `tokens`. * @private */ @@ -62,17 +61,16 @@ function createIndexMap(tokens, comments) { /** * Creates the cursor iterates tokens with options. - * - * @param {CursorFactory} factory - The cursor factory to initialize cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {number|Function|Object} [opts=0] - The option object. If this is a number then it's `opts.skip`. If this is a function then it's `opts.filter`. - * @param {boolean} [opts.includeComments=false] - The flag to iterate comments as well. - * @param {Function|null} [opts.filter=null] - The predicate function to choose tokens. - * @param {number} [opts.skip=0] - The count of tokens the cursor skips. + * @param {CursorFactory} factory The cursor factory to initialize cursor. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {number|Function|Object} [opts=0] The option object. If this is a number then it's `opts.skip`. If this is a function then it's `opts.filter`. + * @param {boolean} [opts.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [opts.filter=null] The predicate function to choose tokens. + * @param {number} [opts.skip=0] The count of tokens the cursor skips. * @returns {Cursor} The created cursor. * @private */ @@ -98,17 +96,16 @@ function createCursorWithSkip(factory, tokens, comments, indexMap, startLoc, end /** * Creates the cursor iterates tokens with options. - * - * @param {CursorFactory} factory - The cursor factory to initialize cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {number|Function|Object} [opts=0] - The option object. If this is a number then it's `opts.count`. If this is a function then it's `opts.filter`. - * @param {boolean} [opts.includeComments] - The flag to iterate comments as well. - * @param {Function|null} [opts.filter=null] - The predicate function to choose tokens. - * @param {number} [opts.count=0] - The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. + * @param {CursorFactory} factory The cursor factory to initialize cursor. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {number|Function|Object} [opts=0] The option object. If this is a number then it's `opts.count`. If this is a function then it's `opts.filter`. + * @param {boolean} [opts.includeComments] The flag to iterate comments as well. + * @param {Function|null} [opts.filter=null] The predicate function to choose tokens. + * @param {number} [opts.count=0] The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. * @returns {Cursor} The created cursor. * @private */ @@ -138,29 +135,27 @@ function createCursorWithCount(factory, tokens, comments, indexMap, startLoc, en /** * Creates the cursor iterates tokens with options. * This is overload function of the below. - * - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {Function|Object} opts - The option object. If this is a function then it's `opts.filter`. - * @param {boolean} [opts.includeComments] - The flag to iterate comments as well. - * @param {Function|null} [opts.filter=null] - The predicate function to choose tokens. - * @param {number} [opts.count=0] - The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {Function|Object} opts The option object. If this is a function then it's `opts.filter`. + * @param {boolean} [opts.includeComments] The flag to iterate comments as well. + * @param {Function|null} [opts.filter=null] The predicate function to choose tokens. + * @param {number} [opts.count=0] The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. * @returns {Cursor} The created cursor. * @private */ /** * Creates the cursor iterates tokens with options. - * - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {number} [beforeCount=0] - The number of tokens before the node to retrieve. - * @param {boolean} [afterCount=0] - The number of tokens after the node to retrieve. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {number} [beforeCount=0] The number of tokens before the node to retrieve. + * @param {boolean} [afterCount=0] The number of tokens after the node to retrieve. * @returns {Cursor} The created cursor. * @private */ @@ -176,7 +171,7 @@ function createCursorWithPadding(tokens, comments, indexMap, startLoc, endLoc, b /** * Gets comment tokens that are adjacent to the current cursor position. - * @param {Cursor} cursor - A cursor instance. + * @param {Cursor} cursor A cursor instance. * @returns {Array} An array of comment tokens adjacent to the current cursor position. * @private */ @@ -211,8 +206,8 @@ module.exports = class TokenStore { /** * Initializes this token store. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. */ constructor(tokens, comments) { this[TOKENS] = tokens; @@ -226,9 +221,9 @@ module.exports = class TokenStore { /** * Gets the token starting at the specified index. - * @param {number} offset - Index of the start of the token's range. - * @param {Object} [options=0] - The option object. - * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well. + * @param {number} offset Index of the start of the token's range. + * @param {Object} [options=0] The option object. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. * @returns {Token|null} The token starting at index, or null if no such token. */ getTokenByRangeStart(offset, options) { @@ -250,11 +245,11 @@ module.exports = class TokenStore { /** * Gets the first token of the given node. - * @param {ASTNode} node - The AST node. - * @param {number|Function|Object} [options=0] - The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`. - * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well. - * @param {Function|null} [options.filter=null] - The predicate function to choose tokens. - * @param {number} [options.skip=0] - The count of tokens the cursor skips. + * @param {ASTNode} node The AST node. + * @param {number|Function|Object} [options=0] The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [options.filter=null] The predicate function to choose tokens. + * @param {number} [options.skip=0] The count of tokens the cursor skips. * @returns {Token|null} An object representing the token. */ getFirstToken(node, options) { @@ -271,8 +266,8 @@ module.exports = class TokenStore { /** * Gets the last token of the given node. - * @param {ASTNode} node - The AST node. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken() + * @param {ASTNode} node The AST node. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() * @returns {Token|null} An object representing the token. */ getLastToken(node, options) { @@ -289,8 +284,8 @@ module.exports = class TokenStore { /** * Gets the token that precedes a given node or token. - * @param {ASTNode|Token|Comment} node - The AST node or token. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken() + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() * @returns {Token|null} An object representing the token. */ getTokenBefore(node, options) { @@ -307,8 +302,8 @@ module.exports = class TokenStore { /** * Gets the token that follows a given node or token. - * @param {ASTNode|Token|Comment} node - The AST node or token. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken() + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() * @returns {Token|null} An object representing the token. */ getTokenAfter(node, options) { @@ -325,9 +320,9 @@ module.exports = class TokenStore { /** * Gets the first token between two non-overlapping nodes. - * @param {ASTNode|Token|Comment} left - Node before the desired token range. - * @param {ASTNode|Token|Comment} right - Node after the desired token range. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken() + * @param {ASTNode|Token|Comment} left Node before the desired token range. + * @param {ASTNode|Token|Comment} right Node after the desired token range. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() * @returns {Token|null} An object representing the token. */ getFirstTokenBetween(left, right, options) { @@ -346,7 +341,7 @@ module.exports = class TokenStore { * Gets the last token between two non-overlapping nodes. * @param {ASTNode|Token|Comment} left Node before the desired token range. * @param {ASTNode|Token|Comment} right Node after the desired token range. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken() + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() * @returns {Token|null} An object representing the token. */ getLastTokenBetween(left, right, options) { @@ -393,11 +388,11 @@ module.exports = class TokenStore { /** * Gets the first `count` tokens of the given node. - * @param {ASTNode} node - The AST node. - * @param {number|Function|Object} [options=0] - The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`. - * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well. - * @param {Function|null} [options.filter=null] - The predicate function to choose tokens. - * @param {number} [options.count=0] - The maximum count of tokens the cursor iterates. + * @param {ASTNode} node The AST node. + * @param {number|Function|Object} [options=0] The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [options.filter=null] The predicate function to choose tokens. + * @param {number} [options.count=0] The maximum count of tokens the cursor iterates. * @returns {Token[]} Tokens. */ getFirstTokens(node, options) { @@ -414,8 +409,8 @@ module.exports = class TokenStore { /** * Gets the last `count` tokens of the given node. - * @param {ASTNode} node - The AST node. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens() + * @param {ASTNode} node The AST node. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() * @returns {Token[]} Tokens. */ getLastTokens(node, options) { @@ -432,8 +427,8 @@ module.exports = class TokenStore { /** * Gets the `count` tokens that precedes a given node or token. - * @param {ASTNode|Token|Comment} node - The AST node or token. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens() + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() * @returns {Token[]} Tokens. */ getTokensBefore(node, options) { @@ -450,8 +445,8 @@ module.exports = class TokenStore { /** * Gets the `count` tokens that follows a given node or token. - * @param {ASTNode|Token|Comment} node - The AST node or token. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens() + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() * @returns {Token[]} Tokens. */ getTokensAfter(node, options) { @@ -468,9 +463,9 @@ module.exports = class TokenStore { /** * Gets the first `count` tokens between two non-overlapping nodes. - * @param {ASTNode|Token|Comment} left - Node before the desired token range. - * @param {ASTNode|Token|Comment} right - Node after the desired token range. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens() + * @param {ASTNode|Token|Comment} left Node before the desired token range. + * @param {ASTNode|Token|Comment} right Node after the desired token range. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() * @returns {Token[]} Tokens between left and right. */ getFirstTokensBetween(left, right, options) { @@ -489,7 +484,7 @@ module.exports = class TokenStore { * Gets the last `count` tokens between two non-overlapping nodes. * @param {ASTNode|Token|Comment} left Node before the desired token range. * @param {ASTNode|Token|Comment} right Node after the desired token range. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens() + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() * @returns {Token[]} Tokens between left and right. */ getLastTokensBetween(left, right, options) { @@ -506,18 +501,18 @@ module.exports = class TokenStore { /** * Gets all tokens that are related to the given node. - * @param {ASTNode} node - The AST node. + * @param {ASTNode} node The AST node. * @param {Function|Object} options The option object. If this is a function then it's `options.filter`. - * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well. - * @param {Function|null} [options.filter=null] - The predicate function to choose tokens. - * @param {number} [options.count=0] - The maximum count of tokens the cursor iterates. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [options.filter=null] The predicate function to choose tokens. + * @param {number} [options.count=0] The maximum count of tokens the cursor iterates. * @returns {Token[]} Array of objects representing tokens. */ /** * Gets all tokens that are related to the given node. - * @param {ASTNode} node - The AST node. - * @param {int} [beforeCount=0] - The number of tokens before the node to retrieve. - * @param {int} [afterCount=0] - The number of tokens after the node to retrieve. + * @param {ASTNode} node The AST node. + * @param {int} [beforeCount=0] The number of tokens before the node to retrieve. + * @param {int} [afterCount=0] The number of tokens after the node to retrieve. * @returns {Token[]} Array of objects representing tokens. */ getTokens(node, beforeCount, afterCount) { @@ -537,9 +532,9 @@ module.exports = class TokenStore { * @param {ASTNode|Token|Comment} left Node before the desired token range. * @param {ASTNode|Token|Comment} right Node after the desired token range. * @param {Function|Object} options The option object. If this is a function then it's `options.filter`. - * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well. - * @param {Function|null} [options.filter=null] - The predicate function to choose tokens. - * @param {number} [options.count=0] - The maximum count of tokens the cursor iterates. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [options.filter=null] The predicate function to choose tokens. + * @param {number} [options.count=0] The maximum count of tokens the cursor iterates. * @returns {Token[]} Tokens between left and right. */ /** @@ -567,9 +562,8 @@ module.exports = class TokenStore { /** * Checks whether any comments exist or not between the given 2 nodes. - * - * @param {ASTNode} left - The node to check. - * @param {ASTNode} right - The node to check. + * @param {ASTNode} left The node to check. + * @param {ASTNode} right The node to check. * @returns {boolean} `true` if one or more comments exist. */ commentsExistBetween(left, right) { diff --git a/lib/source-code/token-store/limit-cursor.js b/lib/source-code/token-store/limit-cursor.js index efb46cf0e3f..0fd92a77657 100644 --- a/lib/source-code/token-store/limit-cursor.js +++ b/lib/source-code/token-store/limit-cursor.js @@ -21,8 +21,8 @@ module.exports = class LimitCursor extends DecorativeCursor { /** * Initializes this cursor. - * @param {Cursor} cursor - The cursor to be decorated. - * @param {number} count - The count of tokens this cursor iterates. + * @param {Cursor} cursor The cursor to be decorated. + * @param {number} count The count of tokens this cursor iterates. */ constructor(cursor, count) { super(cursor); diff --git a/lib/source-code/token-store/padded-token-cursor.js b/lib/source-code/token-store/padded-token-cursor.js index c083aed1e9b..89349fa1c69 100644 --- a/lib/source-code/token-store/padded-token-cursor.js +++ b/lib/source-code/token-store/padded-token-cursor.js @@ -22,13 +22,13 @@ module.exports = class PaddedTokenCursor extends ForwardTokenCursor { /** * Initializes this cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {number} beforeCount - The number of tokens this cursor iterates before start. - * @param {number} afterCount - The number of tokens this cursor iterates after end. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {number} beforeCount The number of tokens this cursor iterates before start. + * @param {number} afterCount The number of tokens this cursor iterates after end. */ constructor(tokens, comments, indexMap, startLoc, endLoc, beforeCount, afterCount) { super(tokens, comments, indexMap, startLoc, endLoc); diff --git a/lib/source-code/token-store/skip-cursor.js b/lib/source-code/token-store/skip-cursor.js index ab34dfab0db..f068f531c1e 100644 --- a/lib/source-code/token-store/skip-cursor.js +++ b/lib/source-code/token-store/skip-cursor.js @@ -21,8 +21,8 @@ module.exports = class SkipCursor extends DecorativeCursor { /** * Initializes this cursor. - * @param {Cursor} cursor - The cursor to be decorated. - * @param {number} count - The count of tokens this cursor skips. + * @param {Cursor} cursor The cursor to be decorated. + * @param {number} count The count of tokens this cursor skips. */ constructor(cursor, count) { super(cursor); diff --git a/lib/source-code/token-store/utils.js b/lib/source-code/token-store/utils.js index 34b0a9af6da..444684b52f1 100644 --- a/lib/source-code/token-store/utils.js +++ b/lib/source-code/token-store/utils.js @@ -16,8 +16,7 @@ const lodash = require("lodash"); /** * Gets `token.range[0]` from the given token. - * - * @param {Node|Token|Comment} token - The token to get. + * @param {Node|Token|Comment} token The token to get. * @returns {number} The start location. * @private */ @@ -32,9 +31,8 @@ function getStartLocation(token) { /** * Binary-searches the index of the first token which is after the given location. * If it was not found, this returns `tokens.length`. - * - * @param {(Token|Comment)[]} tokens - It searches the token in this list. - * @param {number} location - The location to search. + * @param {(Token|Comment)[]} tokens It searches the token in this list. + * @param {number} location The location to search. * @returns {number} The found index or `tokens.length`. */ exports.search = function search(tokens, location) { @@ -48,10 +46,9 @@ exports.search = function search(tokens, location) { /** * Gets the index of the `startLoc` in `tokens`. * `startLoc` can be the value of `node.range[1]`, so this checks about `startLoc - 1` as well. - * - * @param {(Token|Comment)[]} tokens - The tokens to find an index. - * @param {Object} indexMap - The map from locations to indices. - * @param {number} startLoc - The location to get an index. + * @param {(Token|Comment)[]} tokens The tokens to find an index. + * @param {Object} indexMap The map from locations to indices. + * @param {number} startLoc The location to get an index. * @returns {number} The index. */ exports.getFirstIndex = function getFirstIndex(tokens, indexMap, startLoc) { @@ -77,10 +74,9 @@ exports.getFirstIndex = function getFirstIndex(tokens, indexMap, startLoc) { /** * Gets the index of the `endLoc` in `tokens`. * The information of end locations are recorded at `endLoc - 1` in `indexMap`, so this checks about `endLoc - 1` as well. - * - * @param {(Token|Comment)[]} tokens - The tokens to find an index. - * @param {Object} indexMap - The map from locations to indices. - * @param {number} endLoc - The location to get an index. + * @param {(Token|Comment)[]} tokens The tokens to find an index. + * @param {Object} indexMap The map from locations to indices. + * @param {number} endLoc The location to get an index. * @returns {number} The index. */ exports.getLastIndex = function getLastIndex(tokens, indexMap, endLoc) { diff --git a/packages/eslint-config-eslint/default.yml b/packages/eslint-config-eslint/default.yml index 1bbc1c57621..9fcd1dcf49f 100644 --- a/packages/eslint-config-eslint/default.yml +++ b/packages/eslint-config-eslint/default.yml @@ -47,6 +47,8 @@ rules: jsdoc/check-tag-names: "error" jsdoc/check-types: "error" jsdoc/implements-on-classes: "error" + jsdoc/newline-after-description: ["error", "never"] + jsdoc/require-hyphen-before-param-description: ["error", "never"] jsdoc/require-jsdoc: "error" jsdoc/require-param: "error" jsdoc/require-param-description: "error" diff --git a/tests/lib/cli-engine/cascading-config-array-factory.js b/tests/lib/cli-engine/cascading-config-array-factory.js index 22c9b956dda..f7fbd702f62 100644 --- a/tests/lib/cli-engine/cascading-config-array-factory.js +++ b/tests/lib/cli-engine/cascading-config-array-factory.js @@ -95,7 +95,7 @@ describe("CascadingConfigArrayFactory", () => { /** * Mocks the current user's home path - * @param {string} fakeUserHomePath - fake user's home path + * @param {string} fakeUserHomePath fake user's home path * @returns {void} * @private */ @@ -111,7 +111,6 @@ describe("CascadingConfigArrayFactory", () => { * The `expected` object is merged with the default values of config * data before comparing, so you can specify only the properties you * focus on. - * * @param {Object} actual The config object to check. * @param {Object} expected What the config object should look like. * @returns {void} diff --git a/tests/lib/cli-engine/cli-engine.js b/tests/lib/cli-engine/cli-engine.js index 223cb66073c..7c2ce871cca 100644 --- a/tests/lib/cli-engine/cli-engine.js +++ b/tests/lib/cli-engine/cli-engine.js @@ -66,7 +66,7 @@ describe("CLIEngine", () => { /** * Create the CLIEngine object by mocking some of the plugins - * @param {Object} options - options for CLIEngine + * @param {Object} options options for CLIEngine * @returns {CLIEngine} engine object * @private */ @@ -1597,7 +1597,7 @@ describe("CLIEngine", () => { /** * Converts CRLF to LF in output. * This is a workaround for git's autocrlf option on Windows. - * @param {Object} result - A result object to convert. + * @param {Object} result A result object to convert. * @returns {void} */ function convertCRLF(result) { @@ -2110,7 +2110,6 @@ describe("CLIEngine", () => { /** * helper method to delete a file without caring about exceptions - * * @param {string} filePath The file path * @returns {void} */ diff --git a/tests/lib/cli-engine/config-array/config-array.js b/tests/lib/cli-engine/config-array/config-array.js index 4e248af9f43..1d4c34708d1 100644 --- a/tests/lib/cli-engine/config-array/config-array.js +++ b/tests/lib/cli-engine/config-array/config-array.js @@ -357,7 +357,6 @@ describe("ConfigArray", () => { * Previously, the merging logic of multiple config data had been * implemented in `ConfigOps.merge()` function. But currently, it's * implemented in `ConfigArray#extractConfig()` method. - * * @param {Object} target A config data. * @param {Object} source Another config data. * @returns {Object} The merged config data. diff --git a/tests/lib/cli-engine/config-array/override-tester.js b/tests/lib/cli-engine/config-array/override-tester.js index 31038b07ec3..4920c443fed 100644 --- a/tests/lib/cli-engine/config-array/override-tester.js +++ b/tests/lib/cli-engine/config-array/override-tester.js @@ -127,7 +127,6 @@ describe("OverrideTester", () => { * Previously, the testing logic of `overrides` properties had been * implemented in `ConfigOps.pathMatchesGlobs()` function. But * currently, it's implemented in `OverrideTester` class. - * * @param {string} filePath The file path to test patterns against * @param {string|string[]} files One or more glob patterns * @param {string|string[]} [excludedFiles] One or more glob patterns diff --git a/tests/lib/linter/code-path-analysis/code-path-analyzer.js b/tests/lib/linter/code-path-analysis/code-path-analyzer.js index c682b112fd6..6460ba1b676 100644 --- a/tests/lib/linter/code-path-analysis/code-path-analyzer.js +++ b/tests/lib/linter/code-path-analysis/code-path-analyzer.js @@ -32,8 +32,7 @@ const linter = new Linter(); /** * Extracts the content of `/*expected` comments from a given source code. * It's expected DOT arrows. - * - * @param {string} source - A source code text. + * @param {string} source A source code text. * @returns {string[]} DOT arrows. */ function getExpectedDotArrows(source) { diff --git a/tests/lib/linter/code-path-analysis/code-path.js b/tests/lib/linter/code-path-analysis/code-path.js index 395eca022ae..9c0ae9ffc40 100644 --- a/tests/lib/linter/code-path-analysis/code-path.js +++ b/tests/lib/linter/code-path-analysis/code-path.js @@ -19,8 +19,7 @@ const linter = new Linter(); /** * Gets the code path of a given source code. - * - * @param {string} code - A source code. + * @param {string} code A source code. * @returns {CodePath[]} A list of created code paths. */ function parseCodePaths(code) { @@ -38,11 +37,10 @@ function parseCodePaths(code) { /** * Traverses a given code path then returns the order of traversing. - * - * @param {CodePath} codePath - A code path to traverse. - * @param {Object|undefined} [options] - The option object of + * @param {CodePath} codePath A code path to traverse. + * @param {Object|undefined} [options] The option object of * `codePath.traverseSegments()` method. - * @param {Function|undefined} [callback] - The callback function of + * @param {Function|undefined} [callback] The callback function of * `codePath.traverseSegments()` method. * @returns {string[]} The list of segment's ids in the order traversed. */ diff --git a/tests/lib/linter/linter.js b/tests/lib/linter/linter.js index baadf43cad1..e4e4e163e67 100644 --- a/tests/lib/linter/linter.js +++ b/tests/lib/linter/linter.js @@ -4064,9 +4064,9 @@ describe("Linter", () => { /** * Assert `context.getDeclaredVariables(node)` is valid. - * @param {string} code - A code to check. - * @param {string} type - A type string of ASTNode. This method checks variables on the node of the type. - * @param {Array>} expectedNamesList - An array of expected variable names. The expected variable names is an array of string. + * @param {string} code A code to check. + * @param {string} type A type string of ASTNode. This method checks variables on the node of the type. + * @param {Array>} expectedNamesList An array of expected variable names. The expected variable names is an array of string. * @returns {void} */ function verify(code, type, expectedNamesList) { @@ -4075,7 +4075,7 @@ describe("Linter", () => { /** * Assert `context.getDeclaredVariables(node)` is empty. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function checkEmpty(node) { diff --git a/tests/lib/rules/array-bracket-spacing.js b/tests/lib/rules/array-bracket-spacing.js index 68658094a33..120c905018f 100644 --- a/tests/lib/rules/array-bracket-spacing.js +++ b/tests/lib/rules/array-bracket-spacing.js @@ -18,8 +18,7 @@ const path = require("path"), /** * Gets the path to the specified parser. - * - * @param {string} name - The parser name to get. + * @param {string} name The parser name to get. * @returns {string} The path to the specified parser. */ function parser(name) { diff --git a/tests/lib/rules/comma-dangle.js b/tests/lib/rules/comma-dangle.js index 99bb7df164f..573c0c2bd42 100644 --- a/tests/lib/rules/comma-dangle.js +++ b/tests/lib/rules/comma-dangle.js @@ -19,8 +19,7 @@ const path = require("path"), /** * Gets the path to the parser of the given name. - * - * @param {string} name - The name of a parser to get. + * @param {string} name The name of a parser to get. * @returns {string} The path to the specified parser. */ function parser(name) { diff --git a/tests/lib/rules/keyword-spacing.js b/tests/lib/rules/keyword-spacing.js index 12979a52d0f..9c0bf8d0a69 100644 --- a/tests/lib/rules/keyword-spacing.js +++ b/tests/lib/rules/keyword-spacing.js @@ -34,9 +34,8 @@ const NEITHER = { before: false, after: false }; * after: false, * overrides: {as: {before: true, after: true}} * } - * - * @param {string} keyword - A keyword to be overriden. - * @param {Object} value - A value to override. + * @param {string} keyword A keyword to be overriden. + * @param {Object} value A value to override. * @returns {Object} An option object to test an "overrides" option. */ function override(keyword, value) { @@ -53,8 +52,7 @@ function override(keyword, value) { /** * Gets an error message that expected space(s) before a specified keyword. - * - * @param {string} keyword - A keyword. + * @param {string} keyword A keyword. * @returns {string[]} An error message. */ function expectedBefore(keyword) { @@ -63,8 +61,7 @@ function expectedBefore(keyword) { /** * Gets an error message that expected space(s) after a specified keyword. - * - * @param {string} keyword - A keyword. + * @param {string} keyword A keyword. * @returns {string[]} An error message. */ function expectedAfter(keyword) { @@ -74,8 +71,7 @@ function expectedAfter(keyword) { /** * Gets error messages that expected space(s) before and after a specified * keyword. - * - * @param {string} keyword - A keyword. + * @param {string} keyword A keyword. * @returns {string[]} Error messages. */ function expectedBeforeAndAfter(keyword) { @@ -87,8 +83,7 @@ function expectedBeforeAndAfter(keyword) { /** * Gets an error message that unexpected space(s) before a specified keyword. - * - * @param {string} keyword - A keyword. + * @param {string} keyword A keyword. * @returns {string[]} An error message. */ function unexpectedBefore(keyword) { @@ -97,8 +92,7 @@ function unexpectedBefore(keyword) { /** * Gets an error message that unexpected space(s) after a specified keyword. - * - * @param {string} keyword - A keyword. + * @param {string} keyword A keyword. * @returns {string[]} An error message. */ function unexpectedAfter(keyword) { @@ -108,8 +102,7 @@ function unexpectedAfter(keyword) { /** * Gets error messages that unexpected space(s) before and after a specified * keyword. - * - * @param {string} keyword - A keyword. + * @param {string} keyword A keyword. * @returns {string[]} Error messages. */ function unexpectedBeforeAndAfter(keyword) { diff --git a/tests/lib/rules/no-empty-function.js b/tests/lib/rules/no-empty-function.js index ef0ab22bfd9..71077842fb5 100644 --- a/tests/lib/rules/no-empty-function.js +++ b/tests/lib/rules/no-empty-function.js @@ -30,9 +30,8 @@ const ALLOW_OPTIONS = Object.freeze([ /** * Folds test items to `{valid: [], invalid: []}`. * One item would be converted to 4 valid patterns and 8 invalid patterns. - * - * @param {{valid: Object[], invalid: Object[]}} patterns - The result. - * @param {{code: string, message: string, allow: string}} item - A test item. + * @param {{valid: Object[], invalid: Object[]}} patterns The result. + * @param {{code: string, message: string, allow: string}} item A test item. * @returns {{valid: Object[], invalid: Object[]}} The result. */ function toValidInvalid(patterns, item) { diff --git a/tests/lib/rules/no-invalid-this.js b/tests/lib/rules/no-invalid-this.js index e951a909b0d..e4606d0e687 100644 --- a/tests/lib/rules/no-invalid-this.js +++ b/tests/lib/rules/no-invalid-this.js @@ -29,7 +29,7 @@ function NORMAL() { /** * A constant value for strict mode environment. * This modifies pattern object to make strict mode. - * @param {Object} pattern - A pattern object to modify. + * @param {Object} pattern A pattern object to modify. * @returns {void} */ function USE_STRICT(pattern) { @@ -39,7 +39,7 @@ function USE_STRICT(pattern) { /** * A constant value for implied strict mode. * This modifies pattern object to impose strict mode. - * @param {Object} pattern - A pattern object to modify. + * @param {Object} pattern A pattern object to modify. * @returns {void} */ function IMPLIED_STRICT(pattern) { @@ -51,7 +51,7 @@ function IMPLIED_STRICT(pattern) { /** * A constant value for modules environment. * This modifies pattern object to make modules. - * @param {Object} pattern - A pattern object to modify. + * @param {Object} pattern A pattern object to modify. * @returns {void} */ function MODULES(pattern) { @@ -61,8 +61,8 @@ function MODULES(pattern) { /** * Extracts patterns each condition for a specified type. The type is `valid` or `invalid`. - * @param {Object[]} patterns - Original patterns. - * @param {string} type - One of `"valid"` or `"invalid"`. + * @param {Object[]} patterns Original patterns. + * @param {string} type One of `"valid"` or `"invalid"`. * @returns {Object[]} Test patterns. */ function extractPatterns(patterns, type) { diff --git a/tests/lib/rules/no-multi-assign.js b/tests/lib/rules/no-multi-assign.js index e08484ab580..84470708a22 100644 --- a/tests/lib/rules/no-multi-assign.js +++ b/tests/lib/rules/no-multi-assign.js @@ -19,9 +19,9 @@ const rule = require("../../../lib/rules/no-multi-assign"), /** * Returns an error object at the specified line and column * @private - * @param {int} line - line number - * @param {int} column - column number - * @param {string} type - Type of node + * @param {int} line line number + * @param {int} column column number + * @param {string} type Type of node * @returns {Oject} Error object */ function errorAt(line, column, type) { diff --git a/tests/lib/rules/no-multiple-empty-lines.js b/tests/lib/rules/no-multiple-empty-lines.js index 85756b315ab..5c51dd81107 100644 --- a/tests/lib/rules/no-multiple-empty-lines.js +++ b/tests/lib/rules/no-multiple-empty-lines.js @@ -19,7 +19,7 @@ const ruleTester = new RuleTester(); /** * Creates the expected error message object for the specified number of lines - * @param {lines} lines - The number of lines expected. + * @param {lines} lines The number of lines expected. * @returns {Object} the expected error message object * @private */ @@ -37,7 +37,7 @@ function getExpectedError(lines) { /** * Creates the expected error message object for the specified number of lines - * @param {lines} lines - The number of lines expected. + * @param {lines} lines The number of lines expected. * @returns {Object} the expected error message object * @private */ @@ -51,7 +51,7 @@ function getExpectedErrorEOF(lines) { /** * Creates the expected error message object for the specified number of lines - * @param {lines} lines - The number of lines expected. + * @param {lines} lines The number of lines expected. * @returns {Object} the expected error message object * @private */ diff --git a/tests/lib/rules/one-var-declaration-per-line.js b/tests/lib/rules/one-var-declaration-per-line.js index 132931357f0..7d7df711c0c 100644 --- a/tests/lib/rules/one-var-declaration-per-line.js +++ b/tests/lib/rules/one-var-declaration-per-line.js @@ -19,8 +19,8 @@ const rule = require("../../../lib/rules/one-var-declaration-per-line"), /** * Returns an error object at the specified line and column * @private - * @param {int} line - line number - * @param {int} column - column number + * @param {int} line line number + * @param {int} column column number * @returns {Oject} Error object */ function errorAt(line, column) { diff --git a/tests/lib/rules/utils/ast-utils.js b/tests/lib/rules/utils/ast-utils.js index 314deeadfc5..577f7dac1ea 100644 --- a/tests/lib/rules/utils/ast-utils.js +++ b/tests/lib/rules/utils/ast-utils.js @@ -357,7 +357,6 @@ describe("ast-utils", () => { /** * Asserts that the unique node of the given type in the code is either * in a loop or not in a loop. - * * @param {string} code the code to check. * @param {string} nodeType the type of the node to consider. The code * must have exactly one node of ths type. diff --git a/tests/lib/rules/utils/fix-tracker.js b/tests/lib/rules/utils/fix-tracker.js index 7a4a83f9641..33fe23eee12 100644 --- a/tests/lib/rules/utils/fix-tracker.js +++ b/tests/lib/rules/utils/fix-tracker.js @@ -30,7 +30,6 @@ const DEFAULT_CONFIG = { /** * Create a SourceCode instance from the given code. Also add parent pointers in * the AST so that parent traversals will work. - * * @param {string} text The text of the code. * @returns {SourceCode} The SourceCode. */ diff --git a/tests/lib/shared/runtime-info.js b/tests/lib/shared/runtime-info.js index c82d416df9c..79c50a414ac 100644 --- a/tests/lib/shared/runtime-info.js +++ b/tests/lib/shared/runtime-info.js @@ -23,8 +23,8 @@ const packageJson = require("../../../package.json"); /** * Sets up spawn.sync() stub calls to return values and throw errors in the order in which they are given. - * @param {Function} stub - The stub to set up. - * @param {Array} returnVals - Values to be returned by subsequent stub calls. + * @param {Function} stub The stub to set up. + * @param {Array} returnVals Values to be returned by subsequent stub calls. * @returns {Function} The set up stub. */ function setupSpawnSyncStubReturnVals(stub, returnVals) { diff --git a/tools/internal-rules/consistent-docs-description.js b/tools/internal-rules/consistent-docs-description.js index b3ee52241d5..1519c0247ff 100644 --- a/tools/internal-rules/consistent-docs-description.js +++ b/tools/internal-rules/consistent-docs-description.js @@ -17,7 +17,6 @@ const ALLOWED_FIRST_WORDS = [ /** * Gets the property of the Object node passed in that has the name specified. - * * @param {string} property Name of the property to return. * @param {ASTNode} node The ObjectExpression node. * @returns {ASTNode} The Property node or null if not found. @@ -42,7 +41,6 @@ function getPropertyFromObject(property, node) { /** * Verifies that the meta.docs.description property follows our internal conventions. - * * @param {RuleContext} context The ESLint rule context. * @param {ASTNode} exportsNode ObjectExpression node that the rule exports. * @returns {void} diff --git a/tools/internal-rules/consistent-docs-url.js b/tools/internal-rules/consistent-docs-url.js index 4b811d33096..1a52bd59280 100644 --- a/tools/internal-rules/consistent-docs-url.js +++ b/tools/internal-rules/consistent-docs-url.js @@ -13,7 +13,6 @@ const path = require("path"); /** * Gets the property of the Object node passed in that has the name specified. - * * @param {string} property Name of the property to return. * @param {ASTNode} node The ObjectExpression node. * @returns {ASTNode} The Property node or null if not found. @@ -38,7 +37,6 @@ function getPropertyFromObject(property, node) { /** * Verifies that the meta.docs.url property is present and has the correct value. - * * @param {RuleContext} context The ESLint rule context. * @param {ASTNode} exportsNode ObjectExpression node that the rule exports. * @returns {void} diff --git a/tools/internal-rules/consistent-meta-messages.js b/tools/internal-rules/consistent-meta-messages.js index 24facb189dd..b094c86e884 100644 --- a/tools/internal-rules/consistent-meta-messages.js +++ b/tools/internal-rules/consistent-meta-messages.js @@ -11,7 +11,6 @@ /** * Gets the property of the Object node passed in that has the name specified. - * * @param {string} property Name of the property to return. * @param {ASTNode} node The ObjectExpression node. * @returns {ASTNode} The Property node or null if not found. diff --git a/tools/internal-rules/no-invalid-meta.js b/tools/internal-rules/no-invalid-meta.js index 016643a8d80..e5a74b359b5 100644 --- a/tools/internal-rules/no-invalid-meta.js +++ b/tools/internal-rules/no-invalid-meta.js @@ -11,7 +11,6 @@ /** * Gets the property of the Object node passed in that has the name specified. - * * @param {string} property Name of the property to return. * @param {ASTNode} node The ObjectExpression node. * @returns {ASTNode} The Property node or null if not found. @@ -35,7 +34,6 @@ function getPropertyFromObject(property, node) { /** * Extracts the `meta` property from the ObjectExpression that all rules export. - * * @param {ASTNode} exportsNode ObjectExpression node that the rule exports. * @returns {ASTNode} The `meta` Property node or null if not found. */ @@ -45,7 +43,6 @@ function getMetaPropertyFromExportsNode(exportsNode) { /** * Whether this `meta` ObjectExpression has a `docs` property defined or not. - * * @param {ASTNode} metaPropertyNode The `meta` ObjectExpression for this rule. * @returns {boolean} `true` if a `docs` property exists. */ @@ -55,7 +52,6 @@ function hasMetaDocs(metaPropertyNode) { /** * Whether this `meta` ObjectExpression has a `docs.description` property defined or not. - * * @param {ASTNode} metaPropertyNode The `meta` ObjectExpression for this rule. * @returns {boolean} `true` if a `docs.description` property exists. */ @@ -67,7 +63,6 @@ function hasMetaDocsDescription(metaPropertyNode) { /** * Whether this `meta` ObjectExpression has a `docs.category` property defined or not. - * * @param {ASTNode} metaPropertyNode The `meta` ObjectExpression for this rule. * @returns {boolean} `true` if a `docs.category` property exists. */ @@ -79,7 +74,6 @@ function hasMetaDocsCategory(metaPropertyNode) { /** * Whether this `meta` ObjectExpression has a `docs.recommended` property defined or not. - * * @param {ASTNode} metaPropertyNode The `meta` ObjectExpression for this rule. * @returns {boolean} `true` if a `docs.recommended` property exists. */ @@ -91,7 +85,6 @@ function hasMetaDocsRecommended(metaPropertyNode) { /** * Whether this `meta` ObjectExpression has a `schema` property defined or not. - * * @param {ASTNode} metaPropertyNode The `meta` ObjectExpression for this rule. * @returns {boolean} `true` if a `schema` property exists. */ @@ -101,7 +94,6 @@ function hasMetaSchema(metaPropertyNode) { /** * Checks the validity of the meta definition of this rule and reports any errors found. - * * @param {RuleContext} context The ESLint rule context. * @param {ASTNode} exportsNode ObjectExpression node that the rule exports. * @returns {void} @@ -141,7 +133,6 @@ function checkMetaValidity(context, exportsNode) { /** * Whether this node is the correct format for a rule definition or not. - * * @param {ASTNode} node node that the rule exports. * @returns {boolean} `true` if the exported node is the correct format for a rule definition */ diff --git a/tools/internal-testers/event-generator-tester.js b/tools/internal-testers/event-generator-tester.js index bbf99c06d26..1c628d7eb1c 100644 --- a/tools/internal-testers/event-generator-tester.js +++ b/tools/internal-testers/event-generator-tester.js @@ -20,8 +20,8 @@ module.exports = { /** * Overrideable `describe` function to test. - * @param {string} text - A description. - * @param {Function} method - A test logic. + * @param {string} text A description. + * @param {Function} method A test logic. * @returns {any} The returned value with the test logic. */ describe: (typeof describe === "function") ? describe : /* istanbul ignore next */ function(text, method) { @@ -30,8 +30,8 @@ module.exports = { /** * Overrideable `it` function to test. - * @param {string} text - A description. - * @param {Function} method - A test logic. + * @param {string} text A description. + * @param {Function} method A test logic. * @returns {any} The returned value with the test logic. */ it: (typeof it === "function") ? it : /* istanbul ignore next */ function(text, method) { @@ -40,7 +40,7 @@ module.exports = { /** * Does some tests to check a given object implements the EventGenerator interface. - * @param {Object} instance - An object to check. + * @param {Object} instance An object to check. * @returns {void} */ testEventGeneratorInterface(instance) { diff --git a/tools/update-rule-types.js b/tools/update-rule-types.js index 527cf2288e6..0cb40a7b176 100644 --- a/tools/update-rule-types.js +++ b/tools/update-rule-types.js @@ -3,7 +3,6 @@ * Run over the rules directory only. Use this command: * * jscodeshift -t tools/update-rule-types.js lib/rules/ - * * @author Nicholas C. Zakas */ "use strict";