ricardofbarros / linter-js-standard

Atom linter plugin for JavaScript, using JavaScript Standard Style
https://atom.io/packages/linter-js-standard
MIT License
99 stars 50 forks source link

Remove warning for localStorage? #201

Closed pawel2105 closed 7 years ago

pawel2105 commented 7 years ago

How can I remove warnings for definition of localStorage? In a JS file I can use it without issue but the plugin complains about a lack of definition.

localStorage.setItem('email', response.data.email)

I don't want to use comment exceptions since localStorage (in my case) is used quite a lot throughout a project and I don't want to litter files with linting exception comments. Is there a global entry I can add or something?

sonicdoe commented 7 years ago

There are multiple ways to solve this but standard itself suggests to always prefix with window:

Always prefix browser globals with window – except document and navigator are okay. Prevents accidental use of poorly-named browser globals like open, length, event, and name.

See also https://github.com/standard/standard/issues/976.

pawel2105 commented 7 years ago

@sonicdoe of course! Thank you.