diff --git a/.eslintrc-base.js b/.eslintrc-base.js index f39d23c..c9257fd 100644 --- a/.eslintrc-base.js +++ b/.eslintrc-base.js @@ -95,7 +95,6 @@ module.exports = { 'quote-props': [2, 'consistent'], 'quotes': [2, 'single', { avoidEscape: true, allowTemplateLiterals: true }], 'radix': 2, - 'require-jsdoc': [2, { require: { ClassDeclaration: true, MethodDefinition: true } }], 'semi': 2, 'semi-spacing': 2, 'semi-style': 2, @@ -108,23 +107,6 @@ module.exports = { 'spaced-comment': [2, 'always', { block: { balanced: true }, line: { exceptions: ['/'] } }], 'switch-colon-spacing': 2, 'use-isnan': [2, { enforceForIndexOf: true }], - 'valid-jsdoc': [ - 2, - { - matchDescription: '\\.$', - preferType: { - function: 'Function', - boolean: 'Boolean', - number: 'Number', - integer: 'Number', - int: 'Number', - string: 'String', - object: 'Object' - }, - requireParamType: true, - requireReturn: false - } - ], 'wrap-iife': [2, 'inside', { functionPrototypeMethods: true }], 'yoda': 2, } diff --git a/.eslintrc-jsdoc.js b/.eslintrc-jsdoc.js new file mode 100644 index 0000000..4b23ae4 --- /dev/null +++ b/.eslintrc-jsdoc.js @@ -0,0 +1,15 @@ +module.exports = { + rules: { + 'jsdoc/check-indentation': 1, + 'jsdoc/check-param-names': [1, { checkRestProperty: true }], + 'jsdoc/check-syntax': 1, + // 'check-types' casing? + 'jsdoc/match-description': 1, + 'jsdoc/newline-after-description': 0, + 'jsdoc/no-bad-blocks': 1, + 'jsdoc/no-defaults': 1, + 'jsdoc/require-description': 1, + 'jsdoc/require-description-complete-sentence': 1, + 'jsdoc/require-jsdoc': [1, { require: { ClassDeclaration: true, MethodDefinition: true } }], + }, +}; diff --git a/.eslintrc.js b/.eslintrc.js index 51a6672..76b1516 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,16 +6,18 @@ module.exports = { }, plugins: [ 'node', - 'jest', + 'jsdoc', ], extends: [ 'eslint:recommended', - '.eslintrc-base.js', - '.eslintrc-es6plus.js', + '.eslintrc-base.cjs', + '.eslintrc-es6plus.cjs', 'plugin:node/recommended', - '.eslintrc-node.js', + '.eslintrc-node.cjs', + 'plugin:jsdoc/recommended', + '.eslintrc-jsdoc.cjs', ], env: { - 'node': true, + node: true, }, }; diff --git a/CHANGELOG.md b/CHANGELOG.md index 66c14e3..fd58aa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 7.16-r1 / 2020-12-29 +* [**BREAKING**] JSDoc types are now expected to be lowercase. + * ✔ `@param {string} name The name.` + * ❌ `@param {String} name The name.` +* Add module for **eslint-plugin-jsdoc**. +* Add note in README about ESLint's ECMAScript Module support. + ## 7.16-r0 / 2020-12-20 * Update rules for ESLint 7.16. * Add module for **eslint-plugin-node**. diff --git a/README.md b/README.md index bcdfec5..453de39 100644 --- a/README.md +++ b/README.md @@ -17,5 +17,9 @@ These rules are configured to be used with the following versions. | `.eslintrc.js` | The root file which includes other modular files. | | `.eslintrc-base.js` | Includes all rules that don't relate to ES6+ language features. | | `.eslintrc-es6plus.js` | Includes all rules that relate to ES6+ language features. | -| `.eslintrc-node.js` | Includes rules from [eslint-plugin-node](https://github.com/mysticatea/eslint-plugin-node) removed from ESLint core in [v7.0.0](https://eslint.org/blog/2020/05/eslint-v7.0.0-released). +| `.eslintrc-node.js` | Includes rules from [eslint-plugin-node](https://github.com/mysticatea/eslint-plugin-node) removed from ESLint core in [v7.0.0](https://eslint.org/blog/2020/05/eslint-v7.0.0-released). | +| `.eslintrc-jsdoc.js` | Includes rules from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) replacing the `require-jsdoc` and `valid-jsdoc` rules deprecated in ESLint core in [v5.10.0](https://eslint.org/blog/2018/12/eslint-v5.10.0-released). | | `test/.eslintrc.js` | Rules for test files, including Jest-specific rules. | + +# ECMAScript Modules +For now, ESLint does not support ES Modules. If your project uses ES Modules, these files will need to be renamed from `*.js` to `*.cjs` so that they still operate in CommonJS style within an ES Modules project. However, `parserOptions.sourceType` will still need to be set to `'module'` so that the linter allows `import` and `export` statements. diff --git a/test/.eslintrc.js b/test/.eslintrc.js index 58b6370..071b55b 100644 --- a/test/.eslintrc.js +++ b/test/.eslintrc.js @@ -1,4 +1,7 @@ module.exports = { + plugins: [ + 'jest', + ], extends: [ 'plugin:jest/recommended', 'plugin:jest/style',