question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

no-undef should apply on assigning a property to an undefined variable

See original GitHub issue

What rule do you want to change? no-undef

Does this change cause the rule to produce more or fewer warnings? more

How will the change be implemented? (New option, new default behavior, etc.)? maybe a new option

Please provide some example code that this change will affect: The following assignment should not be allowed if the rule is active, assuming Text is an undefined variable.

Text.propTypes = { a: 'b' }

What does the rule currently do for this code? It does not apply on this case and can potentially break builds.

What will the rule do after it’s changed? It will warn or error if there is an property-assignment to an undefined variable.

Are you willing to submit a pull request to implement this change? Yes

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

ESLint's "no-undef" rule is calling my use of Underscore an ...
Any reference to an undeclared variable causes a warning, unless the variable is explicitly mentioned in a /*global ...*/ comment, or specified ...
Read more >
no-undef - ESLint - Pluggable JavaScript Linter
no-undef. Disallow the use of undeclared variables unless mentioned in /*global */ ... The "extends": "eslint:recommended" property in a configuration file ...
Read more >
undefined - JavaScript - MDN Web Docs - Mozilla
The global undefined property represents the primitive value ... A variable that has not been assigned a value is of type undefined ....
Read more >
List of available rules - ESLint - Pluggable JavaScript linter
The "extends": "eslint:recommended" property in a configuration file enables rules that ... enforce the use of variables within the scope they are defined....
Read more >
7 Tips to Handle undefined in JavaScript - Dmitri Pavlutin
JavaScript doesn't initialize variables or object properties with null . ... Ideally, you would assign a value right away after declaration ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found