From f5c26ee49dd5ce92bf90a7b31fefb90f3e34e6b3 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Mon, 8 May 2023 17:45:51 -0700 Subject: [PATCH 1/5] refactor: fix `generateRule.js` Also: - refactor: TypeScript for `checkJs` --- .eslintrc.json | 4 +++- .husky/pre-push | 2 +- CONTRIBUTING.md | 2 +- package.json | 9 ++++--- pnpm-lock.yaml | 49 +++++++++++++++++++++++++------------ src/WarnSettings.js | 14 ++++++++--- src/bin/generateDocs.js | 46 +++++++++++++++++++++++++++-------- src/bin/generateRule.js | 53 +++++++++++++++++++++++++++++++++-------- src/bin/gitdown.d.ts | 12 ++++++++++ src/index.js | 13 ++++++++++ tsconfig.json | 19 +++++++++++++++ 11 files changed, 179 insertions(+), 44 deletions(-) create mode 100644 src/bin/gitdown.d.ts create mode 100644 tsconfig.json diff --git a/.eslintrc.json b/.eslintrc.json index dae15268b..a9adc04bc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -37,6 +37,8 @@ "unicorn/no-unsafe-regex": 0, "unicorn/prefer-array-some": 0, "unicorn/prevent-abbreviations": 0, - "linebreak-style": 0 + "linebreak-style": 0, + "no-inline-comments": 0, + "no-extra-parens": 0 } } diff --git a/.husky/pre-push b/.husky/pre-push index 8b51deba9..05340f7e4 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -npm test && npm run build && npm run check-readme +npm test && npm run build && npm run check-docs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 28649cbfd..3bfd4fb33 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,7 +42,7 @@ modify files within the `.README` directory. `.README/README.md` contains the main README skeleton and details on the project, its global `settings`, etc., while the documentation for specific rules (that will be pulled into the README) ought to be modified within the relevant file within `.README/rules`. -Once these files are modified, you can run `pnpm create-readme` to have +Once these files are modified, you can run `pnpm create-docs` to have these files integrated into the main `/README.md`. While you should include the built file in your PR, you will not want to make manual changes directly to this file, as they will be overwritten. diff --git a/package.json b/package.json index 2ac8ffd07..e42c0e336 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,8 @@ "@semantic-release/commit-analyzer": "^9.0.2", "@semantic-release/github": "^8.0.7", "@semantic-release/npm": "^10.0.3", + "@types/eslint": "^8.37.0", + "@types/node": "^20.1.1", "@typescript-eslint/parser": "^5.59.2", "babel-plugin-add-module-exports": "^1.0.4", "babel-plugin-istanbul": "^6.1.1", @@ -36,8 +38,8 @@ "chai": "^4.3.7", "cross-env": "^7.0.3", "decamelize": "^5.0.1", - "eslint-config-canonical": "~33.0.1", "eslint": "^8.39.0", + "eslint-config-canonical": "~33.0.1", "gitdown": "^3.1.5", "glob": "^10.2.2", "husky": "^8.0.3", @@ -107,9 +109,10 @@ "package-lock.json": "npm run install-offline" }, "scripts": { + "tsc": "tsc", "build": "rimraf ./dist && cross-env NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps --ignore ./src/bin/*.js --no-copy-ignored", - "check-readme": "babel-node ./src/bin/generateDocs.js --check", - "create-readme": "babel-node ./src/bin/generateDocs.js", + "check-docs": "babel-node ./src/bin/generateDocs.js --check", + "create-docs": "babel-node ./src/bin/generateDocs.js", "create-rule": "babel-node ./src/bin/generateRule.js", "install-offline": "pnpm install --prefer-offline --no-audit", "lint": "npm run lint-arg -- .", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8275a1df4..8f0ee02b7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,6 +66,12 @@ devDependencies: '@semantic-release/npm': specifier: ^10.0.3 version: 10.0.3(semantic-release@21.0.2) + '@types/eslint': + specifier: ^8.37.0 + version: 8.37.0 + '@types/node': + specifier: ^20.1.1 + version: 20.1.1 '@typescript-eslint/parser': specifier: ^5.59.2 version: 5.59.2(eslint@8.39.0)(typescript@5.0.4) @@ -92,7 +98,7 @@ devDependencies: version: 8.39.0 eslint-config-canonical: specifier: ~33.0.1 - version: 33.0.1(@babel/core@7.21.8)(@babel/plugin-syntax-flow@7.21.4)(@babel/plugin-transform-react-jsx@7.21.5)(eslint@8.39.0)(graphql@16.6.0)(typescript@5.0.4) + version: 33.0.1(@babel/core@7.21.8)(@babel/plugin-syntax-flow@7.21.4)(@babel/plugin-transform-react-jsx@7.21.5)(@types/node@20.1.1)(eslint@8.39.0)(graphql@16.6.0)(typescript@5.0.4) gitdown: specifier: ^3.1.5 version: 3.1.5 @@ -1510,7 +1516,7 @@ packages: resolution: {integrity: sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==} dev: true - /@graphql-eslint/eslint-plugin@3.18.0(@babel/core@7.21.8)(graphql@16.6.0): + /@graphql-eslint/eslint-plugin@3.18.0(@babel/core@7.21.8)(@types/node@20.1.1)(graphql@16.6.0): resolution: {integrity: sha512-riEEfRycc0+pWxcEWqHi8woRxzg1xZqAfh9DRACJUR7bTN8dmc1N04i7+pvW4sevClUFYC2wuL1Vtr+DwzXLUg==} peerDependencies: graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 @@ -1523,7 +1529,7 @@ packages: debug: 4.3.4(supports-color@8.1.1) fast-glob: 3.2.12 graphql: 16.6.0 - graphql-config: 4.5.0(graphql@16.6.0) + graphql-config: 4.5.0(@types/node@20.1.1)(graphql@16.6.0) graphql-depth-limit: 1.1.0(graphql@16.6.0) lodash.lowercase: 4.3.0 tslib: 2.5.0 @@ -1598,7 +1604,7 @@ packages: - utf-8-validate dev: true - /@graphql-tools/executor-http@0.1.9(graphql@16.6.0): + /@graphql-tools/executor-http@0.1.9(@types/node@20.1.1)(graphql@16.6.0): resolution: {integrity: sha512-tNzMt5qc1ptlHKfpSv9wVBVKCZ7gks6Yb/JcYJluxZIT4qRV+TtOFjpptfBU63usgrGVOVcGjzWc/mt7KhmmpQ==} peerDependencies: graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 @@ -1609,7 +1615,7 @@ packages: dset: 3.1.2 extract-files: 11.0.0 graphql: 16.6.0 - meros: 1.2.1 + meros: 1.2.1(@types/node@20.1.1) tslib: 2.5.0 value-or-promise: 1.0.12 transitivePeerDependencies: @@ -1732,7 +1738,7 @@ packages: value-or-promise: 1.0.12 dev: true - /@graphql-tools/url-loader@7.17.18(graphql@16.6.0): + /@graphql-tools/url-loader@7.17.18(@types/node@20.1.1)(graphql@16.6.0): resolution: {integrity: sha512-ear0CiyTj04jCVAxi7TvgbnGDIN2HgqzXzwsfcqiVg9cvjT40NcMlZ2P1lZDgqMkZ9oyLTV8Bw6j+SyG6A+xPw==} peerDependencies: graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 @@ -1740,7 +1746,7 @@ packages: '@ardatan/sync-fetch': 0.0.1 '@graphql-tools/delegate': 9.0.35(graphql@16.6.0) '@graphql-tools/executor-graphql-ws': 0.0.14(graphql@16.6.0) - '@graphql-tools/executor-http': 0.1.9(graphql@16.6.0) + '@graphql-tools/executor-http': 0.1.9(@types/node@20.1.1)(graphql@16.6.0) '@graphql-tools/executor-legacy-ws': 0.0.11(graphql@16.6.0) '@graphql-tools/utils': 9.2.1(graphql@16.6.0) '@graphql-tools/wrap': 9.4.2(graphql@16.6.0) @@ -2217,6 +2223,17 @@ packages: engines: {node: '>= 10'} dev: true + /@types/eslint@8.37.0: + resolution: {integrity: sha512-Piet7dG2JBuDIfohBngQ3rCt7MgO9xCO4xIMKxBThCq5PNRB91IjlJ10eJVwfoNtvTErmxLzwBZ7rHZtbOMmFQ==} + dependencies: + '@types/estree': 1.0.1 + '@types/json-schema': 7.0.11 + dev: true + + /@types/estree@1.0.1: + resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==} + dev: true + /@types/json-schema@7.0.11: resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} dev: true @@ -2229,8 +2246,8 @@ packages: resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} dev: true - /@types/node@18.16.3: - resolution: {integrity: sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==} + /@types/node@20.1.1: + resolution: {integrity: sha512-uKBEevTNb+l6/aCQaKVnUModfEMjAl98lw2Si9P5y4hLu9tm6AlX2ZIoXZX6Wh9lJueYPrGPKk5WMCNHg/u6/A==} dev: true /@types/normalize-package-data@2.4.1: @@ -2248,7 +2265,7 @@ packages: /@types/ws@8.5.4: resolution: {integrity: sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==} dependencies: - '@types/node': 18.16.3 + '@types/node': 20.1.1 dev: true /@typescript-eslint/eslint-plugin@5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.39.0)(typescript@5.0.4): @@ -3943,7 +3960,7 @@ packages: lodash.zip: 4.2.0 dev: true - /eslint-config-canonical@33.0.1(@babel/core@7.21.8)(@babel/plugin-syntax-flow@7.21.4)(@babel/plugin-transform-react-jsx@7.21.5)(eslint@8.39.0)(graphql@16.6.0)(typescript@5.0.4): + /eslint-config-canonical@33.0.1(@babel/core@7.21.8)(@babel/plugin-syntax-flow@7.21.4)(@babel/plugin-transform-react-jsx@7.21.5)(@types/node@20.1.1)(eslint@8.39.0)(graphql@16.6.0)(typescript@5.0.4): resolution: {integrity: sha512-g5hyJr5s4WnyAp5FdfMyItz72hOgXAB/4tsFMBP944bcei2QJyMvwslpKdiQL299HSJBpJ9xbNBhx7oeFI7zIQ==} engines: {node: '>=12.0.0'} peerDependencies: @@ -3951,7 +3968,7 @@ packages: dependencies: '@babel/eslint-parser': 7.21.8(@babel/core@7.21.8)(eslint@8.39.0) '@babel/eslint-plugin': 7.19.1(@babel/eslint-parser@7.21.8)(eslint@8.39.0) - '@graphql-eslint/eslint-plugin': 3.18.0(@babel/core@7.21.8)(graphql@16.6.0) + '@graphql-eslint/eslint-plugin': 3.18.0(@babel/core@7.21.8)(@types/node@20.1.1)(graphql@16.6.0) '@next/eslint-plugin-next': 12.3.4 '@rushstack/eslint-patch': 1.2.0 '@typescript-eslint/eslint-plugin': 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.39.0)(typescript@5.0.4) @@ -5160,7 +5177,7 @@ packages: resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} dev: true - /graphql-config@4.5.0(graphql@16.6.0): + /graphql-config@4.5.0(@types/node@20.1.1)(graphql@16.6.0): resolution: {integrity: sha512-x6D0/cftpLUJ0Ch1e5sj1TZn6Wcxx4oMfmhaG9shM0DKajA9iR+j1z86GSTQ19fShbGvrSSvbIQsHku6aQ6BBw==} engines: {node: '>= 10.0.0'} peerDependencies: @@ -5174,7 +5191,7 @@ packages: '@graphql-tools/json-file-loader': 7.4.18(graphql@16.6.0) '@graphql-tools/load': 7.8.14(graphql@16.6.0) '@graphql-tools/merge': 8.4.1(graphql@16.6.0) - '@graphql-tools/url-loader': 7.17.18(graphql@16.6.0) + '@graphql-tools/url-loader': 7.17.18(@types/node@20.1.1)(graphql@16.6.0) '@graphql-tools/utils': 9.2.1(graphql@16.6.0) cosmiconfig: 8.0.0 graphql: 16.6.0 @@ -6600,7 +6617,7 @@ packages: engines: {node: '>= 8'} dev: true - /meros@1.2.1: + /meros@1.2.1(@types/node@20.1.1): resolution: {integrity: sha512-R2f/jxYqCAGI19KhAvaxSOxALBMkaXWH2a7rOyqQw+ZmizX5bKkEYWLzdhC+U82ZVVPVp6MCXe3EkVligh+12g==} engines: {node: '>=13'} peerDependencies: @@ -6608,6 +6625,8 @@ packages: peerDependenciesMeta: '@types/node': optional: true + dependencies: + '@types/node': 20.1.1 dev: true /micro-spelling-correcter@1.1.1: diff --git a/src/WarnSettings.js b/src/WarnSettings.js index dd4bdfd93..cce7481ee 100644 --- a/src/WarnSettings.js +++ b/src/WarnSettings.js @@ -6,20 +6,28 @@ const WarnSettings = function () { /** * Warn only once for each context and setting * - * @param {object} context + * @param {import('eslint').Rule.RuleContext} context * @param {string} setting + * @returns {boolean} */ hasBeenWarned (context, setting) { - return warnedSettings.has(context) && warnedSettings.get(context).has(setting); + return warnedSettings.has(context) && /** @type {Set} */ ( + warnedSettings.get(context) + ).has(setting); }, + /** + * @param {import('eslint').Rule.RuleContext} context + * @param {string} setting + * @returns {void} + */ markSettingAsWarned (context, setting) { // istanbul ignore else if (!warnedSettings.has(context)) { warnedSettings.set(context, new Set()); } - warnedSettings.get(context).add(setting); + /** @type {Set} */ (warnedSettings.get(context)).add(setting); }, }; }; diff --git a/src/bin/generateDocs.js b/src/bin/generateDocs.js index 7c009bf12..0c3e34ec3 100644 --- a/src/bin/generateDocs.js +++ b/src/bin/generateDocs.js @@ -9,6 +9,10 @@ import { glob, } from 'glob'; +/** + * @param {string} code + * @returns {string} + */ const trimCode = (code) => { let lines = code.replace(/^\n/u, '').trimEnd().split('\n'); @@ -29,6 +33,11 @@ const trimCode = (code) => { return lines.join('\n').replaceAll('\r', '\\r'); }; +/** + * @param {import('eslint').RuleTester.InvalidTestCase|import('eslint').RuleTester.ValidTestCase} setup + * @param {string} ruleName + * @returns {string} + */ const formatCodeSnippet = (setup, ruleName) => { const paragraphs = []; @@ -42,8 +51,11 @@ const formatCodeSnippet = (setup, ruleName) => { paragraphs.push(`// "jsdoc/${ruleName}": ["error"|"warn", ${JSON.stringify(setup.options).slice(1)}`); } - if (setup.errors) { - paragraphs.push(`// Message: ${setup.errors[0].message}`); + if ('errors' in setup) { + paragraphs.push(`// Message: ${ + /** @type {Array} */ ( + setup.errors + )[0].message}`); } return paragraphs.join('\n'); @@ -58,9 +70,14 @@ const getAssertions = async () => { return path.basename(filePath, '.js'); }); - const assertionCodes = assertionFiles.map((filePath, idx) => { - // eslint-disable-next-line import/no-dynamic-require - const codes = require(filePath); + const assertionCodes = await Promise.all(assertionFiles.map(async (filePath, idx) => { + /** + * @type {{ + * invalid: (import('eslint').RuleTester.InvalidTestCase & {ignoreReadme?: true})[], + * valid: (import('eslint').RuleTester.ValidTestCase & {ignoreReadme?: true})[] + * }} + */ + const codes = await import(filePath); const ruleName = decamelize(assertionNames[idx], { separator: '-', @@ -82,7 +99,7 @@ const getAssertions = async () => { return formatCodeSnippet(setup, ruleName); }), }; - }); + })); return { assertionNames, @@ -145,7 +162,13 @@ const generateDocs = async () => { return docContents.map((docContent) => { return docContent.replace( //gui, - (assertionsBlock, passingFailing, ruleName) => { + /** + * @param {string} _assertionsBlock + * @param {string} passingFailing + * @param {string} ruleName + * @returns {string} + */ + (_assertionsBlock, passingFailing, ruleName) => { const ruleAssertions = assertions[ruleName]; if (!ruleAssertions) { @@ -164,10 +187,13 @@ const generateDocs = async () => { }); }; +/** + * @returns {string[]} + */ const getDocPaths = () => { const basePath = path.join(__dirname, '..', '..', '.README'); const writeBasePath = path.join(__dirname, '..', '..', 'docs'); - const docPaths = fs.readdirSync(basePath).flatMap((docFile) => { + const docPaths = /** @type {string[]} */ (fs.readdirSync(basePath).flatMap((docFile) => { if (extraFiles.includes(docFile)) { // Will get path separately below return null; @@ -190,7 +216,7 @@ const getDocPaths = () => { return null; }).filter((file) => { return file; - }); + })); return [ ...docPaths, @@ -232,7 +258,7 @@ const assertDocsAreUpToDate = async () => { const isUpToDate = fs.readFileSync(docPath, 'utf8') === docContent; if (!isUpToDate) { - throw new Error('Readme is not up to date, please run `npm run create-readme` to update it.'); + throw new Error('Readme is not up to date, please run `npm run create-docs` to update it.'); } } }; diff --git a/src/bin/generateRule.js b/src/bin/generateRule.js index b83595bb8..a88e69cf6 100644 --- a/src/bin/generateRule.js +++ b/src/bin/generateRule.js @@ -18,7 +18,8 @@ import { import camelCase from 'camelcase'; import open from 'open-editor'; -// Todo: Would ideally have prompts, e.g., to ask for whether type was problem/layout, etc. +// Todo: Would ideally have prompts, e.g., to ask for whether +// type was problem/layout, etc. const [ , , ruleName, @@ -133,6 +134,15 @@ export default iterateJsdoc(({ await fs.writeFile(ruleReadmePath, ruleReadmeTemplate); } + /** + * @param {object} cfg + * @param {string} cfg.path + * @param {RegExp} cfg.oldRegex + * @param {string} cfg.checkName + * @param {string} cfg.newLine + * @param {boolean} [cfg.oldIsCamel] + * @returns {Promise} + */ const replaceInOrder = async ({ path, oldRegex, @@ -140,11 +150,33 @@ export default iterateJsdoc(({ newLine, oldIsCamel, }) => { + /** + * @typedef {number} Integer + */ + /** + * @typedef {{ + * matchedLine: string, + * offset: Integer, + * oldRule: string, + * }} OffsetInfo + */ + /** + * @type {OffsetInfo[]} + */ const offsets = []; let readme = await fs.readFile(path, 'utf8'); readme.replace( oldRegex, + /** + * @param {string} matchedLine + * @param {string} n1 + * @param {Integer} offset + * @param {string} str + * @param {object} groups + * @param {string} groups.oldRule + * @returns {string} + */ (matchedLine, n1, offset, str, { oldRule, }) => { @@ -153,6 +185,8 @@ export default iterateJsdoc(({ offset, oldRule, }); + + return matchedLine; }, ); @@ -161,7 +195,6 @@ export default iterateJsdoc(({ }, { oldRule: oldRuleB, }) => { - // eslint-disable-next-line no-extra-parens return oldRule < oldRuleB ? -1 : (oldRule > oldRuleB ? 1 : 0); }); @@ -183,7 +216,7 @@ export default iterateJsdoc(({ } if (!item) { - item = offsets.pop(); + item = /** @type {OffsetInfo} */ (offsets.pop()); item.offset += item.matchedLine.length; } @@ -200,12 +233,12 @@ export default iterateJsdoc(({ } }; - await replaceInOrder({ - checkName: 'README', - newLine: `{"gitdown": "include", "file": "./rules/${ruleName}.md"}`, - oldRegex: /\n\{"gitdown": "include", "file": ".\/rules\/(?[^.]*).md"\}/gu, - path: './.README/README.md', - }); + // await replaceInOrder({ + // checkName: 'README', + // newLine: `{"gitdown": "include", "file": "./rules/${ruleName}.md"}`, + // oldRegex: /\n\{"gitdown": "include", "file": ".\/rules\/(?[^.]*).md"\}/gu, + // path: './.README/README.md', + // }); await replaceInOrder({ checkName: 'index import', @@ -229,7 +262,7 @@ export default iterateJsdoc(({ path: './src/index.js', }); - await import('./generateReadme.js'); + await import('./generateDocs.js'); /* console.log('Paths to open for further editing\n'); diff --git a/src/bin/gitdown.d.ts b/src/bin/gitdown.d.ts new file mode 100644 index 000000000..60192a21a --- /dev/null +++ b/src/bin/gitdown.d.ts @@ -0,0 +1,12 @@ +declare module 'gitdown' { + interface Gitdown { + setConfig: (info: { + gitinfo: { + defaultBranchName: string, + gitPath: string + } + }) => void + get: () => string + } + export function readFile(path: string): Gitdown +} diff --git a/src/index.js b/src/index.js index 257f0245c..06ef81499 100644 --- a/src/index.js +++ b/src/index.js @@ -52,7 +52,12 @@ import textEscaping from './rules/textEscaping'; import validTypes from './rules/validTypes'; const index = { + /* eslint-disable jsdoc/no-undefined-types -- Bug */ + /** + * @type {Record>} + */ configs: {}, + /* eslint-enable jsdoc/no-undefined-types -- Bug */ rules: { 'check-access': checkAccess, 'check-alignment': checkAlignment, @@ -109,6 +114,10 @@ const index = { }, }; +/** + * @param {"warn"|"error"} warnOrError + * @returns {import('eslint').ESLint.ConfigData} + */ const createRecommendedRuleset = (warnOrError) => { return { plugins: [ @@ -171,6 +180,10 @@ const createRecommendedRuleset = (warnOrError) => { }; }; +/** + * @param {"warn"|"error"} warnOrError + * @returns {import('eslint').ESLint.ConfigData} + */ const createRecommendedTypeScriptRuleset = (warnOrError) => { const ruleset = createRecommendedRuleset(warnOrError); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..f96ccde9a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "lib": ["es2022"], + "moduleResolution": "node", + "module": "esnext", + "allowJs": true, + "checkJs": true, + "noEmit": true, + "declaration": true, + "declarationMap": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "target": "es6", + "outDir": "dist" + }, + // Restore to `src/**/*.js` as ready + "include": ["src/bin/*.js", "src/bin/gitdown.d.ts"], + "exclude": ["node_modules"] +} From 55f8b0310f4fb412aba083c045258d6e31ad78de Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 9 May 2023 06:08:51 -0700 Subject: [PATCH 2/5] fix(`valid-types`): regression with object field checking; fixes #1068 --- src/rules/validTypes.js | 4 ++-- test/rules/assertions/validTypes.js | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/rules/validTypes.js b/src/rules/validTypes.js index e01e23026..95742d428 100644 --- a/src/rules/validTypes.js +++ b/src/rules/validTypes.js @@ -164,8 +164,8 @@ export default iterateJsdoc(({ if ( (typ === 'JsdocTypeObjectField' || typ === 'JsdocTypeKeyValue') && - node.right.type === 'JsdocTypeNullable' && - node.right.meta.position === 'suffix' + node.right?.type === 'JsdocTypeNullable' && + node.right?.meta?.position === 'suffix' ) { report(`Syntax error in type: ${node.right.type}`, null, tag); } diff --git a/test/rules/assertions/validTypes.js b/test/rules/assertions/validTypes.js index bb2a8f20e..8d46f1d9b 100644 --- a/test/rules/assertions/validTypes.js +++ b/test/rules/assertions/validTypes.js @@ -1783,5 +1783,12 @@ export default { }, }, }, + { + code: ` + /** + * @returns {Promise<{publicKey, privateKey}>} - The public and private key + */ + `, + }, ], }; From a30941364736d8a47a7a3a0083a7b4bc6045c3cd Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 9 May 2023 06:09:50 -0700 Subject: [PATCH 3/5] docs: update --- docs/rules/valid-types.md | 4 ++++ src/bin/generateDocs.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/rules/valid-types.md b/docs/rules/valid-types.md index f77d927f5..4271b6f73 100644 --- a/docs/rules/valid-types.md +++ b/docs/rules/valid-types.md @@ -846,5 +846,9 @@ function quux() { } // Settings: {"jsdoc":{"mode":"typescript"}} + +/** + * @returns {Promise<{publicKey, privateKey}>} - The public and private key + */ ```` diff --git a/src/bin/generateDocs.js b/src/bin/generateDocs.js index 0c3e34ec3..a815ffd4f 100644 --- a/src/bin/generateDocs.js +++ b/src/bin/generateDocs.js @@ -258,7 +258,7 @@ const assertDocsAreUpToDate = async () => { const isUpToDate = fs.readFileSync(docPath, 'utf8') === docContent; if (!isUpToDate) { - throw new Error('Readme is not up to date, please run `npm run create-docs` to update it.'); + throw new Error('Docs are not up to date, please run `npm run create-docs` to update it.'); } } }; From 4481e58654337f234934f86559891c0e9e652544 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 9 May 2023 06:20:01 -0700 Subject: [PATCH 4/5] chore: update devDeps. and lint --- package.json | 4 +- pnpm-lock.yaml | 244 +++++++++++++++++++++++++++++++++++--------- src/iterateJsdoc.js | 1 - 3 files changed, 196 insertions(+), 53 deletions(-) diff --git a/package.json b/package.json index e42c0e336..228a86e80 100644 --- a/package.json +++ b/package.json @@ -24,14 +24,14 @@ "@babel/plugin-transform-flow-strip-types": "^7.21.0", "@babel/preset-env": "^7.21.5", "@babel/register": "^7.21.0", - "@es-joy/jsdoc-eslint-parser": "^0.18.0", + "@es-joy/jsdoc-eslint-parser": "^0.19.0", "@hkdobrev/run-if-changed": "^0.3.1", "@semantic-release/commit-analyzer": "^9.0.2", "@semantic-release/github": "^8.0.7", "@semantic-release/npm": "^10.0.3", "@types/eslint": "^8.37.0", "@types/node": "^20.1.1", - "@typescript-eslint/parser": "^5.59.2", + "@typescript-eslint/parser": "^5.59.5", "babel-plugin-add-module-exports": "^1.0.4", "babel-plugin-istanbul": "^6.1.1", "camelcase": "^6.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8f0ee02b7..031a046ac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -52,8 +52,8 @@ devDependencies: specifier: ^7.21.0 version: 7.21.0(@babel/core@7.21.8) '@es-joy/jsdoc-eslint-parser': - specifier: ^0.18.0 - version: 0.18.0 + specifier: ^0.19.0 + version: 0.19.0 '@hkdobrev/run-if-changed': specifier: ^0.3.1 version: 0.3.1 @@ -73,8 +73,8 @@ devDependencies: specifier: ^20.1.1 version: 20.1.1 '@typescript-eslint/parser': - specifier: ^5.59.2 - version: 5.59.2(eslint@8.39.0)(typescript@5.0.4) + specifier: ^5.59.5 + version: 5.59.5(eslint@8.39.0)(typescript@5.0.4) babel-plugin-add-module-exports: specifier: ^1.0.4 version: 1.0.4 @@ -224,6 +224,20 @@ packages: semver: 6.3.0 dev: true + /@babel/eslint-parser@7.21.8(@babel/core@7.21.8)(eslint@8.40.0): + resolution: {integrity: sha512-HLhI+2q+BP3sf78mFUZNCGc10KEmoUqtUT1OCdMZsN+qr4qFeLUod62/zAnF3jNQstwyasDkZnVXwfK2Bml7MQ==} + engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0} + peerDependencies: + '@babel/core': '>=7.11.0' + eslint: ^7.5.0 || ^8.0.0 + dependencies: + '@babel/core': 7.21.8 + '@nicolo-ribaudo/eslint-scope-5-internals': 5.1.1-v1 + eslint: 8.40.0 + eslint-visitor-keys: 2.1.0 + semver: 6.3.0 + dev: true + /@babel/eslint-plugin@7.19.1(@babel/eslint-parser@7.21.8)(eslint@8.39.0): resolution: {integrity: sha512-ElGPkQPapKMa3zVqXHkZYzuL7I5LbRw9UWBUArgWsdWDDb9XcACqOpBib5tRPA9XvbVZYrFUkoQPbiJ4BFvu4w==} engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0} @@ -1433,15 +1447,15 @@ packages: dev: true optional: true - /@es-joy/jsdoc-eslint-parser@0.18.0: - resolution: {integrity: sha512-vMlRlszK0/nF0RAmENipGt9Re+maPlBSFxsup3UePJqWrzfch2jKCAU3Mu/SMWJUp1ME8vXCW1dqoavFcM7zXw==} + /@es-joy/jsdoc-eslint-parser@0.19.0: + resolution: {integrity: sha512-PvggHK8390M0S/KyS2hUriNu83TLpOv2fjtuKdqE7+SeIKh7o6BgbCVjh0nxbMKVWToG2rGAaMGbOQIhxcq3ew==} engines: {node: '>=12.0.0'} dependencies: '@babel/core': 7.21.8 - '@babel/eslint-parser': 7.21.8(@babel/core@7.21.8)(eslint@8.39.0) - '@es-joy/jsdoccomment': 0.37.1 - '@typescript-eslint/parser': 5.59.2(eslint@8.39.0)(typescript@5.0.4) - eslint: 8.39.0 + '@babel/eslint-parser': 7.21.8(@babel/core@7.21.8)(eslint@8.40.0) + '@es-joy/jsdoccomment': 0.38.0 + '@typescript-eslint/parser': 5.59.5(eslint@8.40.0)(typescript@5.0.4) + eslint: 8.40.0 esquery: 1.5.0 typescript: 5.0.4 transitivePeerDependencies: @@ -1457,15 +1471,6 @@ packages: jsdoc-type-pratt-parser: 2.2.5 dev: true - /@es-joy/jsdoccomment@0.37.1: - resolution: {integrity: sha512-5vxWJ1gEkEF0yRd0O+uK6dHJf7adrxwQSX8PuRiPfFSAbNLnY0ZJfXaZucoz14Jj2N11xn2DnlEPwWRpYpvRjg==} - engines: {node: ^14 || ^16 || ^17 || ^18 || ^19 || ^20} - dependencies: - comment-parser: 1.3.1 - esquery: 1.5.0 - jsdoc-type-pratt-parser: 4.0.0 - dev: true - /@es-joy/jsdoccomment@0.38.0: resolution: {integrity: sha512-TFac4Bnv0ZYNkEeDnOWHQhaS1elWlvOCQxH06iHeu5iffs+hCaLVIZJwF+FqksQi68R4i66Pu+4DfFGvble+Uw==} engines: {node: '>=16'} @@ -1473,7 +1478,6 @@ packages: comment-parser: 1.3.1 esquery: 1.5.0 jsdoc-type-pratt-parser: 4.0.0 - dev: false /@eslint-community/eslint-utils@4.4.0(eslint@8.39.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} @@ -1482,7 +1486,17 @@ packages: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: eslint: 8.39.0 - eslint-visitor-keys: 3.4.0 + eslint-visitor-keys: 3.4.1 + dev: true + + /@eslint-community/eslint-utils@4.4.0(eslint@8.40.0): + resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + dependencies: + eslint: 8.40.0 + eslint-visitor-keys: 3.4.1 dev: true /@eslint-community/regexpp@4.5.1: @@ -1490,13 +1504,13 @@ packages: engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} dev: true - /@eslint/eslintrc@2.0.2: - resolution: {integrity: sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==} + /@eslint/eslintrc@2.0.3: + resolution: {integrity: sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 debug: 4.3.4(supports-color@8.1.1) - espree: 9.5.1 + espree: 9.5.2 globals: 13.20.0 ignore: 5.2.4 import-fresh: 3.3.0 @@ -1512,6 +1526,11 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /@eslint/js@8.40.0: + resolution: {integrity: sha512-ElyB54bJIhXQYVKjDSvCkPO1iU1tSAeVQJbllWJq1XQSmmA4dgFk8CbiBGpiOPxleE48vDogxCtmMYku4HSVLA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true + /@gar/promisify@1.1.3: resolution: {integrity: sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==} dev: true @@ -2268,7 +2287,7 @@ packages: '@types/node': 20.1.1 dev: true - /@typescript-eslint/eslint-plugin@5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.39.0)(typescript@5.0.4): + /@typescript-eslint/eslint-plugin@5.59.2(@typescript-eslint/parser@5.59.5)(eslint@8.39.0)(typescript@5.0.4): resolution: {integrity: sha512-yVrXupeHjRxLDcPKL10sGQ/QlVrA8J5IYOEWVqk0lJaSZP7X5DfnP7Ns3cc74/blmbipQ1htFNVGsHX6wsYm0A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2280,7 +2299,7 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.5.1 - '@typescript-eslint/parser': 5.59.2(eslint@8.39.0)(typescript@5.0.4) + '@typescript-eslint/parser': 5.59.5(eslint@8.39.0)(typescript@5.0.4) '@typescript-eslint/scope-manager': 5.59.2 '@typescript-eslint/type-utils': 5.59.2(eslint@8.39.0)(typescript@5.0.4) '@typescript-eslint/utils': 5.59.2(eslint@8.39.0)(typescript@5.0.4) @@ -2309,8 +2328,8 @@ packages: - typescript dev: true - /@typescript-eslint/parser@5.59.2(eslint@8.39.0)(typescript@5.0.4): - resolution: {integrity: sha512-uq0sKyw6ao1iFOZZGk9F8Nro/8+gfB5ezl1cA06SrqbgJAt0SRoFhb9pXaHvkrxUpZaoLxt8KlovHNk8Gp6/HQ==} + /@typescript-eslint/parser@5.59.5(eslint@8.39.0)(typescript@5.0.4): + resolution: {integrity: sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -2319,9 +2338,9 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.59.2 - '@typescript-eslint/types': 5.59.2 - '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.0.4) + '@typescript-eslint/scope-manager': 5.59.5 + '@typescript-eslint/types': 5.59.5 + '@typescript-eslint/typescript-estree': 5.59.5(typescript@5.0.4) debug: 4.3.4(supports-color@8.1.1) eslint: 8.39.0 typescript: 5.0.4 @@ -2329,6 +2348,26 @@ packages: - supports-color dev: true + /@typescript-eslint/parser@5.59.5(eslint@8.40.0)(typescript@5.0.4): + resolution: {integrity: sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/scope-manager': 5.59.5 + '@typescript-eslint/types': 5.59.5 + '@typescript-eslint/typescript-estree': 5.59.5(typescript@5.0.4) + debug: 4.3.4(supports-color@8.1.1) + eslint: 8.40.0 + typescript: 5.0.4 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/scope-manager@5.59.2: resolution: {integrity: sha512-dB1v7ROySwQWKqQ8rEWcdbTsFjh2G0vn8KUyvTXdPoyzSL6lLGkiXEV5CvpJsEe9xIdKV+8Zqb7wif2issoOFA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2337,6 +2376,14 @@ packages: '@typescript-eslint/visitor-keys': 5.59.2 dev: true + /@typescript-eslint/scope-manager@5.59.5: + resolution: {integrity: sha512-jVecWwnkX6ZgutF+DovbBJirZcAxgxC0EOHYt/niMROf8p4PwxxG32Qdhj/iIQQIuOflLjNkxoXyArkcIP7C3A==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + '@typescript-eslint/types': 5.59.5 + '@typescript-eslint/visitor-keys': 5.59.5 + dev: true + /@typescript-eslint/type-utils@5.59.2(eslint@8.39.0)(typescript@5.0.4): resolution: {integrity: sha512-b1LS2phBOsEy/T381bxkkywfQXkV1dWda/z0PhnIy3bC5+rQWQDS7fk9CSpcXBccPY27Z6vBEuaPBCKCgYezyQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2362,6 +2409,11 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /@typescript-eslint/types@5.59.5: + resolution: {integrity: sha512-xkfRPHbqSH4Ggx4eHRIO/eGL8XL4Ysb4woL8c87YuAo8Md7AUjyWKa9YMwTL519SyDPrfEgKdewjkxNCVeJW7w==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true + /@typescript-eslint/typescript-estree@5.59.2(typescript@5.0.4): resolution: {integrity: sha512-+j4SmbwVmZsQ9jEyBMgpuBD0rKwi9RxRpjX71Brr73RsYnEr3Lt5QZ624Bxphp8HUkSKfqGnPJp1kA5nl0Sh7Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2383,6 +2435,27 @@ packages: - supports-color dev: true + /@typescript-eslint/typescript-estree@5.59.5(typescript@5.0.4): + resolution: {integrity: sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 5.59.5 + '@typescript-eslint/visitor-keys': 5.59.5 + debug: 4.3.4(supports-color@8.1.1) + globby: 11.1.0 + is-glob: 4.0.3 + semver: 7.5.0 + tsutils: 3.21.0(typescript@5.0.4) + typescript: 5.0.4 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/utils@5.59.2(eslint@8.39.0)(typescript@5.0.4): resolution: {integrity: sha512-kSuF6/77TZzyGPhGO4uVp+f0SBoYxCDf+lW3GKhtKru/L8k/Hd7NFQxyWUeY7Z/KGB2C6Fe3yf2vVi4V9TsCSQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2408,7 +2481,15 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: '@typescript-eslint/types': 5.59.2 - eslint-visitor-keys: 3.4.0 + eslint-visitor-keys: 3.4.1 + dev: true + + /@typescript-eslint/visitor-keys@5.59.5: + resolution: {integrity: sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + '@typescript-eslint/types': 5.59.5 + eslint-visitor-keys: 3.4.1 dev: true /@whatwg-node/events@0.0.3: @@ -3971,8 +4052,8 @@ packages: '@graphql-eslint/eslint-plugin': 3.18.0(@babel/core@7.21.8)(@types/node@20.1.1)(graphql@16.6.0) '@next/eslint-plugin-next': 12.3.4 '@rushstack/eslint-patch': 1.2.0 - '@typescript-eslint/eslint-plugin': 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.39.0)(typescript@5.0.4) - '@typescript-eslint/parser': 5.59.2(eslint@8.39.0)(typescript@5.0.4) + '@typescript-eslint/eslint-plugin': 5.59.2(@typescript-eslint/parser@5.59.5)(eslint@8.39.0)(typescript@5.0.4) + '@typescript-eslint/parser': 5.59.5(eslint@8.39.0)(typescript@5.0.4) eslint: 8.39.0 eslint-plugin-ava: 13.2.0(eslint@8.39.0) eslint-plugin-canonical: 2.6.0(eslint@8.39.0) @@ -3980,7 +4061,7 @@ packages: eslint-plugin-eslint-comments: 3.2.0(eslint@8.39.0) eslint-plugin-flowtype: 8.0.3(@babel/plugin-syntax-flow@7.21.4)(@babel/plugin-transform-react-jsx@7.21.5)(eslint@8.39.0) eslint-plugin-fp: 2.3.0(eslint@8.39.0) - eslint-plugin-import: 2.27.5(@typescript-eslint/parser@5.59.2)(eslint@8.39.0) + eslint-plugin-import: 2.27.5(@typescript-eslint/parser@5.59.5)(eslint@8.39.0) eslint-plugin-jest: 25.7.0(@typescript-eslint/eslint-plugin@5.59.2)(eslint@8.39.0)(typescript@5.0.4) eslint-plugin-jsdoc: 37.9.7(eslint@8.39.0) eslint-plugin-jsonc: 2.7.0(eslint@8.39.0) @@ -3991,7 +4072,7 @@ packages: eslint-plugin-node: 11.1.0(eslint@8.39.0) eslint-plugin-react: 7.32.2(eslint@8.39.0) eslint-plugin-react-hooks: 4.6.0(eslint@8.39.0) - eslint-plugin-typescript-sort-keys: 2.3.0(@typescript-eslint/parser@5.59.2)(eslint@8.39.0)(typescript@5.0.4) + eslint-plugin-typescript-sort-keys: 2.3.0(@typescript-eslint/parser@5.59.5)(eslint@8.39.0)(typescript@5.0.4) eslint-plugin-unicorn: 39.0.0(eslint@8.39.0) eslint-plugin-yml: 0.12.0(eslint@8.39.0) yaml-eslint-parser: 0.5.0 @@ -4022,7 +4103,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.0(@typescript-eslint/parser@5.59.2)(eslint-import-resolver-node@0.3.7)(eslint@8.39.0): + /eslint-module-utils@2.8.0(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint@8.39.0): resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} engines: {node: '>=4'} peerDependencies: @@ -4043,7 +4124,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.59.2(eslint@8.39.0)(typescript@5.0.4) + '@typescript-eslint/parser': 5.59.5(eslint@8.39.0)(typescript@5.0.4) debug: 3.2.7 eslint: 8.39.0 eslint-import-resolver-node: 0.3.7 @@ -4142,7 +4223,7 @@ packages: req-all: 0.1.0 dev: true - /eslint-plugin-import@2.27.5(@typescript-eslint/parser@5.59.2)(eslint@8.39.0): + /eslint-plugin-import@2.27.5(@typescript-eslint/parser@5.59.5)(eslint@8.39.0): resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==} engines: {node: '>=4'} peerDependencies: @@ -4152,7 +4233,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.59.2(eslint@8.39.0)(typescript@5.0.4) + '@typescript-eslint/parser': 5.59.5(eslint@8.39.0)(typescript@5.0.4) array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 @@ -4160,7 +4241,7 @@ packages: doctrine: 2.1.0 eslint: 8.39.0 eslint-import-resolver-node: 0.3.7 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.59.2)(eslint-import-resolver-node@0.3.7)(eslint@8.39.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint@8.39.0) has: 1.0.3 is-core-module: 2.12.0 is-glob: 4.0.3 @@ -4188,7 +4269,7 @@ packages: jest: optional: true dependencies: - '@typescript-eslint/eslint-plugin': 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.39.0)(typescript@5.0.4) + '@typescript-eslint/eslint-plugin': 5.59.2(@typescript-eslint/parser@5.59.5)(eslint@8.39.0)(typescript@5.0.4) '@typescript-eslint/experimental-utils': 5.59.2(eslint@8.39.0)(typescript@5.0.4) eslint: 8.39.0 transitivePeerDependencies: @@ -4328,7 +4409,7 @@ packages: string.prototype.matchall: 4.0.8 dev: true - /eslint-plugin-typescript-sort-keys@2.3.0(@typescript-eslint/parser@5.59.2)(eslint@8.39.0)(typescript@5.0.4): + /eslint-plugin-typescript-sort-keys@2.3.0(@typescript-eslint/parser@5.59.5)(eslint@8.39.0)(typescript@5.0.4): resolution: {integrity: sha512-3LAcYulo5gNYiPWee+TksITfvWeBuBjGgcSLTacPESFVKEoy8laOQuZvJlSCwTBHT2SCGIxr3bJ56zuux+3MCQ==} engines: {node: 12 || >= 13.9} peerDependencies: @@ -4337,7 +4418,7 @@ packages: typescript: ^3 || ^4 || ^5 dependencies: '@typescript-eslint/experimental-utils': 5.59.2(eslint@8.39.0)(typescript@5.0.4) - '@typescript-eslint/parser': 5.59.2(eslint@8.39.0)(typescript@5.0.4) + '@typescript-eslint/parser': 5.59.5(eslint@8.39.0)(typescript@5.0.4) eslint: 8.39.0 json-schema: 0.4.0 natural-compare-lite: 1.4.0 @@ -4455,6 +4536,11 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /eslint-visitor-keys@3.4.1: + resolution: {integrity: sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true + /eslint@8.39.0: resolution: {integrity: sha512-mwiok6cy7KTW7rBpo05k6+p4YVZByLNjAZ/ACB9DRCu4YDRwjXI01tWHp6KAUWelsBetTxKK/2sHB0vdS8Z2Og==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -4462,7 +4548,7 @@ packages: dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.39.0) '@eslint-community/regexpp': 4.5.1 - '@eslint/eslintrc': 2.0.2 + '@eslint/eslintrc': 2.0.3 '@eslint/js': 8.39.0 '@humanwhocodes/config-array': 0.11.8 '@humanwhocodes/module-importer': 1.0.1 @@ -4474,8 +4560,57 @@ packages: doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.0 - eslint-visitor-keys: 3.4.0 - espree: 9.5.1 + eslint-visitor-keys: 3.4.1 + espree: 9.5.2 + esquery: 1.5.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 6.0.1 + find-up: 5.0.0 + glob-parent: 6.0.2 + globals: 13.20.0 + grapheme-splitter: 1.0.4 + ignore: 5.2.4 + import-fresh: 3.3.0 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + is-path-inside: 3.0.3 + js-sdsl: 4.4.0 + js-yaml: 4.1.0 + json-stable-stringify-without-jsonify: 1.0.1 + levn: 0.4.1 + lodash.merge: 4.6.2 + minimatch: 3.1.2 + natural-compare: 1.4.0 + optionator: 0.9.1 + strip-ansi: 6.0.1 + strip-json-comments: 3.1.1 + text-table: 0.2.0 + transitivePeerDependencies: + - supports-color + dev: true + + /eslint@8.40.0: + resolution: {integrity: sha512-bvR+TsP9EHL3TqNtj9sCNJVAFK3fBN8Q7g5waghxyRsPLIMwL73XSKnZFK0hk/O2ANC+iAoq6PWMQ+IfBAJIiQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + hasBin: true + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.40.0) + '@eslint-community/regexpp': 4.5.1 + '@eslint/eslintrc': 2.0.3 + '@eslint/js': 8.40.0 + '@humanwhocodes/config-array': 0.11.8 + '@humanwhocodes/module-importer': 1.0.1 + '@nodelib/fs.walk': 1.2.8 + ajv: 6.12.6 + chalk: 4.1.2 + cross-spawn: 7.0.3 + debug: 4.3.4(supports-color@8.1.1) + doctrine: 3.0.0 + escape-string-regexp: 4.0.0 + eslint-scope: 7.2.0 + eslint-visitor-keys: 3.4.1 + espree: 9.5.2 esquery: 1.5.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 @@ -4510,7 +4645,16 @@ packages: dependencies: acorn: 8.8.2 acorn-jsx: 5.3.2(acorn@8.8.2) - eslint-visitor-keys: 3.4.0 + eslint-visitor-keys: 3.4.1 + dev: true + + /espree@9.5.2: + resolution: {integrity: sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + acorn: 8.8.2 + acorn-jsx: 5.3.2(acorn@8.8.2) + eslint-visitor-keys: 3.4.1 dev: true /esprima@4.0.1: @@ -6181,8 +6325,8 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: acorn: 8.8.2 - eslint-visitor-keys: 3.4.0 - espree: 9.5.1 + eslint-visitor-keys: 3.4.1 + espree: 9.5.2 semver: 7.5.0 dev: true diff --git a/src/iterateJsdoc.js b/src/iterateJsdoc.js index 245b93cd8..47d08fe0a 100644 --- a/src/iterateJsdoc.js +++ b/src/iterateJsdoc.js @@ -617,7 +617,6 @@ const getUtils = ( postName = ''; } else if (postType) { postType = ''; - // eslint-disable-next-line no-inline-comments } else /* istanbul ignore else -- `comment-parser` prevents empty blocks currently per https://github.com/syavorsky/comment-parser/issues/128 */ if (postTag) { postTag = ''; } From c9454c1de50b8b123031e32a6778adb03998e598 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 9 May 2023 06:29:45 -0700 Subject: [PATCH 5/5] chore: prevent eslint updating for now --- .ncurc.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ncurc.js b/.ncurc.js index 72e20a476..9aa73b7be 100644 --- a/.ncurc.js +++ b/.ncurc.js @@ -8,6 +8,9 @@ module.exports = { 'escape-string-regexp', 'open-editor', + // Todo: When canonical includes latest Unicorn + 'eslint', + // Todo: Waiting on merge https://github.com/gajus/eslint-plugin-canonical/pull/22 'eslint-config-canonical', ],