Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: avoid_shadowing_core_libraries_identifiers #59566

Open
mateusfccp opened this issue Nov 8, 2024 · 0 comments
Open

proposal: avoid_shadowing_core_libraries_identifiers #59566

mateusfccp opened this issue Nov 8, 2024 · 0 comments
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-lint-proposal linter-status-pending P3 A lower priority bug or feature request

Comments

@mateusfccp
Copy link
Contributor

mateusfccp commented Nov 8, 2024

avoid_shadowing_core_libraries_identifiers

Description

Avoid shadowing identifiers provided by core (dart:*) libraries.

Details

It's not an error to shadow identifiers provided by core libraries.

For instance, one can define a class named Type and no error will be emitted.

Even though the identifier is present in the scope, there's an exception that allows a declaration from a non-system library to shadow declarations from system libraries.

This is usually undesired, and may be done without the programmer realizing that he is shadowing a core identifier.

Kind

Guard against errors.

Bad Examples

// Bad
class Type {}

Good Examples

// Good
class MyType {}

Discussion

Similar to #58326 (the cause is the same, but while the mentioned issue is related to importing, this one is related to the declaration of the identifiers themselves).

@devoncarew devoncarew added analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Nov 20, 2024
@devoncarew devoncarew transferred this issue from dart-lang/linter Nov 20, 2024
@pq pq added the P3 A lower priority bug or feature request label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-lint-proposal linter-status-pending P3 A lower priority bug or feature request
Projects
None yet
Development

No branches or pull requests

3 participants