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 {
return function(cls: any) {
return (cls: any) => {
// Add these fields to the class
for (const prop in config) {
cls[prop] = config[prop];
}
cls['installed'] = function(printWarning?: boolean) {
cls['installed'] = (printWarning?: boolean) => {
return !!getPlugin(config.pluginRef);
};
cls['getPlugin'] = function() {
cls['getPlugin'] = () => {
return getPlugin(config.pluginRef);
};
cls['checkInstall'] = function() {
cls['checkInstall'] = () => {
return checkAvailability(cls) === true;
};
cls['getPluginName'] = function() {
cls['getPluginName'] = () => {
return config.pluginName;
};
cls['getPluginRef'] = function() {
cls['getPluginRef'] = () => {
return config.pluginRef;
};
cls['getPluginInstallName'] = function() {
cls['getPluginInstallName'] = () => {
return config.plugin;
};
cls['getPluginRepo'] = function() {
cls['getPluginRepo'] = () => {
return config.repo;
};
cls['getSupportedPlatforms'] = function() {
cls['getSupportedPlatforms'] = () => {
return config.platforms;
};

View File

@ -355,11 +355,11 @@ export function overrideFunction(
/**
* @private
*/
export const wrap = function(
export const wrap = (
pluginObj: any,
methodName: string,
opts: CordovaOptions = {}
) {
) => {
return (...args: any[]) => {
if (opts.sync) {
// 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,
"ban-types": false,
"no-shadowed-variable": false,
"only-arrow-functions": false,
"ter-no-proto": false,
"adjacent-overload-signatures": false,
"no-constant-condition": false,