Hyperline / hyperline

✨ Status line plugin for Hyper ✨
MIT License
616 stars 120 forks source link

Figure out why XO is throwing lint error on navigator object #106

Closed corbin-r closed 7 years ago

corbin-r commented 7 years ago

Overview

Builder and linter version info:

Node v6.11.0
NPM v3.10.10
XO v0.18.2

If you run npm run lint XO will throw an error:

  src/lib/plugins/battery.js:40:5
  ✖  40:5   navigator is not defined.      no-undef
  ✖  54:5   navigator is not defined.      no-undef

Issue

navigator is not being accessed despite being inside the componentDidMount() and componentWilUnmount() methods (see this article).

Temporary/Permanent fix implementation

I did add eslint no-undef: 0 to the top of battery.js and that resolved the issue, so until We/I are certain that this issue is caused by XO doing its job or if this is an issue with navigator, in any case this serves as a fix.

TODO

Work on figuring out why navigator is not being accessed properly inside the two aforementioned methods.

Note

It should be noted that the battery plugin is still working, so perhaps navigator is being accessed and XO is just freaking out because it's not an 'imported' module.

corbin-r commented 7 years ago

Sorry for all the title edits, I botched the title 4 times go me 🙌🏻

corbin-r commented 7 years ago

Never mind, I realized this is caused by XO doing its job... navigator doesn't have a 'package' so it can't be imported, it's used on runtime.

This is simply XO doing what it's supposed to do, I'm closing this issue.

corbin-r commented 7 years ago

I will however, add a quick fix and create a PR.