Skip to content

fix(no-undefined-types): check class and interface globals#1421

Merged
brettz9 merged 1 commit intogajus:mainfrom
brettz9:interface-globals
Jun 30, 2025
Merged

fix(no-undefined-types): check class and interface globals#1421
brettz9 merged 1 commit intogajus:mainfrom
brettz9:interface-globals

Conversation

@brettz9
Copy link
Copy Markdown
Collaborator

@brettz9 brettz9 commented Jun 30, 2025

fix(no-undefined-types): check class and interface globals; fixes #1420

@brettz9 brettz9 requested a review from Copilot June 30, 2025 01:07
@brettz9 brettz9 added the bug label Jun 30, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR extends the no-undefined-types rule to recognize class and interface global members, ensuring their properties and methods are treated as defined types. It adds corresponding tests and updates documentation examples.

  • Enhance rule logic to handle ClassDeclaration and TSInterfaceDeclaration, flattening member names.
  • Add new valid test cases for interface properties and class methods.
  • Update markdown docs with interface and class usage examples.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
test/rules/assertions/noUndefinedTypes.js Added valid test cases for interface property and class method references
src/rules/noUndefinedTypes.js Switched map to flatMap and added switch handling for classes and interfaces
docs/rules/no-undefined-types.md Inserted interface/class examples into documentation
Comments suppressed due to low confidence (1)

docs/rules/no-undefined-types.md:975

  • The new interface and class examples are not wrapped in a Markdown code fence or have mismatched fence counts, which will break formatting. Add a matching ```js block before these lines or adjust the closing fence.
export interface SomeInterface {

Comment thread src/rules/noUndefinedTypes.js Outdated
Comment thread src/rules/noUndefinedTypes.js
Comment thread src/rules/noUndefinedTypes.js
@brettz9 brettz9 force-pushed the interface-globals branch from 97450f1 to f3a1708 Compare June 30, 2025 01:11
@brettz9 brettz9 merged commit 3748bbe into gajus:main Jun 30, 2025
4 checks passed
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 51.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@brettz9 brettz9 deleted the interface-globals branch June 30, 2025 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no-undefined-types errors when referencing property of interface defined in the same file

2 participants