Bug 999737-bootstrap eslint for loop content JS, fix a found bug, rs=MattN

This commit is contained in:
Dan Mosedale 2015-03-31 17:28:36 -07:00
parent cbcd41c23f
commit 33b164b5c0
9 changed files with 122 additions and 7 deletions

View File

@ -0,0 +1,9 @@
MozLoopWorker.js
content/libs
content/shared/libs
standalone/content/libs
standalone/node_modules
test/xpcshell
test/mochitest
test/shared/vendor

View File

@ -0,0 +1,71 @@
{
"plugins": [
"react"
],
"ecmaFeatures": {
"forOf": true,
"jsx": true
},
"env": {
"browser": true,
"mocha": true
},
"globals": {
"_": false,
"$": false,
"Backbone": false,
"chai": false,
"console": false,
"jQuery": false,
"loop": false,
"MozActivity": false,
"OT": false,
"Promise": false,
"React": false,
"sinon": false
},
"rules": {
// turn off all kinds of stuff that we actually do want, because
// right now, we're bootstrapping the linting infrastructure. We'll
// want to audit these rules, and start turning them on and fixing the
// problems they find, one at a time.
// Eslint built-in rules are documented at <http://eslint.org/docs/rules/>
"camelcase": 0,
"comma-dangle": 0,
"comma-spacing": 0,
"consistent-return": 0,
"curly": 0,
"dot-notation": 0,
"eol-last": 0,
"eqeqeq": 0,
"key-spacing": 0,
"new-cap": 0,
"no-catch-shadow": 0,
"no-console": 0,
"no-empty": 0,
"no-extra-bind": 0,
"no-extra-boolean-cast": 0,
"no-extra-semi": 0,
"no-multi-spaces": 0,
"no-new": 0,
"no-redeclare": 0,
"no-return-assign": 0,
"no-shadow": 0,
"no-spaced-func": 0,
"no-trailing-spaces": 0,
"no-undef": 0,
"no-underscore-dangle": 0,
"no-unused-expressions": 0,
"no-unused-vars": 0,
"no-use-before-define": 0,
"no-wrap-func": 0,
"quotes": 0,
"semi": 0,
"semi-spacing": 0,
"space-infix-ops": 0,
"space-return-throw-case": 0,
"strict": 0,
"yoda": 0
}
}

View File

@ -0,0 +1,10 @@
{
"ecmaFeatures": {
// since the code here is running only on known versions of
// Firefox, we can use newer ECMAscript features
"arrowFunctions": true,
"blockBindings": true,
"destructuring": true,
"forOf": true
}
}

View File

@ -441,7 +441,7 @@ loop.shared.mixins = (function() {
*/
getDefaultPublisherConfig: function(options) {
options = options || {};
if (!"publishVideo" in options) {
if (!("publishVideo" in options)) {
throw new Error("missing option publishVideo");
}

View File

@ -10,8 +10,17 @@ fi
set -e
# Main tests
./mach xpcshell-test browser/components/loop/
./mach marionette-test browser/components/loop/manifest.ini
LOOPDIR=browser/components/loop
#ESLINT=standalone/node_modules/.bin/eslint
#if [ -x "${LOOPDIR}/${ESLINT}" ]; then
# echo 'running eslint; see http://eslint.org/docs/rules/ for error info'
# (cd ${LOOPDIR} && ./${ESLINT} .)
# echo 'eslint run finished.'
#fi
./mach xpcshell-test ${LOOPDIR}/
./mach marionette-test ${LOOPDIR}/manifest.ini
# The browser_parsable_css.js can fail if we add some css that isn't parsable.
#
@ -20,7 +29,7 @@ set -e
# to mess this up with CSP handling, and probably other changes, too.
TESTS="
browser/components/loop/test/mochitest
${LOOPDIR}/test/mochitest
browser/modules/test/browser_UITour_loop.js
browser/base/content/test/general/browser_devices_get_user_media_about_urls.js
"

View File

@ -24,9 +24,6 @@ npm_install:
test:
@echo "Not implemented yet."
lint:
@$(NODE_LOCAL_BIN)/jshint *.js content test
runserver: remove_old_config
node server.js

View File

@ -12,6 +12,8 @@
},
"dependencies": {},
"devDependencies": {
"eslint": "0.18.x",
"eslint-plugin-react": "2.0.x",
"express": "3.x"
},
"scripts": {

View File

@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env node */
/* XXX We should enable these and fix the warnings, but at the time of this
* writing, we're just bootstrapping the linting infrastructure.
*/
/* eslint-disable no-path-concat,no-process-exit */
var express = require('express');
var app = express();

View File

@ -0,0 +1,10 @@
{
"ecmaFeatures": {
// since the code here is running only on known versions of
// Firefox, we can use newer ECMAscript features here
"arrowFunctions": true,
"blockBindings": true,
"destructuring": true,
"forOf": true
},
}