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

Fix DOM Event lint global false positive and access all window props explicitely #1756

Merged
merged 12 commits into from
Jun 8, 2018

Conversation

tchakabam
Copy link
Collaborator

@tchakabam tchakabam commented Jun 5, 2018

This PR will...

Acknowledged the issue that was addressed here: #1755 ...

  • Fix a few false positives of linter browser-env globals for Event, which is supposed to be our event enum, but linter thought was the DOM Event constructor.

  • For code safety measure, remove all preset and custom globals from our eslint config

  • Only access window globals explicitely everyhwere (yes), since this is the only way to write (almost) safe code in the end

  • Add a lint:quiet script to only show fatal errors in eslint output

  • Mask the window global explicitely with self for transparent use of that scope in modules that are imported by both worker and main threads.

Why is this Pull Request needed?

Are there any points in the code the reviewer needs to double check?

Resolves issues:

Event not defined in decryptor and adts demuxer, which was causing error events not to be triggered in effect.

Checklist

  • changes have been done against master branch, and PR does not conflict
  • no commits have been done in dist folder (we will take care of updating it)
  • new unit / functional tests have been added (whenever applicable)
  • API or design changes are documented in API.md

@tchakabam
Copy link
Collaborator Author

Thanks for the specific fix in #1755 to alert about this general problem.

@tchakabam tchakabam changed the title Fix/bad lint globals Fix DOM Event lint global false positive and access all window props explicitely Jun 5, 2018
@tchakabam
Copy link
Collaborator Author

Seems like the check for Node require is breaking this.

@tchakabam
Copy link
Collaborator Author

latest commit should fix node require, but needs to be used everywhere where we need window

@tchakabam
Copy link
Collaborator Author

tchakabam commented Jun 7, 2018

@johnBartos @tjenkinson

  • Fixing missing Event import in decryptor.js + making all access to window/worker scopes explicit (removing all "globals" from linter config).

  • Removing support for Node.js require. See discussion in relevant PR.

@tchakabam tchakabam merged commit 6a5695f into master Jun 8, 2018
@tjenkinson
Copy link
Member

@tchakabam it might also be possible to inject the window replacement with the webpack imports loader automatically https://github.com/webpack-contrib/imports-loader

@tjenkinson
Copy link
Member

Actually if we are not supporting node why do we need to use 'self'?

@tchakabam
Copy link
Collaborator Author

tchakabam commented Jun 8, 2018

@tjenkinson For workers. As explained in the PR description.

@tchakabam
Copy link
Collaborator Author

tchakabam commented Jun 8, 2018

@tjenkinson If you see a use-case for injecting an own window or worker-global-scope implementation, go for it :)

@tchakabam
Copy link
Collaborator Author

Interesting webpack plugin btw ;)

@tjenkinson
Copy link
Member

@tchakabam had a go here #1769

@tchakabam tchakabam added this to the 0.10.0 milestone Jun 13, 2018
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