diff --git a/browser.js b/browser.js index 1a1e2cc..1fa38a4 100644 --- a/browser.js +++ b/browser.js @@ -7,6 +7,7 @@ module.exports = { './configs/firecloud.js', './configs/fp.js', './configs/import.js', + './configs/jsdoc.js', './configs/lodash.js', './configs/no-null.js', './configs/proper-arrows.js', diff --git a/configs/basic.js b/configs/basic.js index 85d9bc7..0a3a328 100644 --- a/configs/basic.js +++ b/configs/basic.js @@ -372,43 +372,7 @@ module.exports = { 'template-tag-spacing': ['error', 'never'], 'unicode-bom': 'error', 'use-isnan': 'error', - 'valid-jsdoc': ['error', { - prefer: { - // no synonyms - arg: 'param', - argument: 'param', - const: 'constant', - defaultvalue: 'default', - desc: 'description', - emits: 'fires', - exception: 'throws', - extends: 'augments', - fileoverview: 'file', - func: 'function', - host: 'external', - method: 'function', - overview: 'file', - return: 'returns', - var: 'member', - virtual: 'abstract', - yield: 'yields' - }, - preferType: { - BigInt: 'bigint', - Boolean: 'boolean', - Null: 'null', - Number: 'number', - String: 'string', - Symbol: 'symbol', - Undefined: 'undefined', - Void: 'void', - array: 'Array', - function: 'Function', - object: 'Object' - }, - requireParamDescription: false, - requireReturnDescription: false - }], + 'valid-jsdoc': 'off', 'valid-typeof': 'error', 'vars-on-top': 'error', 'wrap-iife': ['error', 'inside'], diff --git a/configs/jsdoc.js b/configs/jsdoc.js new file mode 100644 index 0000000..4895c2e --- /dev/null +++ b/configs/jsdoc.js @@ -0,0 +1,14 @@ +module.exports = { + extends: [ + 'plugin:jsdoc/recommended' + ], + + rules: { + 'jsdoc/check-syntax': 'error', + 'jsdoc/require-description-complete-sentence': 'error', + 'jsdoc/require-hyphen-before-param-description': ['error', 'never'], + 'jsdoc/require-jsdoc': 'off', + 'jsdoc/require-param-description': 'off', + 'jsdoc/require-returns-description': 'off' + } +}; diff --git a/configs/typescript.js b/configs/typescript.js index 42514a8..04dfd18 100644 --- a/configs/typescript.js +++ b/configs/typescript.js @@ -21,6 +21,12 @@ module.exports = { project: './tsconfig.json' }, + settings: { + jsdoc: { + mode: 'typescript' + } + }, + rules: { // 'no-var' is broken atm for typescript, but it will be fixed in a the next version // see https://github.com/eslint/eslint/pull/11443 @@ -145,12 +151,12 @@ module.exports = { // ------------------------------------------------------------------------- - // jsdoc types are redundant + // NOTE we assume eslint-plugin-jsdoc is still loaded - // eslint-disable-next-line no-sparse-arrays - 'valid-jsdoc': _.merge([, {}], _basic.rules['valid-jsdoc'], [, { - requireParamType: false, - requireReturnType: false - }]) + 'jsdoc/no-types': 'error', + 'jsdoc/require-param-description': 'error', + 'jsdoc/require-param-type': 'off', + 'jsdoc/require-param': 'off', + 'jsdoc/require-returns': 'off' } }; diff --git a/node.js b/node.js index 36485bf..62a660c 100644 --- a/node.js +++ b/node.js @@ -7,6 +7,7 @@ module.exports = { './configs/firecloud.js', './configs/fp.js', './configs/import.js', + './configs/jsdoc.js', './configs/lodash.js', './configs/no-null.js', './configs/proper-arrows.js', diff --git a/package.json b/package.json index 12ae343..4b2c1cb 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "eslint-plugin-firecloud": "git://github.com/tobiipro/eslint-plugin-firecloud.git#semver:~0.1.0", "eslint-plugin-fp": "^2.3.0", "eslint-plugin-import": "^2.17.1", + "eslint-plugin-jsdoc": "^17.0.0", "eslint-plugin-lodash": "^5.0.1", "eslint-plugin-no-null": "^1.0.2" }, @@ -42,6 +43,7 @@ "eslint-plugin-firecloud": "git://github.com/tobiipro/eslint-plugin-firecloud.git#semver:~0.1.0", "eslint-plugin-fp": "^2.3.0", "eslint-plugin-import": "^2.17.1", + "eslint-plugin-jsdoc": "^17.0.0", "eslint-plugin-lodash": "^5.0.1", "eslint-plugin-no-null": "^1.0.2", "npm-publish-git": "git://github.com/andreineculau/npm-publish-git.git#semver:~0.0.8"