Skip to content
Permalink
Browse files

Chore: enable additional eslint-plugin-jsdoc rules (#12336)

* Chore: enable jsdoc/newline-after-description

* Chore: enable jsdoc/require-hyphen-before-param-description
  • Loading branch information
kaicataldo committed Oct 3, 2019
1 parent b718d2e commit 8108f49f9fa0c2de80b3b66c847551beff585951
Showing with 989 additions and 1,464 deletions.
  1. +5 −6 Makefile.js
  2. +1 −1 lib/cli-engine/cascading-config-array-factory.js
  3. +4 −5 lib/cli-engine/cli-engine.js
  4. +0 −4 lib/cli-engine/config-array/config-array.js
  5. +3 −3 lib/cli-engine/file-enumerator.js
  6. +0 −11 lib/init/autoconfig.js
  7. +0 −1 lib/init/config-file.js
  8. +0 −1 lib/init/config-initializer.js
  9. +0 −5 lib/init/config-rule.js
  10. +0 −5 lib/init/npm-utils.js
  11. +23 −38 lib/linter/code-path-analysis/code-path-analyzer.js
  12. +16 −25 lib/linter/code-path-analysis/code-path-segment.js
  13. +39 −81 lib/linter/code-path-analysis/code-path-state.js
  14. +9 −11 lib/linter/code-path-analysis/code-path.js
  15. +8 −12 lib/linter/code-path-analysis/debug-helpers.js
  16. +22 −34 lib/linter/code-path-analysis/fork-context.js
  17. +1 −2 lib/linter/code-path-analysis/id-generator.js
  18. +2 −3 lib/linter/linter.js
  19. +2 −2 lib/linter/node-event-generator.js
  20. +6 −8 lib/rule-tester/rule-tester.js
  21. +8 −8 lib/rules/accessor-pairs.js
  22. +11 −14 lib/rules/array-bracket-newline.js
  23. +12 −12 lib/rules/array-bracket-spacing.js
  24. +6 −11 lib/rules/array-callback-return.js
  25. +5 −8 lib/rules/array-element-newline.js
  26. +0 −1 lib/rules/arrow-parens.js
  27. +3 −3 lib/rules/block-scoped-var.js
  28. +4 −4 lib/rules/block-spacing.js
  29. +0 −7 lib/rules/capitalized-comments.js
  30. +3 −3 lib/rules/class-methods-use-this.js
  31. +10 −18 lib/rules/comma-dangle.js
  32. +1 −1 lib/rules/comma-spacing.js
  33. +10 −10 lib/rules/computed-property-spacing.js
  34. +4 −5 lib/rules/consistent-return.js
  35. +5 −5 lib/rules/consistent-this.js
  36. +14 −16 lib/rules/constructor-super.js
  37. +3 −5 lib/rules/curly.js
  38. +6 −6 lib/rules/func-names.js
  39. +4 −9 lib/rules/generator-star-spacing.js
  40. +4 −7 lib/rules/getter-return.js
  41. +0 −2 lib/rules/indent.js
  42. +2 −2 lib/rules/init-declarations.js
  43. +1 −1 lib/rules/jsx-quotes.js
  44. +30 −54 lib/rules/keyword-spacing.js
  45. +1 −1 lib/rules/lines-around-directive.js
  46. +0 −5 lib/rules/max-len.js
  47. +3 −7 lib/rules/max-statements-per-line.js
  48. +3 −3 lib/rules/multiline-ternary.js
  49. +6 −7 lib/rules/newline-after-var.js
  50. +8 −9 lib/rules/newline-before-return.js
  51. +2 −4 lib/rules/newline-per-chained-call.js
  52. +2 −2 lib/rules/no-class-assign.js
  53. +1 −2 lib/rules/no-compare-neg-zero.js
  54. +2 −2 lib/rules/no-confusing-arrow.js
  55. +4 −8 lib/rules/no-console.js
  56. +1 −1 lib/rules/no-const-assign.js
  57. +1 −1 lib/rules/no-dupe-args.js
  58. +3 −4 lib/rules/no-dupe-class-members.js
  59. +5 −5 lib/rules/no-dupe-keys.js
  60. +14 −18 lib/rules/no-duplicate-imports.js
  61. +0 −8 lib/rules/no-else-return.js
  62. +2 −4 lib/rules/no-empty-function.js
  63. +10 −18 lib/rules/no-eval.js
  64. +1 −1 lib/rules/no-ex-assign.js
  65. +5 −12 lib/rules/no-extra-bind.js
  66. +0 −2 lib/rules/no-extra-boolean-cast.js
  67. +4 −9 lib/rules/no-extra-label.js
  68. +12 −14 lib/rules/no-extra-parens.js
  69. +5 −6 lib/rules/no-extra-semi.js
  70. +6 −6 lib/rules/no-fallthrough.js
  71. +3 −3 lib/rules/no-func-assign.js
  72. +4 −4 lib/rules/no-global-assign.js
  73. +10 −10 lib/rules/no-implicit-coercion.js
  74. +0 −1 lib/rules/no-implied-eval.js
  75. +1 −3 lib/rules/no-invalid-this.js
  76. +3 −6 lib/rules/no-labels.js
  77. +1 −1 lib/rules/no-lone-blocks.js
  78. +6 −11 lib/rules/no-loop-func.js
  79. +6 −6 lib/rules/no-magic-numbers.js
  80. +0 −1 lib/rules/no-misleading-character-class.js
  81. +11 −20 lib/rules/no-mixed-operators.js
  82. +0 −1 lib/rules/no-mixed-requires.js
  83. +4 −4 lib/rules/no-native-reassign.js
  84. +6 −6 lib/rules/no-param-reassign.js
  85. +1 −1 lib/rules/no-redeclare.js
  86. +0 −1 lib/rules/no-regex-spaces.js
  87. +11 −11 lib/rules/no-restricted-imports.js
  88. +9 −13 lib/rules/no-self-assign.js
  89. +3 −3 lib/rules/no-sequences.js
  90. +1 −4 lib/rules/no-shadow.js
  91. +12 −13 lib/rules/no-this-before-super.js
  92. +16 −29 lib/rules/no-unmodified-loop-condition.js
  93. +3 −3 lib/rules/no-unneeded-ternary.js
  94. +7 −7 lib/rules/no-unreachable.js
  95. +4 −7 lib/rules/no-unsafe-finally.js
  96. +2 −4 lib/rules/no-unsafe-negation.js
  97. +7 −7 lib/rules/no-unused-expressions.js
  98. +3 −6 lib/rules/no-unused-labels.js
  99. +22 −29 lib/rules/no-unused-vars.js
  100. +10 −15 lib/rules/no-use-before-define.js
  101. +4 −4 lib/rules/no-useless-call.js
  102. +4 −4 lib/rules/no-useless-concat.js
  103. +14 −22 lib/rules/no-useless-constructor.js
  104. +3 −5 lib/rules/no-useless-escape.js
  105. +7 −7 lib/rules/no-useless-rename.js
  106. +8 −15 lib/rules/no-useless-return.js
  107. +12 −25 lib/rules/no-var.js
  108. +0 −1 lib/rules/no-warning-comments.js
  109. +3 −3 lib/rules/no-whitespace-before-property.js
  110. +7 −10 lib/rules/object-curly-newline.js
  111. +13 −14 lib/rules/object-curly-spacing.js
  112. +1 −1 lib/rules/object-shorthand.js
  113. +2 −2 lib/rules/one-var-declaration-per-line.js
  114. +1 −1 lib/rules/padded-blocks.js
  115. +0 −16 lib/rules/padding-line-between-statements.js
  116. +6 −6 lib/rules/prefer-arrow-callback.js
  117. +13 −21 lib/rules/prefer-const.js
  118. +0 −7 lib/rules/prefer-destructuring.js
  119. +0 −1 lib/rules/prefer-named-capture-group.js
  120. +7 −7 lib/rules/prefer-object-spread.js
  121. +3 −6 lib/rules/prefer-rest-params.js
  122. +4 −4 lib/rules/prefer-spread.js
  123. +5 −6 lib/rules/prefer-template.js
  124. +1 −1 lib/rules/quote-props.js
  125. +5 −6 lib/rules/quotes.js
  126. +5 −10 lib/rules/radix.js
  127. +2 −5 lib/rules/require-await.js
  128. +2 −2 lib/rules/require-yield.js
  129. +1 −1 lib/rules/rest-spread-spacing.js
  130. +3 −4 lib/rules/sort-imports.js
  131. +1 −3 lib/rules/sort-keys.js
  132. +1 −2 lib/rules/space-before-blocks.js
  133. +5 −5 lib/rules/space-infix-ops.js
  134. +15 −18 lib/rules/spaced-comment.js
  135. +2 −4 lib/rules/strict.js
  136. +1 −2 lib/rules/symbol-description.js
  137. +2 −2 lib/rules/template-curly-spacing.js
  138. +53 −81 lib/rules/utils/ast-utils.js
  139. +0 −6 lib/rules/utils/fix-tracker.js
  140. +0 −1 lib/rules/utils/lazy-loading-rule-map.js
  141. +10 −11 lib/rules/vars-on-top.js
  142. +2 −2 lib/shared/config-ops.js
  143. +8 −8 lib/shared/runtime-info.js
  144. +7 −7 lib/source-code/source-code.js
  145. +5 −5 lib/source-code/token-store/backward-token-comment-cursor.js
  146. +5 −5 lib/source-code/token-store/backward-token-cursor.js
  147. +17 −19 lib/source-code/token-store/cursors.js
  148. +1 −1 lib/source-code/token-store/decorative-cursor.js
  149. +2 −2 lib/source-code/token-store/filter-cursor.js
  150. +5 −5 lib/source-code/token-store/forward-token-comment-cursor.js
  151. +5 −5 lib/source-code/token-store/forward-token-cursor.js
  152. +86 −92 lib/source-code/token-store/index.js
  153. +2 −2 lib/source-code/token-store/limit-cursor.js
  154. +7 −7 lib/source-code/token-store/padded-token-cursor.js
  155. +2 −2 lib/source-code/token-store/skip-cursor.js
  156. +9 −13 lib/source-code/token-store/utils.js
  157. +2 −0 packages/eslint-config-eslint/default.yml
  158. +1 −2 tests/lib/cli-engine/cascading-config-array-factory.js
  159. +2 −3 tests/lib/cli-engine/cli-engine.js
  160. +0 −1 tests/lib/cli-engine/config-array/config-array.js
  161. +0 −1 tests/lib/cli-engine/config-array/override-tester.js
  162. +1 −2 tests/lib/linter/code-path-analysis/code-path-analyzer.js
  163. +4 −6 tests/lib/linter/code-path-analysis/code-path.js
  164. +4 −4 tests/lib/linter/linter.js
  165. +1 −2 tests/lib/rules/array-bracket-spacing.js
  166. +1 −2 tests/lib/rules/comma-dangle.js
  167. +8 −15 tests/lib/rules/keyword-spacing.js
  168. +2 −3 tests/lib/rules/no-empty-function.js
  169. +5 −5 tests/lib/rules/no-invalid-this.js
  170. +3 −3 tests/lib/rules/no-multi-assign.js
  171. +3 −3 tests/lib/rules/no-multiple-empty-lines.js
  172. +2 −2 tests/lib/rules/one-var-declaration-per-line.js
  173. +0 −1 tests/lib/rules/utils/ast-utils.js
  174. +0 −1 tests/lib/rules/utils/fix-tracker.js
  175. +2 −2 tests/lib/shared/runtime-info.js
  176. +0 −2 tools/internal-rules/consistent-docs-description.js
  177. +0 −2 tools/internal-rules/consistent-docs-url.js
  178. +0 −1 tools/internal-rules/consistent-meta-messages.js
  179. +0 −9 tools/internal-rules/no-invalid-meta.js
  180. +5 −5 tools/internal-testers/event-generator-tester.js
  181. +0 −1 tools/update-rule-types.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) {
@@ -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}.`);
@@ -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
@@ -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<string, DependentPlugin>} target The destination to merge
* @param {Record<string, DependentPlugin>|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<string, Array>} target The destination to merge
* @param {Record<string, RuleConf>|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<ConfigArrayElement>}
*/
class ConfigArray extends Array {
@@ -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.`);
@@ -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"`
*/
@@ -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
@@ -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
@@ -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() {
@@ -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.
*/

0 comments on commit 8108f49

Please sign in to comment.
You can’t perform that action at this time.