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

videojs-standard #3459

Closed
wants to merge 9 commits into from
Closed

Conversation

misteroneill
Copy link
Member

@misteroneill misteroneill commented Jul 25, 2016

Description

As discussed in-person on Thursday, we are in a slight lull at the moment and this is a great opportunity to clean up the video.js source code (and tests) to pass videojs-standard linting and abandon jshint.

Specific Changes proposed

  • Removes jshint
  • Installs videojs-standard at 5.x
  • Adds linting scripts/tasks
  • Makes small code changes to address videojs-standard checks against src/js/*.js

Requirements Checklist

  • Feature implemented / Bug fixed
  • Reviewed by Two Core Contributors

@@ -114,14 +114,6 @@ module.exports = function(grunt) {
build: ['build/temp/*'],
dist: ['dist/*']
},
jshint: {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a temporary step. The final PR in this series will restore automatic linting capabilities, but for now we want them off.

@@ -3,10 +3,7 @@
*/
import ClickableComponent from './clickable-component.js';
import Component from './component';
import * as Events from './utils/events.js';
Copy link
Member Author

Choose a reason for hiding this comment

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

There are removals like this scattered around: they were unused modules.

Note: if we're only trying to import the module, we should be doing something like import './utils/events'.

Copy link
Member

Choose a reason for hiding this comment

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

doesn't import './utils/events.js' put the exports into local scope? This is an issue for a "bag of functions" module.
import * Events from './utils/events.js' is more explicit in what we want.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tend to agree, but the linter doesn't like unused variable names.

Copy link
Member

Choose a reason for hiding this comment

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

if it isn't used then we shouldn't import it, sure.

Copy link
Member Author

Choose a reason for hiding this comment

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

On the topic of using the import 'foo'; style, I don't think it puts the exports into local scope. I think it simply runs the module code. MDN says:

Import an entire module for side effects only, without importing any bindings.

Copy link
Member Author

Choose a reason for hiding this comment

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

Same as require('foo.js');

Copy link
Member

Choose a reason for hiding this comment

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

Ah, interesting. I guess that's exactly what we want in player.js.

@gkatsev
Copy link
Member

gkatsev commented Jul 25, 2016

LGTM

@gkatsev gkatsev added confirmed patch This PR can be added to a patch release. labels Jul 25, 2016
@gkatsev gkatsev added this to the Linting milestone Jul 25, 2016
@@ -8,13 +8,13 @@ import assign from 'object.assign';
*
* @param {Number} code The media error code
*/
let MediaError = function(code){
let MediaError = function(code) {
Copy link
Member

Choose a reason for hiding this comment

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

noting it here (but we shouldn't make this change as part of linting) but this potentially can cause a problem on IE8 since on line 22 we do MediaError.defaultMessages and IE8 is weird.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. Switching to function MediaError(code) { would solve that, right?

Copy link
Member

Choose a reason for hiding this comment

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

Yup.

@gkatsev gkatsev added minor This PR can be added to a minor release. It should not be added to a patch release. and removed patch This PR can be added to a patch release. confirmed labels Jul 26, 2016
@misteroneill
Copy link
Member Author

I merged all the disparate vjsstandard-* branches into this one.

@misteroneill misteroneill changed the title videojs-standard Core videojs-standard Source Code Jul 28, 2016
@misteroneill misteroneill changed the title videojs-standard Source Code videojs-standard Aug 1, 2016
@misteroneill
Copy link
Member Author

We are treating this as the "master" branch for standardization efforts.

@gkatsev gkatsev closed this in 4f6cb03 Aug 5, 2016
@gkatsev
Copy link
Member

gkatsev commented Aug 5, 2016

Landed!

@misteroneill misteroneill deleted the vjsstandard-core branch August 12, 2016 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor This PR can be added to a minor release. It should not be added to a patch release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants