Skip to content

Commit

Permalink
ESLint clean up (#2720)
Browse files Browse the repository at this point in the history
* Add valid-jsdoc and no-restricted-globals ESLint rules and fix lint errors
  • Loading branch information
robwalch authored and johnBartos committed Feb 12, 2018
1 parent 7617151 commit 8b4f501
Show file tree
Hide file tree
Showing 33 changed files with 284 additions and 216 deletions.
31 changes: 19 additions & 12 deletions .eslintrc
Expand Up @@ -2,21 +2,16 @@
"root": true,
"env": {
"browser": true,
"amd": true,
"es6": true,
"mocha": true
"commonjs": true
},
"globals": {
"__webpack_public_path__": true,
"Promise": true,
"Uint8Array": true,
"__FLASH_VERSION__": true,
"__REPO__": true,
"__SELF_HOSTED__": true,
"__DEBUG__": true,
"__BUILD_VERSION__": true,
"assert": true,
"expect": true
"__webpack_public_path__": false,
"__FLASH_VERSION__": false,
"__REPO__": false,
"__SELF_HOSTED__": false,
"__DEBUG__": false,
"__BUILD_VERSION__": false
},
"parserOptions": {
"sourceType": "module"
Expand All @@ -26,6 +21,18 @@
"no-for-of-loops"
],
"rules": {
"valid-jsdoc": 2,
"no-restricted-globals": [
"error",
{
"name": "Promise",
"message": "import Promise from 'polyfills/promise'"
},
{
"name": "VTTCue",
"message": "import VTTCue from 'parsers/captions/vttcue'"
}
],
"no-for-of-loops/no-for-of-loops": 2,
"comma-dangle": 0,
"no-cond-assign": 2,
Expand Down
9 changes: 6 additions & 3 deletions Gruntfile.js
Expand Up @@ -94,7 +94,7 @@ module.exports = function(grunt) {
files: ['src/js/**/*.js'],
tasks: [
'webpack:debug',
'lint:player',
'lint:js',
'karma:local'
]
},
Expand Down Expand Up @@ -222,8 +222,11 @@ module.exports = function(grunt) {

grunt.registerTask('lint', 'ESLints JavaScript & Stylelints LESS', function(target) {
var command = 'npm run lint';
if (target === 'js') {
command = command + ':js';
}
if (target === 'test') {
command = command + '-tests';
command = command + ':tests';
}
execSync(command, {
cwd: '.',
Expand All @@ -249,7 +252,7 @@ module.exports = function(grunt) {

grunt.registerTask('build-js', [
'webpack',
'lint:player',
'lint',
'less',
'postcss'
]);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -74,7 +74,7 @@
},
"scripts": {
"docs": "jsdoc -c docs/jsdoc.conf.json",
"lint": "npm run lint:js && npm run lint:styles",
"lint": "npm run lint:js && npm run lint:tests && npm run lint:styles",
"lint:js": "eslint './src/js'",
"lint:styles": "stylelint './src/css/**/*.less'",
"lint:tests": "eslint './test/*.js'",
Expand Down

0 comments on commit 8b4f501

Please sign in to comment.