Skip to content

Commit

Permalink
Add module for eslint-plugin-jsdoc
Browse files Browse the repository at this point in the history
* Add note about ES Modules
  • Loading branch information
nazrhyn committed Dec 29, 2020
1 parent 3d7ddd2 commit 33369ff
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 24 deletions.
18 changes: 0 additions & 18 deletions .eslintrc-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
}
Expand Down
15 changes: 15 additions & 0 deletions .eslintrc-jsdoc.js
Original file line number Diff line number Diff line change
@@ -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 } }],
},
};
12 changes: 7 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
};
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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**.
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
3 changes: 3 additions & 0 deletions test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
plugins: [
'jest',
],
extends: [
'plugin:jest/recommended',
'plugin:jest/style',
Expand Down

0 comments on commit 33369ff

Please sign in to comment.