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

Add no innerHTML rule #137

Merged
merged 3 commits into from
Sep 9, 2021
Merged

Add no innerHTML rule #137

merged 3 commits into from
Sep 9, 2021

Conversation

manuelpuyol
Copy link
Contributor

Adds a rule that disallows the usage of innerHTML with some kind of content.
The only allowed use is innerHTML = ''

// bad
function setContent(element, content) {
  element.innerHTML = content
}
// good
function clearContent(element) {
  element.innerHTML = ''
}

Copy link
Contributor

@dgreif dgreif left a comment

Choose a reason for hiding this comment

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

Looks like a great rule to add!

lib/rules/no-inner-html.js Outdated Show resolved Hide resolved
@manuelpuyol manuelpuyol merged commit 21bdd7f into main Sep 9, 2021
@dgreif dgreif deleted the no-innerHTML branch September 9, 2021 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants