refactor: follow only-arrow-functions lint rule

This commit is contained in:
Daniel 2018-09-17 17:56:35 +02:00
parent c1e1c5cb79
commit 9acbb9fcd6
3 changed files with 11 additions and 12 deletions

View File

@ -183,41 +183,41 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
* ``` * ```
*/ */
export function Plugin(config: PluginConfig): ClassDecorator { export function Plugin(config: PluginConfig): ClassDecorator {
return function(cls: any) { return (cls: any) => {
// Add these fields to the class // Add these fields to the class
for (const prop in config) { for (const prop in config) {
cls[prop] = config[prop]; cls[prop] = config[prop];
} }
cls['installed'] = function(printWarning?: boolean) { cls['installed'] = (printWarning?: boolean) => {
return !!getPlugin(config.pluginRef); return !!getPlugin(config.pluginRef);
}; };
cls['getPlugin'] = function() { cls['getPlugin'] = () => {
return getPlugin(config.pluginRef); return getPlugin(config.pluginRef);
}; };
cls['checkInstall'] = function() { cls['checkInstall'] = () => {
return checkAvailability(cls) === true; return checkAvailability(cls) === true;
}; };
cls['getPluginName'] = function() { cls['getPluginName'] = () => {
return config.pluginName; return config.pluginName;
}; };
cls['getPluginRef'] = function() { cls['getPluginRef'] = () => {
return config.pluginRef; return config.pluginRef;
}; };
cls['getPluginInstallName'] = function() { cls['getPluginInstallName'] = () => {
return config.plugin; return config.plugin;
}; };
cls['getPluginRepo'] = function() { cls['getPluginRepo'] = () => {
return config.repo; return config.repo;
}; };
cls['getSupportedPlatforms'] = function() { cls['getSupportedPlatforms'] = () => {
return config.platforms; return config.platforms;
}; };

View File

@ -355,11 +355,11 @@ export function overrideFunction(
/** /**
* @private * @private
*/ */
export const wrap = function( export const wrap = (
pluginObj: any, pluginObj: any,
methodName: string, methodName: string,
opts: CordovaOptions = {} opts: CordovaOptions = {}
) { ) => {
return (...args: any[]) => { return (...args: any[]) => {
if (opts.sync) { if (opts.sync) {
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is // Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is

View File

@ -6,7 +6,6 @@
"no-redundant-jsdoc": false, "no-redundant-jsdoc": false,
"ban-types": false, "ban-types": false,
"no-shadowed-variable": false, "no-shadowed-variable": false,
"only-arrow-functions": false,
"ter-no-proto": false, "ter-no-proto": false,
"adjacent-overload-signatures": false, "adjacent-overload-signatures": false,
"no-constant-condition": false, "no-constant-condition": false,