mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 15:18:12 +00:00
New eslint rules auto fix (#3058)
* no-implicit-coercion and no-unneeded-ternary * End every line with a semicolon * Spacing and formatting * Enabled semi-spacing * Applies npm run lint:fix to code after master merge * Fix merge issues * Switched operator-linebreak to 'before' Co-authored-by: Joshi <simplyrender@gmail.com>
This commit is contained in:
@ -98,6 +98,7 @@ define([
|
||||
|
||||
// Initialize the application
|
||||
$log.info("Initializing application.");
|
||||
|
||||
return initializer.runApplication();
|
||||
};
|
||||
|
||||
|
@ -90,6 +90,7 @@ define(
|
||||
decorate($log);
|
||||
app.decorator('$log', ['$delegate', function ($delegate) {
|
||||
decorate($delegate);
|
||||
|
||||
return $delegate;
|
||||
}]);
|
||||
};
|
||||
|
@ -49,6 +49,7 @@ define(
|
||||
// Look up log level from query string
|
||||
function logLevel() {
|
||||
var match = /[?&]log=([a-z]+)/.exec(window.location.search);
|
||||
|
||||
return match ? match[1] : "";
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,7 @@ define(
|
||||
var angular = this.angular,
|
||||
document = this.document,
|
||||
$log = this.$log;
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
$log.info("Bootstrapping application " + (app || {}).name);
|
||||
angular.element(document).ready(function () {
|
||||
|
@ -24,7 +24,6 @@ define(
|
||||
['../Constants', './Extension'],
|
||||
function (Constants, Extension) {
|
||||
|
||||
|
||||
/**
|
||||
* A bundle's plain JSON definition.
|
||||
*
|
||||
@ -40,7 +39,6 @@ define(
|
||||
* @memberof platform/framework
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a new reference to a bundle, based on its human-readable
|
||||
* definition.
|
||||
@ -78,14 +76,13 @@ define(
|
||||
this.logName = logName;
|
||||
}
|
||||
|
||||
|
||||
// Utility function for resolving paths in this bundle
|
||||
Bundle.prototype.resolvePath = function (elements) {
|
||||
var path = this.path;
|
||||
|
||||
return [path].concat(elements || []).join(Constants.SEPARATOR);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the path to this bundle.
|
||||
* @returns {string} path to this bundle;
|
||||
@ -105,9 +102,9 @@ define(
|
||||
* source file within it)
|
||||
*/
|
||||
Bundle.prototype.getSourcePath = function (sourceFile) {
|
||||
var subpath = sourceFile ?
|
||||
[this.definition.sources, sourceFile] :
|
||||
[this.definition.sources];
|
||||
var subpath = sourceFile
|
||||
? [this.definition.sources, sourceFile]
|
||||
: [this.definition.sources];
|
||||
|
||||
return this.resolvePath(subpath);
|
||||
};
|
||||
@ -123,9 +120,9 @@ define(
|
||||
* resource file within it)
|
||||
*/
|
||||
Bundle.prototype.getResourcePath = function (resourceFile) {
|
||||
var subpath = resourceFile ?
|
||||
[this.definition.resources, resourceFile] :
|
||||
[this.definition.resources];
|
||||
var subpath = resourceFile
|
||||
? [this.definition.resources, resourceFile]
|
||||
: [this.definition.resources];
|
||||
|
||||
return this.resolvePath(subpath);
|
||||
};
|
||||
@ -141,9 +138,9 @@ define(
|
||||
* resource file within it)
|
||||
*/
|
||||
Bundle.prototype.getLibraryPath = function (libraryFile) {
|
||||
var subpath = libraryFile ?
|
||||
[this.definition.libraries, libraryFile] :
|
||||
[this.definition.libraries];
|
||||
var subpath = libraryFile
|
||||
? [this.definition.libraries, libraryFile]
|
||||
: [this.definition.libraries];
|
||||
|
||||
return this.resolvePath(subpath);
|
||||
};
|
||||
|
@ -27,8 +27,8 @@ define(
|
||||
['../Constants', './Bundle'],
|
||||
function (Constants, Bundle) {
|
||||
|
||||
var INVALID_ARGUMENT_MESSAGE = "Malformed loadBundles argument; " +
|
||||
"expected string or array",
|
||||
var INVALID_ARGUMENT_MESSAGE = "Malformed loadBundles argument; "
|
||||
+ "expected string or array",
|
||||
BAD_CONTENTS_PREFIX = "Invalid bundle contents for ",
|
||||
LOAD_ERROR_PREFIX = "Failed to load bundle ";
|
||||
|
||||
@ -84,12 +84,15 @@ define(
|
||||
function (x) {
|
||||
if (x === null || typeof x !== 'object') {
|
||||
$log.warn(BAD_CONTENTS_PREFIX + bundlePath);
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return x;
|
||||
},
|
||||
function () {
|
||||
$log.warn(LOAD_ERROR_PREFIX + bundlePath);
|
||||
|
||||
return undefined;
|
||||
}
|
||||
);
|
||||
@ -139,6 +142,7 @@ define(
|
||||
err.status,
|
||||
err.statusText
|
||||
].join(' '));
|
||||
|
||||
return loadBundlesFromArray([]);
|
||||
}
|
||||
|
||||
@ -146,9 +150,9 @@ define(
|
||||
.then(loadBundlesFromArray, handleError);
|
||||
}
|
||||
|
||||
return Array.isArray(bundles) ? loadBundlesFromArray(bundles) :
|
||||
(typeof bundles === 'string') ? loadBundlesFromFile(bundles) :
|
||||
Promise.reject(new Error(INVALID_ARGUMENT_MESSAGE));
|
||||
return Array.isArray(bundles) ? loadBundlesFromArray(bundles)
|
||||
: (typeof bundles === 'string') ? loadBundlesFromFile(bundles)
|
||||
: Promise.reject(new Error(INVALID_ARGUMENT_MESSAGE));
|
||||
};
|
||||
|
||||
return BundleLoader;
|
||||
|
@ -65,6 +65,7 @@ define(
|
||||
logName += definition.name || "";
|
||||
logName += ")";
|
||||
}
|
||||
|
||||
logName += " from " + bundle.getLogName();
|
||||
|
||||
// Copy over definition. This allows us to attach the bundle
|
||||
@ -131,9 +132,9 @@ define(
|
||||
* @returns {string} path to implementation, or undefined
|
||||
*/
|
||||
Extension.prototype.getImplementationPath = function () {
|
||||
return (this.hasImplementation() && !this.hasImplementationValue()) ?
|
||||
this.bundle.getSourcePath(this.definition.implementation) :
|
||||
undefined;
|
||||
return (this.hasImplementation() && !this.hasImplementationValue())
|
||||
? this.bundle.getSourcePath(this.definition.implementation)
|
||||
: undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -142,9 +143,9 @@ define(
|
||||
* @returns {function} the constructor for this extension instance
|
||||
*/
|
||||
Extension.prototype.getImplementationValue = function () {
|
||||
return typeof this.definition.implementation === 'function' ?
|
||||
this.definition.implementation :
|
||||
undefined;
|
||||
return typeof this.definition.implementation === 'function'
|
||||
? this.definition.implementation
|
||||
: undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -169,6 +169,7 @@ define(
|
||||
function registerComponents(components) {
|
||||
var app = this.app,
|
||||
$log = this.$log;
|
||||
|
||||
return new ServiceCompositor(app, $log)
|
||||
.registerCompositeServices(components);
|
||||
}
|
||||
|
@ -77,9 +77,10 @@ define(
|
||||
// Used to build unique identifiers for individual extensions,
|
||||
// so that these can be registered separately with Angular
|
||||
function identify(category, extension, index) {
|
||||
var name = extension.key ?
|
||||
("extension-" + extension.key + "#" + index) :
|
||||
("extension#" + index);
|
||||
var name = extension.key
|
||||
? ("extension-" + extension.key + "#" + index)
|
||||
: ("extension#" + index);
|
||||
|
||||
return category + "[" + name + "]";
|
||||
}
|
||||
|
||||
@ -102,9 +103,9 @@ define(
|
||||
// both dependencies and a factory method for the service.)
|
||||
function makeServiceArgument(category, extension) {
|
||||
var dependencies = extension.depends || [],
|
||||
factory = (typeof extension === 'function') ?
|
||||
new PartialConstructor(extension) :
|
||||
staticFunction(extension);
|
||||
factory = (typeof extension === 'function')
|
||||
? new PartialConstructor(extension)
|
||||
: staticFunction(extension);
|
||||
|
||||
return dependencies.concat([factory]);
|
||||
}
|
||||
@ -147,7 +148,9 @@ define(
|
||||
extensions.forEach(registerExtension);
|
||||
registerExtensionArraysForCategory(category, names);
|
||||
}
|
||||
|
||||
registeredCategories[category] = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -159,6 +162,7 @@ define(
|
||||
Constants.EXTENSION_SUFFIX,
|
||||
dependency.length - Constants.EXTENSION_SUFFIX.length
|
||||
);
|
||||
|
||||
return index !== -1;
|
||||
}
|
||||
|
||||
@ -193,7 +197,6 @@ define(
|
||||
return Object.keys(needed);
|
||||
}
|
||||
|
||||
|
||||
// Register any extension categories that are depended-upon but
|
||||
// have not been declared anywhere; such dependencies are then
|
||||
// satisfied by an empty array, instead of not at all.
|
||||
|
@ -76,8 +76,8 @@ define(
|
||||
|
||||
// Should be a number; otherwise, issue a warning and
|
||||
// fall back to default priority level.
|
||||
return (typeof priority === 'number') ?
|
||||
priority : unrecognizedPriority(extension);
|
||||
return (typeof priority === 'number')
|
||||
? priority : unrecognizedPriority(extension);
|
||||
}
|
||||
|
||||
// Attach a numeric priority to an extension; this is done in
|
||||
|
@ -96,6 +96,7 @@ define(
|
||||
|
||||
function resolveCategory(category) {
|
||||
result[category] = [];
|
||||
|
||||
return Promise.all(
|
||||
bundle.getExtensions(category).map(resolveExtension)
|
||||
);
|
||||
|
@ -59,9 +59,9 @@ define(
|
||||
$log = this.$log;
|
||||
|
||||
function loadImplementation(ext) {
|
||||
var implPromise = ext.hasImplementationValue() ?
|
||||
Promise.resolve(ext.getImplementationValue()) :
|
||||
loader.load(ext.getImplementationPath()),
|
||||
var implPromise = ext.hasImplementationValue()
|
||||
? Promise.resolve(ext.getImplementationValue())
|
||||
: loader.load(ext.getImplementationPath()),
|
||||
definition = ext.getDefinition();
|
||||
|
||||
// Wrap a constructor function (to avoid modifying the original)
|
||||
@ -69,16 +69,18 @@ define(
|
||||
function Constructor() {
|
||||
return impl.apply(this, arguments);
|
||||
}
|
||||
|
||||
Constructor.prototype = impl.prototype;
|
||||
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
// Attach values from the object definition to the
|
||||
// loaded implementation.
|
||||
function attachDefinition(impl) {
|
||||
var result = (typeof impl === 'function') ?
|
||||
constructorFor(impl) :
|
||||
Object.create(impl);
|
||||
var result = (typeof impl === 'function')
|
||||
? constructorFor(impl)
|
||||
: Object.create(impl);
|
||||
|
||||
// Copy over static properties
|
||||
Object.keys(impl).forEach(function (k) {
|
||||
@ -135,9 +137,9 @@ define(
|
||||
extension.getLogName()
|
||||
].join(""));
|
||||
|
||||
return extension.hasImplementation() ?
|
||||
loadImplementation(extension) :
|
||||
Promise.resolve(extension.getDefinition());
|
||||
return extension.hasImplementation()
|
||||
? loadImplementation(extension)
|
||||
: Promise.resolve(extension.getDefinition());
|
||||
};
|
||||
|
||||
return ExtensionResolver;
|
||||
|
@ -53,6 +53,7 @@ define(
|
||||
*/
|
||||
ImplementationLoader.prototype.load = function loadModule(path) {
|
||||
var require = this.require;
|
||||
|
||||
return new Promise(function (fulfill, reject) {
|
||||
require([path], fulfill, reject);
|
||||
});
|
||||
|
Reference in New Issue
Block a user