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

Rule proposal: prefer-textcontent #156

Closed
sindresorhus opened this issue Feb 15, 2018 · 10 comments
Closed

Rule proposal: prefer-textcontent #156

sindresorhus opened this issue Feb 15, 2018 · 10 comments
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted

Comments

@sindresorhus
Copy link
Owner

sindresorhus commented Feb 15, 2018

Issuehunt badges

Idea from: refined-github/refined-github#1088 (comment)

Prefer node.textContent over node.innerText.

See: https://stackoverflow.com/a/35213639/64949

With ESLint, we can't know the type, but I guess we can safely assume .innerText refers to a DOM element, and if not, you can always disable it. Maybe it would be possible if env is browser and only validate then.

Thoughts?

alexzherdev earned $60.00 by resolving this issue!

@jamiebuilds

This comment has been minimized.

@sindresorhus

This comment has been minimized.

@wu-s-john

This comment has been minimized.

@jamiebuilds

This comment has been minimized.

@IssueHuntBot
Copy link

@issuehuntfest has funded $60.00 to this issue. See it on IssueHunt

@alexzherdev
Copy link
Contributor

alexzherdev commented Jan 27, 2019

@sindresorhus I'm willing to work on this 👍Do you have a preferred way of determining we're in a browser?
Opened #223 for now.

@IssueHuntBot
Copy link

@alexzherdev has submitted a pull request. See it on IssueHunt

@sindresorhus
Copy link
Owner Author

Do you have a preferred way of determining we're in a browser?

There's no way to know that. We'll just have to assume .innerText means the node property.

@alexzherdev
Copy link
Contributor

Oh you're right, I confused with runtime detection 🤦‍♂️

sindresorhus pushed a commit that referenced this issue Feb 7, 2019
@IssueHuntBot
Copy link

@sindresorhus has rewarded $54.00 to @alexzherdev. See it on IssueHunt

  • 💰 Total deposit: $60.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $6.00

@issuehunt-oss issuehunt-oss bot added the 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt label May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted
Projects
None yet
Development

No branches or pull requests

5 participants