Skip to content

Commit feb65e4

Browse files
authored
fix(no-undefined-types): add Intl to global types and ensure arbitrary properties of globals can be addressed; fixes #1423 (#1424)
1 parent 9b8efbd commit feb65e4

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

docs/rules/no-undefined-types.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,5 +989,12 @@ class SomeClass {
989989
* {@link SomeClass.someMethod}
990990
* @returns something
991991
*/
992+
993+
/**
994+
* The internationalized collator object that will be used.
995+
* Intl.Collator(null, {numeric: true, sensitivity: 'base'}) is used by default;.
996+
*
997+
* @member {Intl.Collator}
998+
*/
992999
````
9931000

src/rules/noUndefinedTypes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const extraTypes = [
1717
'number', 'bigint', 'NaN', 'Infinity',
1818
'any', '*', 'never', 'unknown', 'const',
1919
'this', 'true', 'false',
20-
'Array', 'Object', 'RegExp', 'Date', 'Function',
20+
'Array', 'Object', 'RegExp', 'Date', 'Function', 'Intl',
2121
];
2222

2323
const typescriptGlobals = [
@@ -471,6 +471,7 @@ export default iterateJsdoc(({
471471
// check their properties which may or may not exist
472472
!imports.includes(val) && !globals.includes(val) &&
473473
!importTags.includes(val) &&
474+
!extraTypes.includes(val) &&
474475
!typedefDeclarations.includes(val) &&
475476
currNode && 'right' in currNode &&
476477
currNode.right?.type === 'JsdocTypeProperty') {

test/rules/assertions/noUndefinedTypes.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,5 +1719,15 @@ export default /** @type {import('../index.js').TestCases} */ ({
17191719
*/
17201720
`,
17211721
},
1722+
{
1723+
code: `
1724+
/**
1725+
* The internationalized collator object that will be used.
1726+
* Intl.Collator(null, {numeric: true, sensitivity: 'base'}) is used by default;.
1727+
*
1728+
* @member {Intl.Collator}
1729+
*/
1730+
`,
1731+
},
17221732
],
17231733
});

0 commit comments

Comments
 (0)