mirror of
https://github.com/ansible/awx.git
synced 2026-05-18 06:47:41 -02:30
Use eslint on ui/lib and ui/features code
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// The purpose of this file is to instantiate the BaseStringService
|
||||
// for app-wide usage.
|
||||
/**
|
||||
* This service is used to access the app-wide strings defined in BaseStringService.
|
||||
*/
|
||||
function AppStrings (BaseString) {
|
||||
BaseString.call(this, 'app');
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import defaults from '@assets/default.strings.json';
|
||||
import defaults from '~assets/default.strings.json';
|
||||
|
||||
let i18n;
|
||||
|
||||
@@ -45,7 +45,7 @@ function BaseStringService (namespace) {
|
||||
*/
|
||||
this.t.p = i18n.translatePlural;
|
||||
|
||||
let t = this.t;
|
||||
const { t } = this;
|
||||
|
||||
/*
|
||||
* These strings are globally relevant and configured to give priority to values in
|
||||
@@ -79,7 +79,7 @@ function BaseStringService (namespace) {
|
||||
* @arg {object=} context - An object containing data to use in the interpolation of the string
|
||||
*/
|
||||
this.get = (name, ...args) => {
|
||||
let keys = name.split('.');
|
||||
const keys = name.split('.');
|
||||
let value;
|
||||
|
||||
keys.forEach(key => {
|
||||
@@ -90,7 +90,7 @@ function BaseStringService (namespace) {
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
throw new Error(ERROR_NO_STRING + `: ${name}`);
|
||||
throw new Error(`${ERROR_NO_STRING}: ${name}`);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
function CacheService ($cacheFactory, $q) {
|
||||
let cache = $cacheFactory('api');
|
||||
const cache = $cacheFactory('api');
|
||||
|
||||
this.put = (key, data) => {
|
||||
return cache.put(key, data);
|
||||
};
|
||||
|
||||
this.get = (key) => {
|
||||
return $q.resolve(cache.get(key));
|
||||
};
|
||||
this.put = (key, data) => cache.put(key, data);
|
||||
this.get = (key) => $q.resolve(cache.get(key));
|
||||
|
||||
this.remove = (key) => {
|
||||
if (!key) {
|
||||
if (!key) {
|
||||
return cache.removeAll();
|
||||
}
|
||||
|
||||
@@ -29,7 +24,7 @@ function CacheService ($cacheFactory, $q) {
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
CacheService.$inject = ['$cacheFactory', '$q'];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function EventService () {
|
||||
this.addListeners = list => {
|
||||
let listeners = [];
|
||||
const listeners = [];
|
||||
|
||||
list.forEach(args => listeners.push(this.addListener(...args)));
|
||||
|
||||
@@ -8,7 +8,7 @@ function EventService () {
|
||||
};
|
||||
|
||||
this.addListener = (el, name, fn) => {
|
||||
let listener = {
|
||||
const listener = {
|
||||
fn,
|
||||
name,
|
||||
el
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import CacheService from '@services/cache.service';
|
||||
import EventService from '@services/event.service';
|
||||
import BaseStringService from '@services/base-string.service';
|
||||
import AppStrings from '@services/app.strings';
|
||||
import CacheService from '~services/cache.service';
|
||||
import EventService from '~services/event.service';
|
||||
import BaseStringService from '~services/base-string.service';
|
||||
import AppStrings from '~services/app.strings';
|
||||
|
||||
angular
|
||||
.module('at.lib.services', [])
|
||||
|
||||
Reference in New Issue
Block a user