Skip to content

Commit 742578e

Browse files
committed
lint jsdoc
1 parent 71b41f1 commit 742578e

12 files changed

Lines changed: 242 additions & 45 deletions

File tree

eslint.config.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { includeIgnoreFile } from '@eslint/compat'
44
import js from '@eslint/js'
55
import stylistic from '@stylistic/eslint-plugin'
66
import { defineConfig } from 'eslint/config'
7+
import jsdoc from 'eslint-plugin-jsdoc'
78
import simpleImportSort from 'eslint-plugin-simple-import-sort'
89
import globals from 'globals'
910
import tseslint from 'typescript-eslint'
@@ -13,15 +14,30 @@ const gitignorePath = fileURLToPath(new URL('.gitignore', import.meta.url))
1314
export default defineConfig([
1415
includeIgnoreFile(gitignorePath, 'Imported .gitignore patterns'),
1516
{
16-
files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
17-
plugins: { js, '@stylistic': stylistic, 'simple-import-sort': simpleImportSort },
17+
files: ['**/*.{ts,js}'],
18+
plugins: { js, '@stylistic': stylistic },
1819
extends: ['js/recommended'],
1920
languageOptions: { globals: { ...globals.browser, ...globals.node } },
21+
},
22+
tseslint.configs.recommended,
23+
stylistic.configs.recommended,
24+
jsdoc.configs['flat/recommended-error'],
25+
{
26+
files: ['**/*.{js,ts}'],
27+
plugins: { 'simple-import-sort': simpleImportSort, jsdoc },
2028
rules: {
2129
'simple-import-sort/imports': 'error',
2230
'simple-import-sort/exports': 'error',
31+
'jsdoc/require-yields-type': 'off',
32+
'jsdoc/require-param-type': 'off',
33+
'jsdoc/require-returns-type': 'off',
2334
},
2435
},
25-
tseslint.configs.recommended,
26-
stylistic.configs.recommended,
36+
{
37+
files: ['tests/*.ts'],
38+
rules: {
39+
'jsdoc/require-jsdoc': 'off',
40+
},
41+
},
42+
2743
])

package-lock.json

Lines changed: 196 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"@vitest/coverage-v8": "4.0.7",
4444
"bumpp": "10.3.1",
4545
"eslint": "9.39.1",
46+
"eslint-plugin-jsdoc": "^61.1.12",
4647
"eslint-plugin-simple-import-sort": "^12.1.1",
4748
"globals": "16.5.0",
4849
"tsdown": "0.16.0",

src/check.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
/**
22
* Throws if the provided value is not a strictly positive integer. Undefined is allowed.
3-
*
43
* @param value The desired value.
54
* @returns The validated value: a strictly positive integer.
65
*/
7-
export function checkStrictlyPositiveInteger(value?: undefined): undefined
8-
export function checkStrictlyPositiveInteger(value: number): number
9-
export function checkStrictlyPositiveInteger(value?: number): number | undefined
106
export function checkStrictlyPositiveInteger(value?: number): number | undefined {
117
if (
128
value === undefined
@@ -22,13 +18,9 @@ export function checkStrictlyPositiveInteger(value?: number): number | undefined
2218

2319
/**
2420
* Throws if the provided value is not a non-negative integer. Undefined is allowed.
25-
*
2621
* @param value The desired value.
2722
* @returns The validated value: a non-negative integer.
2823
*/
29-
export function checkNonNegativeInteger(value?: undefined): undefined
30-
export function checkNonNegativeInteger(value: number): number
31-
export function checkNonNegativeInteger(value?: number): number | undefined
3224
export function checkNonNegativeInteger(value?: number): number | undefined {
3325
if (
3426
value === undefined

0 commit comments

Comments
 (0)