Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: fix some jsdoc-related issues in the codebase #11148

Merged
merged 1 commit into from Dec 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile.js
Expand Up @@ -350,7 +350,7 @@ function publishRelease() {
/**
* Splits a command result to separate lines.
* @param {string} result The command result string.
* @returns {array} The separated lines.
* @returns {Array} The separated lines.
*/
function splitCommandResultToLines(result) {
return result.trim().split("\n");
Expand Down Expand Up @@ -416,7 +416,7 @@ function getFirstVersionOfDeletion(filePath) {

/**
* Lints Markdown files.
* @param {array} files Array of file names to lint.
* @param {Array} files Array of file names to lint.
* @returns {Object} exec-style exit code object.
* @private
*/
Expand Down
1 change: 0 additions & 1 deletion lib/config/autoconfig.js
Expand Up @@ -102,7 +102,6 @@ class Registry {
*
* The length of the returned array will be <= MAX_CONFIG_COMBINATIONS.
*
* @param {Object} registry The autoconfig registry
* @returns {Object[]} "rules" configurations to use for linting
*/
buildRuleSets() {
Expand Down
8 changes: 4 additions & 4 deletions lib/config/config-rule.js
Expand Up @@ -37,9 +37,9 @@ 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.
* @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.
*/
function combineArrays(arr1, arr2) {
const res = [];
Expand Down Expand Up @@ -268,7 +268,7 @@ class RuleConfigSet {
/**
* Generate valid rule configurations based on a schema object
* @param {Object} schema A rule's schema object
* @returns {array[]} Valid rule configurations
* @returns {Array[]} Valid rule configurations
*/
function generateConfigsFromSchema(schema) {
const configSet = new RuleConfigSet();
Expand Down
4 changes: 2 additions & 2 deletions lib/config/config-validator.js
Expand Up @@ -83,7 +83,7 @@ function validateRuleSeverity(options) {
/**
* Validates the non-severity options passed to a rule, based on its schema.
* @param {{create: Function}} rule The rule to validate
* @param {array} localOptions The options for the rule, excluding severity
* @param {Array} localOptions The options for the rule, excluding severity
* @returns {void}
*/
function validateRuleSchema(rule, localOptions) {
Expand Down Expand Up @@ -111,7 +111,7 @@ function validateRuleSchema(rule, localOptions) {
* Validates a rule's options against its schema.
* @param {{create: Function}|null} rule The rule that the config is being validated for
* @param {string} ruleId The rule's unique name.
* @param {array|number} options The given options for the rule.
* @param {Array|number} options The given options for the rule.
* @param {string|null} source The name of the configuration source to report in any errors. If null or undefined,
* no source is prepended to the message.
* @returns {void}
Expand Down
2 changes: 0 additions & 2 deletions lib/linter.js
Expand Up @@ -922,8 +922,6 @@ module.exports = class Linter {
* @param {(string|Object)} [filenameOrOptions] The optional filename of the file being checked.
* If this is not set, the filename will default to '<input>' in the rule context. If
* an object, then it has "filename", "saveState", and "allowInlineConfig" properties.
* @param {boolean} [saveState] Indicates if the state from the last run should be saved.
* Mostly useful for testing purposes.
* @param {boolean} [filenameOrOptions.allowInlineConfig] Allow/disallow inline comments' ability to change config once it is set. Defaults to true if not supplied.
* Useful if you want to validate JS without comments overriding rules.
* @param {function(string): string[]} [filenameOrOptions.preprocess] preprocessor for source text. If provided,
Expand Down
1 change: 0 additions & 1 deletion lib/rules/array-element-newline.js
Expand Up @@ -173,7 +173,6 @@ 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 {{multiline: boolean, minItems: number}} options - An option object.
* @returns {void}
*/
function check(node) {
Expand Down
1 change: 0 additions & 1 deletion lib/rules/eqeqeq.js
Expand Up @@ -119,7 +119,6 @@ module.exports = {
/**
* Gets the location (line and column) of the binary expression's operator
* @param {ASTNode} node The binary expression node to check
* @param {string} operator The operator to find
* @returns {Object} { line, column } location of operator
* @private
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/handle-callback-err.js
Expand Up @@ -59,7 +59,7 @@ module.exports = {
/**
* Get the parameters of a given function scope.
* @param {Object} scope The function scope.
* @returns {array} All parameters of the given scope.
* @returns {Array} All parameters of the given scope.
*/
function getParameters(scope) {
return scope.variables.filter(variable => variable.defs[0] && variable.defs[0].type === "Parameter");
Expand Down
1 change: 0 additions & 1 deletion lib/rules/implicit-arrow-linebreak.js
Expand Up @@ -44,7 +44,6 @@ module.exports = {
/**
* Validates the location of an arrow function body
* @param {ASTNode} node The arrow function body
* @param {string} keywordName The applicable keyword name for the arrow function body
* @returns {void}
*/
function validateExpression(node) {
Expand Down
3 changes: 0 additions & 3 deletions lib/rules/indent-legacy.js
Expand Up @@ -300,7 +300,6 @@ module.exports = {
* @param {int} gottenTabs Indentation tab count in the actual node/code
* @param {Object=} loc Error line and column location
* @param {boolean} isLastNodeCheck Is the error for last node check
* @param {int} lastNodeCheckEndOffset Number of charecters to skip from the end
* @returns {void}
*/
function report(node, needed, gottenSpaces, gottenTabs, loc, isLastNodeCheck) {
Expand Down Expand Up @@ -365,7 +364,6 @@ module.exports = {
* Check indent for node
* @param {ASTNode} node Node to check
* @param {int} neededIndent needed indent
* @param {boolean} [excludeCommas=false] skip comma on start of line
* @returns {void}
*/
function checkNodeIndent(node, neededIndent) {
Expand Down Expand Up @@ -413,7 +411,6 @@ module.exports = {
* Check indent for nodes list
* @param {ASTNode[]} nodes list of node objects
* @param {int} indent needed indent
* @param {boolean} [excludeCommas=false] skip comma on start of line
* @returns {void}
*/
function checkNodesIndent(nodes, indent) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/newline-before-return.js
Expand Up @@ -36,7 +36,7 @@ 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 {Array} testTokens - array of tokens to test against
* @returns {boolean} Whether or not the node is preceded by one of the supplied tokens
* @private
*/
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-constant-condition.js
Expand Up @@ -173,7 +173,6 @@ module.exports = {

/**
* Reports when the set still contains stored constant conditions
* @param {ASTNode} node The AST node to check.
* @returns {void}
* @private
*/
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-else-return.js
Expand Up @@ -183,7 +183,6 @@ module.exports = {
* code paths.
*
* @param {Node} node The consequent or body node
* @param {Node} alternate The alternate node
* @returns {boolean} `true` if it is a Return/If node that always returns.
*/
function checkForReturnOrIf(node) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-implied-eval.js
Expand Up @@ -38,7 +38,7 @@ module.exports = {

/**
* Get the last element of an array, without modifying arr, like pop(), but non-destructive.
* @param {array} arr What to inspect
* @param {Array} arr What to inspect
* @returns {*} The last element of arr
* @private
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-restricted-imports.js
Expand Up @@ -195,7 +195,7 @@ module.exports = {
/**
* Check if the given importNames are restricted given a list of restrictedImportNames.
* @param {Set.<string>} importNames - Set of import names that are being imported
* @param {[string]} restrictedImportNames - array of import names that are restricted for this import
* @param {string[]} restrictedImportNames - array of import names that are restricted for this import
* @returns {boolean} whether the objectName is restricted
* @private
*/
Expand Down
1 change: 0 additions & 1 deletion lib/rules/no-this-before-super.js
Expand Up @@ -171,7 +171,6 @@ module.exports = {
* invalid node.
*
* @param {CodePath} codePath - A code path which was ended.
* @param {ASTNode} node - The current node.
* @returns {void}
*/
onCodePathEnd(codePath) {
Expand Down
1 change: 0 additions & 1 deletion lib/rules/object-curly-newline.js
Expand Up @@ -172,7 +172,6 @@ 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 {{multiline: boolean, minProperties: number, consistent: boolean}} options - An option object.
* @returns {void}
*/
function check(node) {
Expand Down
1 change: 0 additions & 1 deletion lib/rules/one-var.js
Expand Up @@ -310,7 +310,6 @@ module.exports = {
/**
* Fixer to split a VariableDeclaration into individual declarations
* @param {VariableDeclaration} declaration The `VariableDeclaration` to split
* @param {?Function} filter Function to filter the declarations
* @returns {Function} The fixer function
*/
function splitDeclarations(declaration) {
Expand Down
1 change: 0 additions & 1 deletion lib/rules/space-in-parens.js
Expand Up @@ -61,7 +61,6 @@ module.exports = {

/**
* Produces an object with the opener and closer exception values
* @param {Object} opts The exception options
* @returns {Object} `openers` and `closers` exception values
* @private
*/
Expand Down
6 changes: 3 additions & 3 deletions lib/util/ignored-paths.js
Expand Up @@ -296,7 +296,7 @@ class IgnoredPaths {
/**
* read ignore filepath
* @param {string} filePath, file to add to ig
* @returns {array} raw ignore rules
* @returns {Array} raw ignore rules
*/
readIgnoreFile(filePath) {
if (typeof this.cache[filePath] === "undefined") {
Expand All @@ -307,8 +307,8 @@ class IgnoredPaths {

/**
* add ignore file to node-ignore instance
* @param {Object} ig, instance of node-ignore
* @param {string} filePath, file to add to ig
* @param {Object} ig instance of node-ignore
* @param {string} filePath file to add to ig
* @returns {void}
*/
addIgnoreFile(ig, filePath) {
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config-eslint/default.yml
Expand Up @@ -181,6 +181,7 @@ rules:
"String": "string",
"Number": "number",
"Boolean": "boolean",
"array": "Array",
"object": "Object",
"function": "Function"
}
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/rules/indent-legacy.js
Expand Up @@ -24,7 +24,7 @@ const fixedFixture = fs.readFileSync(path.join(__dirname, "../../fixtures/rules/
/**
* Create error message object for failure cases with a single 'found' indentation type
* @param {string} providedIndentType indent type of string or tab
* @param {array} providedErrors error info
* @param {Array} providedErrors error info
* @returns {Object} returns the error messages collection
* @private
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/rules/indent.js
Expand Up @@ -25,7 +25,7 @@ const parser = require("../../fixtures/fixture-parser");
/**
* Create error message object for failure cases with a single 'found' indentation type
* @param {string} providedIndentType indent type of string or tab
* @param {array} providedErrors error info
* @param {Array} providedErrors error info
* @returns {Object} returns the error messages collection
* @private
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/rules/no-empty-function.js
Expand Up @@ -31,9 +31,9 @@ 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 {{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.
* @returns {{valid: Object[], invalid: Object[]}} The result.
*/
function toValidInvalid(patterns, item) {

Expand Down
4 changes: 2 additions & 2 deletions tests/lib/util/ignored-paths.js
Expand Up @@ -29,7 +29,7 @@ let fixtureDir;

/**
* get raw rules from IgnorePaths instance
* @param {IgnoredPaths} ignoredPaths, instance of IgnoredPaths
* @param {IgnoredPaths} ignoredPaths instance of IgnoredPaths
* @returns {string[]} raw ignore rules
*/
function getIgnoreRules(ignoredPaths) {
Expand Down Expand Up @@ -78,7 +78,7 @@ function getIgnorePatterns(ignoredPaths) {

/**
* count the number of default patterns applied to IgnoredPaths instance
* @param {IgnoredPaths} ignoredPaths, instance of IgnoredPaths
* @param {IgnoredPaths} ignoredPaths instance of IgnoredPaths
* @returns {integer} count of default patterns
*/
function countDefaultPatterns(ignoredPaths) {
Expand Down