From 4418543f2a5b9c5a80a27b6532f227d6ddd30059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Mon, 11 Oct 2021 00:31:21 +0200 Subject: [PATCH 01/13] feat: support ESLint 8.x BREAKING CHANGE: Requires ESLint@^7.0.0 || ^8.0.0 --- .README/rules/check-examples.md | 3 ++ .travis.yml | 23 +++-------- README.md | 17 ++++++-- package.json | 19 +++++---- src/iterateJsdoc.js | 2 + src/jsdocUtils.js | 6 +++ src/rules/checkExamples.js | 16 +++++--- src/rules/requireJsdoc.js | 4 +- test/rules/assertions/matchDescription.js | 4 +- test/rules/assertions/requireJsdoc.js | 47 ++++++++++++++++------- test/rules/index.js | 11 ++++-- 11 files changed, 97 insertions(+), 55 deletions(-) diff --git a/.README/rules/check-examples.md b/.README/rules/check-examples.md index 2b3cf7d68..d3f12321c 100644 --- a/.README/rules/check-examples.md +++ b/.README/rules/check-examples.md @@ -1,5 +1,8 @@ ### `check-examples` +> **NOTE**: This rule currently does not work in ESLint 8 (we are waiting for +> [issue 14745](https://github.com/eslint/eslint/issues/14745)). + Ensures that (JavaScript) examples within JSDoc adhere to ESLint rules. Also has options to lint the default values of optional `@param`/`@arg`/`@argument` and `@property`/`@prop` tags or the values of `@default`/`@defaultvalue` tags. diff --git a/.travis.yml b/.travis.yml index 8cf348fcd..9ff1e4a49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,37 +9,26 @@ node_js: before_install: - npm config set depth 0 +install: + - echo "Avoid Travis's npm auto-install" before_script: > - node_version=$(node -v); - if [ ${node_version:3:1} = "." ]; then - echo "Node 10+" - if [ ${ESLINT} = "6" ]; then - npm install --legacy-peer-deps --no-save "eslint@${ESLINT}" eslint-config-canonical@24.4.4 - else - npm install --legacy-peer-deps --no-save "eslint@${ESLINT}" - fi - else - echo "Node 8+" - npm install --legacy-peer-deps --no-save "eslint@${ESLINT}" husky@3.1.0 semantic-release@15.14.0 eslint-config-canonical@18.1.1 - fi + npm install --legacy-peer-deps --no-save "eslint@${ESLINT}" notifications: email: false script: - npm run test - - 'if [ -n "${LINT-}" ]; then npm run lint; fi' + # Disable until eslint-config-canonical fixed + # - 'if [ -n "${LINT-}" ]; then npm run lint; fi' - npm run build env: jobs: + - ESLINT=8 - ESLINT=7 - - ESLINT=6 jobs: fast_finish: true include: - node_js: 'lts/*' env: LINT=true - exclude: - - node_js: 8 - env: ESLINT=7 after_success: - export NODE_ENV=production - npm run build diff --git a/README.md b/README.md index 5f98799be..ce447c451 100644 --- a/README.md +++ b/README.md @@ -945,6 +945,9 @@ function quux (foo) { ### check-examples +> **NOTE**: This rule currently does not work in ESLint 8 (we are waiting for +> [issue 14745](https://github.com/eslint/eslint/issues/14745)). + Ensures that (JavaScript) examples within JSDoc adhere to ESLint rules. Also has options to lint the default values of optional `@param`/`@arg`/`@argument` and `@property`/`@prop` tags or the values of `@default`/`@defaultvalue` tags. @@ -6914,7 +6917,7 @@ class MyClass { */ myClassField = 1 } -// "jsdoc/match-description": ["error"|"warn", {"contexts":["ClassProperty"]}] +// "jsdoc/match-description": ["error"|"warn", {"contexts":["PropertyDefinition"]}] // Message: JSDoc description does not satisfy the regex pattern. /** @@ -7182,7 +7185,7 @@ class MyClass { */ myClassField = 1 } -// "jsdoc/match-description": ["error"|"warn", {"contexts":["ClassProperty"]}] +// "jsdoc/match-description": ["error"|"warn", {"contexts":["PropertyDefinition"]}] /** * Foo. @@ -12813,7 +12816,7 @@ class Animal { @SomeAnnotation('optionalParameter') tail: boolean; } -// "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["ClassProperty"]}] +// "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["PropertyDefinition"]}] // Message: Missing JSDoc comment. @Entity('users') @@ -12907,7 +12910,7 @@ export class MyComponentComponent { @Input() public value = new EventEmitter(); } -// "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["ClassProperty:has(Decorator[expression.callee.name=\"Input\"])"]}] +// "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["PropertyDefinition > Decorator[expression.callee.name=\"Input\"]"]}] // Message: Missing JSDoc comment. requestAnimationFrame(draw) @@ -12951,6 +12954,12 @@ function comment () { } // "jsdoc/require-jsdoc": ["error"|"warn", {"enableFixer":false,"fixerMessage":" TODO: add comment"}] // Message: Missing JSDoc comment. + +export class InovaAutoCompleteComponent { + public disabled = false; +} +// "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["PropertyDefinition"],"publicOnly":true}] +// Message: Missing JSDoc comment. ```` The following patterns are not considered problems: diff --git a/package.json b/package.json index 10c679dca..bf40f83e3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://gajus.com" }, "dependencies": { - "@es-joy/jsdoccomment": "0.10.8", + "@es-joy/jsdoccomment": "0.11.0", "comment-parser": "1.2.4", "debug": "^4.3.2", "esquery": "^1.4.0", @@ -26,12 +26,12 @@ "@babel/preset-env": "^7.15.8", "@babel/register": "^7.15.3", "@hkdobrev/run-if-changed": "^0.3.1", - "@typescript-eslint/parser": "^4.33.0", + "@typescript-eslint/parser": "^5.0.0", "babel-plugin-add-module-exports": "^1.0.4", "babel-plugin-istanbul": "^6.0.0", "chai": "^4.3.4", "cross-env": "^7.0.3", - "eslint": "7.32.0", + "eslint": "^8.0.0", "eslint-config-canonical": "^28.0.0", "gitdown": "^3.1.4", "glob": "^7.2.0", @@ -48,10 +48,10 @@ "node": "^12 || ^14 || ^16" }, "lint-staged": { - ".eslintignore": "npm run lint", - "./*.js": "npm run lint-arg --", - "src/**/*.js": "npm run lint-arg --", - "test/**/*.js": "npm run lint-arg --" + "DISABLE.eslintignore": "npm run lint", + "DISABLE./*.js": "npm run lint-arg --", + "DISABLEsrc/**/*.js": "npm run lint-arg --", + "DISABLEtest/**/*.js": "npm run lint-arg --" }, "run-if-changed": { "package-lock.json": "npm run install-offline" @@ -65,7 +65,7 @@ "main": "./dist/index.js", "name": "eslint-plugin-jsdoc", "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0" + "eslint": "^7.0.0 || ^8.0.0" }, "repository": { "type": "git", @@ -95,6 +95,9 @@ "include": [ "src/" ], + "exclude": [ + "src/rules/checkExamples.js" + ], "check-coverage": true, "branches": 100, "lines": 100, diff --git a/src/iterateJsdoc.js b/src/iterateJsdoc.js index 5b52dde27..a9dd42d05 100644 --- a/src/iterateJsdoc.js +++ b/src/iterateJsdoc.js @@ -708,6 +708,8 @@ const makeReport = (context, commentNode) => { end: {line: lineNumber}, start: {line: lineNumber}, }; + // Todo: Remove once `check-examples` can be restored for ESLint 8+ + // istanbul ignore if if (jsdocLoc.column) { const colNumber = commentNode.loc.start.column + jsdocLoc.column; diff --git a/src/jsdocUtils.js b/src/jsdocUtils.js index 6c4ac63fa..c8b8656fd 100644 --- a/src/jsdocUtils.js +++ b/src/jsdocUtils.js @@ -718,6 +718,9 @@ const hasNonEmptyResolverCall = (node, resolverName) => { case 'ObjectProperty': /* eslint-disable no-fallthrough */ // istanbul ignore next -- In Babel? + case 'PropertyDefinition': + /* eslint-disable no-fallthrough */ + // istanbul ignore next -- In Babel? case 'ClassProperty': /* eslint-enable no-fallthrough */ case 'Property': @@ -907,6 +910,9 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => { return hasNonFunctionYield(property, checkYieldReturnValue); }); + // istanbul ignore next -- In Babel? + case 'PropertyDefinition': + /* eslint-disable no-fallthrough */ // istanbul ignore next -- In Babel? case 'ObjectProperty': /* eslint-disable no-fallthrough */ diff --git a/src/rules/checkExamples.js b/src/rules/checkExamples.js index 84cffd26e..e88a79a07 100644 --- a/src/rules/checkExamples.js +++ b/src/rules/checkExamples.js @@ -1,9 +1,9 @@ -// Todo: When peerDeps bump to ESLint 7, see about replacing `CLIEngine` -// with non-deprecated `ESLint` class: +// Todo: When replace `CLIEngine` with `ESLint` when feature set complete per https://github.com/eslint/eslint/issues/14745 // https://github.com/eslint/eslint/blob/master/docs/user-guide/migrating-to-7.0.0.md#-the-cliengine-class-has-been-deprecated import { - CLIEngine, + CLIEngine, ESLint, } from 'eslint'; +import semver from 'semver' import iterateJsdoc from '../iterateJsdoc'; const zeroBasedLineIndexAdjust = -1; @@ -85,6 +85,13 @@ export default iterateJsdoc(({ context, globalState, }) => { + if (semver.gte(ESLint.version, '8.0.0')) { + return report({ + loc: { start: { column: 1, line: 1 } }, + message: `This rule cannot yet be supported for ESLint 8; you should either downgrade to ESLint 7 or disable this rule. The possibility for ESLint 8 support is being tracked at https://github.com/eslint/eslint/issues/14745`, + }); + } + if (!globalState.has('checkExamples-matchingFileName')) { globalState.set('checkExamples-matchingFileName', new Map()); } @@ -196,8 +203,7 @@ export default iterateJsdoc(({ matchingFileNameMap.set(fileNameMapKey, cliFile); } - const {results: [{messages}]} = - cliFile.executeOnText(src); + const {results: [{messages}]} = cliFile.executeOnText(src); if (!('line' in tag)) { tag.line = tag.source[0].number; diff --git a/src/rules/requireJsdoc.js b/src/rules/requireJsdoc.js index 20fe68c4f..8c123c74e 100644 --- a/src/rules/requireJsdoc.js +++ b/src/rules/requireJsdoc.js @@ -308,7 +308,7 @@ export default { if ( ['VariableDeclarator', 'AssignmentExpression', 'ExportDefaultDeclaration'].includes(node.parent.type) || - ['Property', 'ObjectProperty', 'ClassProperty'].includes(node.parent.type) && node === node.parent.value + ['Property', 'ObjectProperty', 'ClassProperty', 'PropertyDefinition'].includes(node.parent.type) && node === node.parent.value ) { checkJsDoc({isFunctionContext: true}, null, node); } @@ -351,7 +351,7 @@ export default { if ( ['VariableDeclarator', 'AssignmentExpression', 'ExportDefaultDeclaration'].includes(node.parent.type) || - ['Property', 'ObjectProperty', 'ClassProperty'].includes(node.parent.type) && node === node.parent.value + ['Property', 'ObjectProperty', 'ClassProperty', 'PropertyDefinition'].includes(node.parent.type) && node === node.parent.value ) { checkJsDoc({isFunctionContext: true}, null, node); } diff --git a/test/rules/assertions/matchDescription.js b/test/rules/assertions/matchDescription.js index c2c2973a1..725f17f7c 100644 --- a/test/rules/assertions/matchDescription.js +++ b/test/rules/assertions/matchDescription.js @@ -794,7 +794,7 @@ export default { options: [ { contexts: [ - 'ClassProperty', + 'PropertyDefinition', ], }, ], @@ -1269,7 +1269,7 @@ export default { options: [ { contexts: [ - 'ClassProperty', + 'PropertyDefinition', ], }, ], diff --git a/test/rules/assertions/requireJsdoc.js b/test/rules/assertions/requireJsdoc.js index f82ccbe2f..df5478cbb 100644 --- a/test/rules/assertions/requireJsdoc.js +++ b/test/rules/assertions/requireJsdoc.js @@ -2,10 +2,6 @@ * @see https://github.com/eslint/eslint/blob/master/tests/lib/rules/require-jsdoc.js */ -import { - CLIEngine, -} from 'eslint'; - export default { invalid: [ { @@ -2591,7 +2587,7 @@ function quux (foo) { ], options: [ { - contexts: ['ClassProperty'], + contexts: ['PropertyDefinition'], }, ], output: ` @@ -3016,15 +3012,7 @@ function quux (foo) { }, ], options: [{ - contexts: [ - // Only fixed to support `:has()` with TS later in ESLint 7, but - // for our testing of ESLint 6, we use `>` which is equivalent in - // this case; after having peerDeps. to ESLint 7+, we can remove - // this check and use of `CLIEngine` - CLIEngine.version.startsWith('6') ? - 'ClassProperty > Decorator[expression.callee.name="Input"]' : - 'ClassProperty:has(Decorator[expression.callee.name="Input"])', - ], + contexts: ['PropertyDefinition > Decorator[expression.callee.name="Input"]'], }], output: ` export class MyComponentComponent { @@ -3262,6 +3250,37 @@ function quux (foo) { } `, }, + { + code: ` + export class InovaAutoCompleteComponent { + public disabled = false; + } + `, + errors: [ + { + line: 3, + message: 'Missing JSDoc comment.', + } + ], + options: [ + { + contexts: ['PropertyDefinition'], + publicOnly: true, + }, + ], + output: ` + export class InovaAutoCompleteComponent { + /** + * + */ + public disabled = false; + } + `, + parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { + sourceType: 'module', + }, + }, ], valid: [{ code: ` diff --git a/test/rules/index.js b/test/rules/index.js index 8a1828c7d..6c1a7b1d2 100644 --- a/test/rules/index.js +++ b/test/rules/index.js @@ -1,13 +1,18 @@ -import { - RuleTester, -} from 'eslint'; +import { ESLint, RuleTester } from 'eslint'; import _ from 'lodash'; +import semver from 'semver' import config from '../../src'; import ruleNames from './ruleNames.json'; const ruleTester = new RuleTester(); (process.env.npm_config_rule ? process.env.npm_config_rule.split(',') : ruleNames).forEach(async (ruleName) => { + if (semver.gte(ESLint.version, '8.0.0') && ruleName === 'check-examples') { + // This rule cannot yet be supported for ESLint 8; + // The possibility for ESLint 8 support is being tracked at https://github.com/eslint/eslint/issues/14745 + return; + } + const rule = config.rules[ruleName]; const parserOptions = { From c6e1cef335fd158c849eab0531f808d4c0d32b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Mon, 11 Oct 2021 00:31:21 +0200 Subject: [PATCH 02/13] chore: linting --- src/iterateJsdoc.js | 1 + src/jsdocUtils.js | 2 -- src/rules/checkExamples.js | 12 ++++++++---- test/rules/assertions/requireJsdoc.js | 2 +- test/rules/index.js | 6 ++++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/iterateJsdoc.js b/src/iterateJsdoc.js index a9dd42d05..657410a0c 100644 --- a/src/iterateJsdoc.js +++ b/src/iterateJsdoc.js @@ -708,6 +708,7 @@ const makeReport = (context, commentNode) => { end: {line: lineNumber}, start: {line: lineNumber}, }; + // Todo: Remove once `check-examples` can be restored for ESLint 8+ // istanbul ignore if if (jsdocLoc.column) { diff --git a/src/jsdocUtils.js b/src/jsdocUtils.js index c8b8656fd..5d6c07383 100644 --- a/src/jsdocUtils.js +++ b/src/jsdocUtils.js @@ -719,7 +719,6 @@ const hasNonEmptyResolverCall = (node, resolverName) => { /* eslint-disable no-fallthrough */ // istanbul ignore next -- In Babel? case 'PropertyDefinition': - /* eslint-disable no-fallthrough */ // istanbul ignore next -- In Babel? case 'ClassProperty': /* eslint-enable no-fallthrough */ @@ -915,7 +914,6 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => { /* eslint-disable no-fallthrough */ // istanbul ignore next -- In Babel? case 'ObjectProperty': - /* eslint-disable no-fallthrough */ // istanbul ignore next -- In Babel? case 'ClassProperty': /* eslint-enable no-fallthrough */ diff --git a/src/rules/checkExamples.js b/src/rules/checkExamples.js index e88a79a07..16798e2e6 100644 --- a/src/rules/checkExamples.js +++ b/src/rules/checkExamples.js @@ -3,7 +3,7 @@ import { CLIEngine, ESLint, } from 'eslint'; -import semver from 'semver' +import semver from 'semver'; import iterateJsdoc from '../iterateJsdoc'; const zeroBasedLineIndexAdjust = -1; @@ -86,10 +86,14 @@ export default iterateJsdoc(({ globalState, }) => { if (semver.gte(ESLint.version, '8.0.0')) { - return report({ - loc: { start: { column: 1, line: 1 } }, - message: `This rule cannot yet be supported for ESLint 8; you should either downgrade to ESLint 7 or disable this rule. The possibility for ESLint 8 support is being tracked at https://github.com/eslint/eslint/issues/14745`, + report({ + loc: {start: {column: 1, line: 1}}, + message: 'This rule cannot yet be supported for ESLint 8; you ' + + 'should either downgrade to ESLint 7 or disable this rule. The ' + + 'possibility for ESLint 8 support is being tracked at https://github.com/eslint/eslint/issues/14745', }); + + return; } if (!globalState.has('checkExamples-matchingFileName')) { diff --git a/test/rules/assertions/requireJsdoc.js b/test/rules/assertions/requireJsdoc.js index df5478cbb..236771061 100644 --- a/test/rules/assertions/requireJsdoc.js +++ b/test/rules/assertions/requireJsdoc.js @@ -3260,7 +3260,7 @@ function quux (foo) { { line: 3, message: 'Missing JSDoc comment.', - } + }, ], options: [ { diff --git a/test/rules/index.js b/test/rules/index.js index 6c1a7b1d2..fe851da0e 100644 --- a/test/rules/index.js +++ b/test/rules/index.js @@ -1,6 +1,8 @@ -import { ESLint, RuleTester } from 'eslint'; +import { + ESLint, RuleTester, +} from 'eslint'; import _ from 'lodash'; -import semver from 'semver' +import semver from 'semver'; import config from '../../src'; import ruleNames from './ruleNames.json'; From 84fb3caaa860ceba6884b97c66f0bad92ddf60e1 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 21 Oct 2021 20:03:24 +0800 Subject: [PATCH 03/13] chore: avoid dropping "parallel" tests --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index bf40f83e3..a8804f577 100644 --- a/package.json +++ b/package.json @@ -80,10 +80,10 @@ "lint-fix": "eslint --report-unused-disable-directives --fix ./src ./test", "lint": "eslint --report-unused-disable-directives --ignore-pattern '!.ncurc.js' ./src ./test .ncurc.js", "lint-arg": "eslint --report-unused-disable-directives", - "test-cov": "cross-env BABEL_ENV=test nyc mocha --parallel --reporter dot --recursive --require @babel/register --timeout 12000", - "test-no-cov": "cross-env BABEL_ENV=test mocha --parallel --reporter dot --recursive --require @babel/register --timeout 12000", + "test-cov": "cross-env BABEL_ENV=test nyc mocha --reporter dot --recursive --require @babel/register --timeout 12000", + "test-no-cov": "cross-env BABEL_ENV=test mocha --reporter dot --recursive --require @babel/register --timeout 12000", "test-index": "cross-env BABEL_ENV=test mocha --recursive --require @babel/register --reporter progress --timeout 12000 test/rules/index.js", - "test": "cross-env BABEL_ENV=test nyc --reporter text-summary mocha --parallel --reporter dot --recursive --require @babel/register --timeout 12000", + "test": "cross-env BABEL_ENV=test nyc --reporter text-summary mocha --reporter dot --recursive --require @babel/register --timeout 12000", "prepare": "husky install" }, "nyc": { From 040dcb4e74b86d76392bf39b0e84018be3b40743 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 21 Oct 2021 20:13:44 +0800 Subject: [PATCH 04/13] feat: support Node 17 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a8804f577..30a029029 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "typescript": "^4.4.3" }, "engines": { - "node": "^12 || ^14 || ^16" + "node": "^12 || ^14 || ^16 || ^17" }, "lint-staged": { "DISABLE.eslintignore": "npm run lint", From a160d6755ac3b3859c3a504da6aaaea47f349066 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 21 Oct 2021 21:05:14 +0800 Subject: [PATCH 05/13] chore: update jsdoc-type-pratt-parser Also updates devDeps., lints per latest canonical, resumes CI linting --- .travis.yml | 3 +-- package.json | 18 +++++++++--------- .../requireDescriptionCompleteSentence.js | 2 ++ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9ff1e4a49..386e6e256 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,7 @@ notifications: email: false script: - npm run test - # Disable until eslint-config-canonical fixed - # - 'if [ -n "${LINT-}" ]; then npm run lint; fi' + - 'if [ -n "${LINT-}" ]; then npm run lint; fi' - npm run build env: jobs: diff --git a/package.json b/package.json index 30a029029..fd1c2c535 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "comment-parser": "1.2.4", "debug": "^4.3.2", "esquery": "^1.4.0", - "jsdoc-type-pratt-parser": "^1.2.0", + "jsdoc-type-pratt-parser": "^2.0.0", "lodash": "^4.17.21", "regextras": "^0.8.0", "semver": "^7.3.5", @@ -26,23 +26,23 @@ "@babel/preset-env": "^7.15.8", "@babel/register": "^7.15.3", "@hkdobrev/run-if-changed": "^0.3.1", - "@typescript-eslint/parser": "^5.0.0", + "@typescript-eslint/parser": "^5.1.0", "babel-plugin-add-module-exports": "^1.0.4", - "babel-plugin-istanbul": "^6.0.0", + "babel-plugin-istanbul": "^6.1.1", "chai": "^4.3.4", "cross-env": "^7.0.3", - "eslint": "^8.0.0", - "eslint-config-canonical": "^28.0.0", + "eslint": "^8.0.1", + "eslint-config-canonical": "^30.0.0", "gitdown": "^3.1.4", "glob": "^7.2.0", - "husky": "^7.0.2", - "lint-staged": "^11.2.1", - "mocha": "^9.1.2", + "husky": "^7.0.4", + "lint-staged": "^11.2.3", + "mocha": "^9.1.3", "nyc": "^15.1.0", "open-editor": "^3.0.0", "rimraf": "^3.0.2", "semantic-release": "^18.0.0", - "typescript": "^4.4.3" + "typescript": "^4.4.4" }, "engines": { "node": "^12 || ^14 || ^16 || ^17" diff --git a/src/rules/requireDescriptionCompleteSentence.js b/src/rules/requireDescriptionCompleteSentence.js index bf59c12c4..0676b59c1 100644 --- a/src/rules/requireDescriptionCompleteSentence.js +++ b/src/rules/requireDescriptionCompleteSentence.js @@ -26,6 +26,8 @@ const extractSentences = (text, abbreviationsRegex) => { .replace(abbreviationsRegex, ''); const sentenceEndGrouping = /([.?!])(?:\s+|$)/u; + + // eslint-disable-next-line unicorn/no-array-method-this-argument const puncts = RegExtras(sentenceEndGrouping).map(txt, (punct) => { return punct; }); From 918c4d07804e27c8c6f8288d3783cd8beffdc16d Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Fri, 22 Oct 2021 07:55:19 +0800 Subject: [PATCH 06/13] chore: comment fix --- src/iterateJsdoc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iterateJsdoc.js b/src/iterateJsdoc.js index 657410a0c..b2c50119b 100644 --- a/src/iterateJsdoc.js +++ b/src/iterateJsdoc.js @@ -709,7 +709,7 @@ const makeReport = (context, commentNode) => { start: {line: lineNumber}, }; - // Todo: Remove once `check-examples` can be restored for ESLint 8+ + // Todo: Remove ignore once `check-examples` can be restored for ESLint 8+ // istanbul ignore if if (jsdocLoc.column) { const colNumber = commentNode.loc.start.column + jsdocLoc.column; From a9cf45640602f44333849cb238963605191e42eb Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Fri, 22 Oct 2021 07:55:55 +0800 Subject: [PATCH 07/13] fix use of internal `report` utility --- src/rules/checkExamples.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rules/checkExamples.js b/src/rules/checkExamples.js index 16798e2e6..7cc177782 100644 --- a/src/rules/checkExamples.js +++ b/src/rules/checkExamples.js @@ -86,12 +86,12 @@ export default iterateJsdoc(({ globalState, }) => { if (semver.gte(ESLint.version, '8.0.0')) { - report({ - loc: {start: {column: 1, line: 1}}, - message: 'This rule cannot yet be supported for ESLint 8; you ' + + report( + 'This rule cannot yet be supported for ESLint 8; you ' + 'should either downgrade to ESLint 7 or disable this rule. The ' + 'possibility for ESLint 8 support is being tracked at https://github.com/eslint/eslint/issues/14745', - }); + {column: 1, line: 1}, + ); return; } From a06dac64d1ae610355809e08ec65f8a2941fd97b Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Fri, 22 Oct 2021 08:09:50 +0800 Subject: [PATCH 08/13] chore: update jsdoccomment and devDep. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fd1c2c535..888a49e29 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://gajus.com" }, "dependencies": { - "@es-joy/jsdoccomment": "0.11.0", + "@es-joy/jsdoccomment": "0.12.0", "comment-parser": "1.2.4", "debug": "^4.3.2", "esquery": "^1.4.0", @@ -32,7 +32,7 @@ "chai": "^4.3.4", "cross-env": "^7.0.3", "eslint": "^8.0.1", - "eslint-config-canonical": "^30.0.0", + "eslint-config-canonical": "^30.1.0", "gitdown": "^3.1.4", "glob": "^7.2.0", "husky": "^7.0.4", From 9a271320fd6d06c1c7151818dc3f8a4de7502f50 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Fri, 22 Oct 2021 09:35:58 +0800 Subject: [PATCH 09/13] chore: resolve promise-loading error --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 386e6e256..10433430a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ before_install: install: - echo "Avoid Travis's npm auto-install" before_script: > - npm install --legacy-peer-deps --no-save "eslint@${ESLINT}" + npm install --legacy-peer-deps --no-save "eslint@${ESLINT}" eslint-plugin-promise notifications: email: false script: From f03cf4a1af95e055154c18d9966d230baf8fb4a6 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Fri, 22 Oct 2021 10:07:51 +0800 Subject: [PATCH 10/13] chore: reenable lint-staged checks --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 888a49e29..df27e4572 100644 --- a/package.json +++ b/package.json @@ -48,10 +48,10 @@ "node": "^12 || ^14 || ^16 || ^17" }, "lint-staged": { - "DISABLE.eslintignore": "npm run lint", - "DISABLE./*.js": "npm run lint-arg --", - "DISABLEsrc/**/*.js": "npm run lint-arg --", - "DISABLEtest/**/*.js": "npm run lint-arg --" + ".eslintignore": "npm run lint", + "./*.js": "npm run lint-arg --", + "src/**/*.js": "npm run lint-arg --", + "test/**/*.js": "npm run lint-arg --" }, "run-if-changed": { "package-lock.json": "npm run install-offline" From 7fb4cb8143c2ee92b5ad7ee879b1e6ce12ff5c44 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Fri, 22 Oct 2021 10:17:38 +0800 Subject: [PATCH 11/13] chore(CI): check 17 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 10433430a..0ef21c397 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ dist: xenial language: node_js node_js: + - "17" - "16" - "14.14.0" - "12.20.0" From 1c72466ade9125fb3ebbab69645e15e0ca40dec1 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Sat, 23 Oct 2021 07:12:46 +0800 Subject: [PATCH 12/13] chore: Bump to ESLint 8 (which should remove need to reapply promise plugin) --- .travis.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0ef21c397..be648d81a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ before_install: install: - echo "Avoid Travis's npm auto-install" before_script: > - npm install --legacy-peer-deps --no-save "eslint@${ESLINT}" eslint-plugin-promise + npm install --legacy-peer-deps --no-save "eslint@${ESLINT}" notifications: email: false script: diff --git a/package.json b/package.json index df27e4572..b69c7409c 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "babel-plugin-istanbul": "^6.1.1", "chai": "^4.3.4", "cross-env": "^7.0.3", - "eslint": "^8.0.1", + "eslint": "^8.1.0", "eslint-config-canonical": "^30.1.0", "gitdown": "^3.1.4", "glob": "^7.2.0", From d6b11434a6bd41855b848bc7cd24d701a197ec22 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Sat, 23 Oct 2021 07:50:56 +0800 Subject: [PATCH 13/13] chore(CI): update Python for Node 17 --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index be648d81a..161316f20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,16 @@ before_install: install: - echo "Avoid Travis's npm auto-install" before_script: > + node_version=$(node -v); + if [ ${node_version:1:2} = "17" ]; then + echo "Deadsnakes" + sudo add-apt-repository --yes ppa:deadsnakes/ppa + echo "Update apt-get" + sudo apt-get update + echo "Install Python3" + sudo apt-get --assume-yes install python3.6 + sudo ln -sf /usr/bin/python3.6 /usr/bin/python3 + fi; npm install --legacy-peer-deps --no-save "eslint@${ESLINT}" notifications: email: false