diff --git a/.README/rules/no-undefined-types.md b/.README/rules/no-undefined-types.md index f5b6025fc..75b082d85 100644 --- a/.README/rules/no-undefined-types.md +++ b/.README/rules/no-undefined-types.md @@ -26,7 +26,7 @@ The following types are always considered defined. - `null`, `undefined`, `void`, `string`, `boolean`, `object`, `function`, `symbol` - `number`, `bigint`, `NaN`, `Infinity` -- `any`, `*` +- `any`, `*`, `never`, `unknown`, `const` - `this`, `true`, `false` - `Array`, `Object`, `RegExp`, `Date`, `Function` diff --git a/README.md b/README.md index 57cd0500f..ecd6719dd 100644 --- a/README.md +++ b/README.md @@ -9549,7 +9549,7 @@ The following types are always considered defined. - `null`, `undefined`, `void`, `string`, `boolean`, `object`, `function`, `symbol` - `number`, `bigint`, `NaN`, `Infinity` -- `any`, `*` +- `any`, `*`, `never`, `unknown`, `const` - `this`, `true`, `false` - `Array`, `Object`, `RegExp`, `Date`, `Function` @@ -9897,14 +9897,6 @@ function foo () { } -/** - * - * - */ -function foo () { - -} - /** * @param {MyType} foo - Bar. * @param {HisType} bar - Foo. @@ -10189,6 +10181,11 @@ export class Foo { } } // Settings: {"jsdoc":{"mode":"typescript"}} + +/** + * @type {const} + */ +const a = 'string'; ```` diff --git a/src/rules/noUndefinedTypes.js b/src/rules/noUndefinedTypes.js index 4e900c98f..4268612fd 100644 --- a/src/rules/noUndefinedTypes.js +++ b/src/rules/noUndefinedTypes.js @@ -14,7 +14,7 @@ const extraTypes = [ 'null', 'undefined', 'void', 'string', 'boolean', 'object', 'function', 'symbol', 'number', 'bigint', 'NaN', 'Infinity', - 'any', '*', 'never', + 'any', '*', 'never', 'unknown', 'const', 'this', 'true', 'false', 'Array', 'Object', 'RegExp', 'Date', 'Function', ]; diff --git a/test/rules/assertions/noUndefinedTypes.js b/test/rules/assertions/noUndefinedTypes.js index e5d0a16a3..c5cd6c848 100644 --- a/test/rules/assertions/noUndefinedTypes.js +++ b/test/rules/assertions/noUndefinedTypes.js @@ -634,17 +634,6 @@ export default { } `, }, - { - code: ` - /** - * - * - */ - function foo () { - - } - `, - }, { code: ` /** @@ -1215,5 +1204,13 @@ export default { }, }, }, + { + code: ` + /** + * @type {const} + */ + const a = 'string'; + `, + }, ], };