diff --git a/README.md b/README.md index 9638ef9..fef18c1 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,6 @@ I update dependencies regularly. These are the steps: 1. **Add type checking with TypeScript?** Yes, using JavaScript with JSDoc comments. 1. Add ESLint, Prettier and Vitest. 1. Revert `README.md`. +1. Run `pnpm i -D eslint-plugin-jsdoc`. +1. Check changes in `eslint.config.js` and manually revert preserving `eslint-plugin-jsdoc`. 1. Delete folder `node_modules` and file `pnpm-lock.yaml` and run `pnpm i`. diff --git a/eslint.config.js b/eslint.config.js index e6d28f3..312ca8a 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,6 +1,7 @@ import js from '@eslint/js'; -import svelte from 'eslint-plugin-svelte'; import prettier from 'eslint-config-prettier'; +import jsdoc from 'eslint-plugin-jsdoc'; +import svelte from 'eslint-plugin-svelte'; import globals from 'globals'; /** @type {import('eslint').Linter.FlatConfig[]} */ @@ -9,6 +10,7 @@ export default [ ...svelte.configs['flat/recommended'], prettier, ...svelte.configs['flat/prettier'], + jsdoc.configs['flat/recommended'], { languageOptions: { globals: { diff --git a/package.json b/package.json index cb5fbaa..5742cf1 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "@types/eslint": "^8.56.7", "eslint": "^9.0.0", "eslint-config-prettier": "^9.1.0", + "eslint-plugin-jsdoc": "^48.5.0", "eslint-plugin-svelte": "^2.36.0", "globals": "^15.0.0", "prettier": "^3.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9822102..f71bade 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,6 +29,9 @@ importers: eslint-config-prettier: specifier: ^9.1.0 version: 9.1.0(eslint@9.6.0) + eslint-plugin-jsdoc: + specifier: ^48.5.0 + version: 48.5.0(eslint@9.6.0) eslint-plugin-svelte: specifier: ^2.36.0 version: 2.41.0(eslint@9.6.0)(svelte@4.2.18) @@ -69,6 +72,10 @@ packages: resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} + '@es-joy/jsdoccomment@0.43.1': + resolution: {integrity: sha512-I238eDtOolvCuvtxrnqtlBaw0BwdQuYqK7eA6XIonicMdOOOb75mqdIzkGDUbS04+1Di007rgm9snFRNeVrOog==} + engines: {node: '>=16'} + '@esbuild/aix-ppc64@0.21.5': resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==} engines: {node: '>=12'} @@ -275,6 +282,10 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@pkgr/core@0.1.1': + resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + '@polka/url@1.0.0-next.25': resolution: {integrity: sha512-j7P6Rgr3mmtdkeDGTe0E/aYyWEWVtc5yFXtHCRHs28/jptDEWfaVOc5T7cblqy1XKPPfCxJc/8DwQ5YgLOZOVQ==} @@ -412,6 +423,10 @@ packages: '@types/pug@2.0.10': resolution: {integrity: sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==} + '@typescript-eslint/types@7.15.0': + resolution: {integrity: sha512-aV1+B1+ySXbQH0pLK0rx66I3IkiZNidYobyfn0WFsdGhSXw+P3YOqeTq5GED458SfB24tg+ux3S+9g118hjlTw==} + engines: {node: ^18.18.0 || >=20.0.0} + '@vitest/expect@1.6.0': resolution: {integrity: sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==} @@ -460,6 +475,10 @@ packages: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} + are-docs-informative@0.0.2: + resolution: {integrity: sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==} + engines: {node: '>=14'} + argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} @@ -526,6 +545,10 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + comment-parser@1.4.1: + resolution: {integrity: sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==} + engines: {node: '>= 12.0.0'} + concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} @@ -587,6 +610,9 @@ packages: resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + es-module-lexer@1.5.4: + resolution: {integrity: sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==} + es6-promise@3.3.1: resolution: {integrity: sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==} @@ -611,6 +637,12 @@ packages: peerDependencies: eslint: '>=7.0.0' + eslint-plugin-jsdoc@48.5.0: + resolution: {integrity: sha512-ukXPNpGby3KjCveCizIS8t1EbuJEHYEu/tBg8GCbn/YbHcXwphyvYCdvRZ/oMRfTscGSSzfsWoZ+ZkAP0/6YMQ==} + engines: {node: '>=18'} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 + eslint-plugin-svelte@2.41.0: resolution: {integrity: sha512-gjU9Q/psxbWG1VNwYbEb0Q6U4W5PBGaDpYmO2zlQ+zlAMVS3Qt0luAK0ACi/tMSwRK6JENiySvMyJbO0YWmXSg==} engines: {node: ^14.17.0 || >=16.0.0} @@ -827,6 +859,10 @@ packages: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true + jsdoc-type-pratt-parser@4.0.0: + resolution: {integrity: sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==} + engines: {node: '>=12.0.0'} + json-buffer@3.0.1: resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} @@ -978,6 +1014,10 @@ packages: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} + parse-imports@2.1.0: + resolution: {integrity: sha512-JQWgmK2o4w8leUkZeZPatWdAny6vXGU/3siIUvMF6J2rDCud9aTt8h/px9oZJ6U3EcfhngBJ635uPFI0q0VAeA==} + engines: {node: '>= 18'} + pascal-case@3.1.2: resolution: {integrity: sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==} @@ -1141,6 +1181,9 @@ packages: resolution: {integrity: sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==} engines: {node: '>= 10'} + slashes@3.0.12: + resolution: {integrity: sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA==} + sorcery@0.11.1: resolution: {integrity: sha512-o7npfeJE6wi6J9l0/5LKshFzZ2rMatRiCDwYeDQaOzqdzRJwALhX7mk/A/ecg6wjMu7wdZbmXfD2S/vpOg0bdQ==} hasBin: true @@ -1149,6 +1192,15 @@ packages: resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} engines: {node: '>=0.10.0'} + spdx-exceptions@2.5.0: + resolution: {integrity: sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==} + + spdx-expression-parse@4.0.0: + resolution: {integrity: sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==} + + spdx-license-ids@3.0.18: + resolution: {integrity: sha512-xxRs31BqRYHwiMzudOrpSiHtZ8i/GeionCBDSilhYRj+9gIcI8wCZTlXZKu9vZIVqViP3dcp9qE5G6AlIaD+TQ==} + stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} @@ -1246,6 +1298,10 @@ packages: resolution: {integrity: sha512-d0FdzYIiAePqRJEb90WlJDkjUEx42xhivxN8muUBmfZnP+tzUgz12DJ2hRJi8sIHCME7jeK1PTMgKPSfTd8JrA==} engines: {node: '>=16'} + synckit@0.9.0: + resolution: {integrity: sha512-7RnqIMq572L8PeEzKeBINYEJDDxpcH8JEgLwUqBd3TkofhFRbkq4QLR0u+36avGAhCRbk2nnmjcW9SE531hPDg==} + engines: {node: ^14.18.0 || >=16.0.0} + text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} @@ -1398,6 +1454,15 @@ snapshots: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 + '@es-joy/jsdoccomment@0.43.1': + dependencies: + '@types/eslint': 8.56.10 + '@types/estree': 1.0.5 + '@typescript-eslint/types': 7.15.0 + comment-parser: 1.4.1 + esquery: 1.5.0 + jsdoc-type-pratt-parser: 4.0.0 + '@esbuild/aix-ppc64@0.21.5': optional: true @@ -1537,6 +1602,8 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 + '@pkgr/core@0.1.1': {} + '@polka/url@1.0.0-next.25': {} '@rollup/rollup-android-arm-eabi@4.18.0': @@ -1659,6 +1726,8 @@ snapshots: '@types/pug@2.0.10': {} + '@typescript-eslint/types@7.15.0': {} + '@vitest/expect@1.6.0': dependencies: '@vitest/spy': 1.6.0 @@ -1718,6 +1787,8 @@ snapshots: normalize-path: 3.0.0 picomatch: 2.3.1 + are-docs-informative@0.0.2: {} + argparse@2.0.1: {} aria-query@5.3.0: @@ -1798,6 +1869,8 @@ snapshots: color-name@1.1.4: {} + comment-parser@1.4.1: {} + concat-map@0.0.1: {} confbox@0.1.7: {} @@ -1839,6 +1912,8 @@ snapshots: diff-sequences@29.6.3: {} + es-module-lexer@1.5.4: {} + es6-promise@3.3.1: {} esbuild@0.21.5: @@ -1878,6 +1953,22 @@ snapshots: dependencies: eslint: 9.6.0 + eslint-plugin-jsdoc@48.5.0(eslint@9.6.0): + dependencies: + '@es-joy/jsdoccomment': 0.43.1 + are-docs-informative: 0.0.2 + comment-parser: 1.4.1 + debug: 4.3.5 + escape-string-regexp: 4.0.0 + eslint: 9.6.0 + esquery: 1.5.0 + parse-imports: 2.1.0 + semver: 7.6.2 + spdx-expression-parse: 4.0.0 + synckit: 0.9.0 + transitivePeerDependencies: + - supports-color + eslint-plugin-svelte@2.41.0(eslint@9.6.0)(svelte@4.2.18): dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@9.6.0) @@ -2120,6 +2211,8 @@ snapshots: dependencies: argparse: 2.0.1 + jsdoc-type-pratt-parser@4.0.0: {} + json-buffer@3.0.1: {} json-schema-traverse@0.4.1: {} @@ -2262,6 +2355,11 @@ snapshots: dependencies: callsites: 3.1.0 + parse-imports@2.1.0: + dependencies: + es-module-lexer: 1.5.4 + slashes: 3.0.12 + pascal-case@3.1.2: dependencies: no-case: 3.0.4 @@ -2417,6 +2515,8 @@ snapshots: mrmime: 2.0.0 totalist: 3.0.1 + slashes@3.0.12: {} + sorcery@0.11.1: dependencies: '@jridgewell/sourcemap-codec': 1.4.15 @@ -2426,6 +2526,15 @@ snapshots: source-map-js@1.2.0: {} + spdx-exceptions@2.5.0: {} + + spdx-expression-parse@4.0.0: + dependencies: + spdx-exceptions: 2.5.0 + spdx-license-ids: 3.0.18 + + spdx-license-ids@3.0.18: {} + stackback@0.0.2: {} std-env@3.7.0: {} @@ -2521,6 +2630,11 @@ snapshots: magic-string: 0.30.10 periscopic: 3.1.0 + synckit@0.9.0: + dependencies: + '@pkgr/core': 0.1.1 + tslib: 2.6.3 + text-table@0.2.0: {} tiny-glob@0.2.9: