Commit 24d22c20 authored by Nick Stenning's avatar Nick Stenning

Merge pull request #2387 from hypothesis/code-style-conformance

Getting picky with our code styles
parents ca5467c1 fdef5dd9
{ {
"preset": "google", "preset": "google",
"requireSemicolons": true,
"excludeFiles": [ "excludeFiles": [
"node_modules/**", "node_modules/**",
"h/static/scripts/vendor" "h/static/scripts/vendor"
......
...@@ -2,26 +2,28 @@ var Annotator = require('annotator'); ...@@ -2,26 +2,28 @@ var Annotator = require('annotator');
// Scroll plugin for jQuery // Scroll plugin for jQuery
// TODO: replace me // TODO: replace me
require('jquery-scrollintoview') require('jquery-scrollintoview');
// Polyfills // Polyfills
var g = Annotator.Util.getGlobal(); var g = Annotator.Util.getGlobal();
if (g.wgxpath) g.wgxpath.install(); if (g.wgxpath) {
g.wgxpath.install();
}
require('es6-promise') require('es6-promise');
var nodeIteratorShim = require('node-iterator-shim') var nodeIteratorShim = require('node-iterator-shim');
nodeIteratorShim(); nodeIteratorShim();
// Applications // Applications
Annotator.Guest = require('./guest') Annotator.Guest = require('./guest');
Annotator.Host = require('./host') Annotator.Host = require('./host');
// Cross-frame communication // Cross-frame communication
Annotator.Plugin.CrossFrame = require('./plugin/cross-frame') Annotator.Plugin.CrossFrame = require('./plugin/cross-frame');
Annotator.Plugin.CrossFrame.Bridge = require('../bridge') Annotator.Plugin.CrossFrame.Bridge = require('../bridge');
Annotator.Plugin.CrossFrame.AnnotationSync = require('../annotation-sync') Annotator.Plugin.CrossFrame.AnnotationSync = require('../annotation-sync');
Annotator.Plugin.CrossFrame.Discovery = require('../discovery') Annotator.Plugin.CrossFrame.Discovery = require('../discovery');
// Bucket bar // Bucket bar
require('./plugin/bucket-bar'); require('./plugin/bucket-bar');
...@@ -32,7 +34,6 @@ require('./plugin/toolbar'); ...@@ -32,7 +34,6 @@ require('./plugin/toolbar');
// Creating selections // Creating selections
require('./plugin/textselection'); require('./plugin/textselection');
var docs = 'https://h.readthedocs.org/en/latest/hacking/customized-embedding.html'; var docs = 'https://h.readthedocs.org/en/latest/hacking/customized-embedding.html';
var options = { var options = {
app: jQuery('link[type="application/annotator+html"]').attr('href'), app: jQuery('link[type="application/annotator+html"]').attr('href'),
...@@ -42,12 +43,12 @@ var options = { ...@@ -42,12 +43,12 @@ var options = {
// Document metadata plugins // Document metadata plugins
if (window.PDFViewerApplication) { if (window.PDFViewerApplication) {
require('./plugin/pdf') require('./plugin/pdf');
options['BucketBar']['scrollables'] = ['#viewerContainer'] options.BucketBar.scrollables = ['#viewerContainer'];
options['PDF'] = {}; options.PDF = {};
} else { } else {
require('../vendor/annotator.document'); require('../vendor/annotator.document');
options['Document'] = {}; options.Document = {};
} }
if (window.hasOwnProperty('hypothesisConfig')) { if (window.hasOwnProperty('hypothesisConfig')) {
...@@ -58,7 +59,8 @@ if (window.hasOwnProperty('hypothesisConfig')) { ...@@ -58,7 +59,8 @@ if (window.hasOwnProperty('hypothesisConfig')) {
} }
} }
Annotator.noConflict().$.noConflict(true)(function () { Annotator.noConflict().$.noConflict(true)(function() {
'use strict';
var Klass = Annotator.Host; var Klass = Annotator.Host;
if (options.hasOwnProperty('constructor')) { if (options.hasOwnProperty('constructor')) {
Klass = options.constructor; Klass = options.constructor;
......
module.exports = ['$animate', function ($animate) { module.exports = ['$animate', function($animate) {
'use strict';
return { return {
link: function (scope, elem, attrs) { link: function(scope, elem) {
// ngAnimate conflicts with the spinners own CSS // ngAnimate conflicts with the spinners own CSS
$animate.enabled(false, elem); $animate.enabled(false, elem);
}, },
restrict: 'C', restrict: 'C',
template: '<span><span></span></span>' template: '<span><span></span></span>'
} };
}]; }];
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* change at any time and should write code accordingly. Feature flags should * change at any time and should write code accordingly. Feature flags should
* not be cached, and should not be interrogated only at setup time. * not be cached, and should not be interrogated only at setup time.
*/ */
"use strict"; 'use strict';
var CACHE_TTL = 5 * 60 * 1000; // 5 minutes var CACHE_TTL = 5 * 60 * 1000; // 5 minutes
......
...@@ -7,7 +7,6 @@ module.exports = function(config) { ...@@ -7,7 +7,6 @@ module.exports = function(config) {
// base path that will be used to resolve all patterns (eg. files, exclude) // base path that will be used to resolve all patterns (eg. files, exclude)
basePath: './', basePath: './',
// frameworks to use // frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: [ frameworks: [
...@@ -15,7 +14,6 @@ module.exports = function(config) { ...@@ -15,7 +14,6 @@ module.exports = function(config) {
'mocha' 'mocha'
], ],
// list of files / patterns to load in the browser // list of files / patterns to load in the browser
files: [ files: [
// Application external deps // Application external deps
...@@ -49,7 +47,6 @@ module.exports = function(config) { ...@@ -49,7 +47,6 @@ module.exports = function(config) {
'**/*-test.js' '**/*-test.js'
], ],
// list of files to exclude // list of files to exclude
exclude: [ exclude: [
], ],
...@@ -78,24 +75,19 @@ module.exports = function(config) { ...@@ -78,24 +75,19 @@ module.exports = function(config) {
// available reporters: https://npmjs.org/browse/keyword/karma-reporter // available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['dots'], reporters: ['dots'],
// web server port // web server port
port: 9876, port: 9876,
// enable / disable colors in the output (reporters and logs) // enable / disable colors in the output (reporters and logs)
colors: true, colors: true,
// level of logging // level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO, logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes // enable / disable watching file and executing tests whenever any file changes
autoWatch: true, autoWatch: true,
// start these browsers // start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'], browsers: ['PhantomJS'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment