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

Disable ESLint's no-extend-native for two lines #9625

Merged
merged 1 commit into from
May 20, 2017

Conversation

paulmanta
Copy link
Contributor

This fixes the following two no-extend-native warnings by adding eslint-disable-line comments.

src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
  819:11  warning  Object prototype is read only, properties should not be added  no-extend-native
  828:11  warning  Object prototype is read only, properties should not be added  no-extend-native

I also had to move the code around a bit so both ESLint and Prettier would be satisfied. Initially the code was like like this:

Object.prototype.toString = function() { // eslint-disable-line no-extend-native
  ...
}

But Prettier moved the comment on the following line, which cased the ESLint warning to appear again.

Object.prototype.toString = function() {
  // eslint-disable-line no-extend-native
  ...
}

Moving the comment before the assignment prevented Prettier from reformatting the code but did not disable the warning, so I refactored the code like this:

let  wrappedToString = function() {
  ...
}
Object.prototype.toString = wrappedToString; // eslint-disable-line no-extend-native

The PR that introduced the warnings is #9163.

Copy link
Contributor

@nhunzaker nhunzaker left a comment

Choose a reason for hiding this comment

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

This looks good to me. Thanks for the fix! I'll merge this tomorrow afternoon unless anyone has an outstanding concern.

@nhunzaker nhunzaker merged commit 4b53dd0 into facebook:master May 20, 2017
@nhunzaker
Copy link
Contributor

Cool. Thanks for taking the time to look into this!

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.

3 participants