Skip to content

Commit

Permalink
* chore(eslint): update esllint and remove unused variables
Browse files Browse the repository at this point in the history
* chore(eslint-config): change no-unused-vars to warn

* chore(eslint): remove unused variables

* chore(eslint): allow unused globals

* fixup! chore(eslint): allow unused globals

* chore(eslint): remove commented unused vars

* fixup! chore(eslint): remove commented unused vars
  • Loading branch information
chiptus authored and deviantony committed Aug 22, 2018
1 parent 46da95e commit e58acd7
Show file tree
Hide file tree
Showing 67 changed files with 121 additions and 146 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ rules:
no-undef-init: error
no-undef: off
no-undefined: off
no-unused-vars: off
no-unused-vars:
- warn
-
vars: local
no-use-before-define: off

# Node.js and CommonJS
Expand Down
2 changes: 1 addition & 1 deletion app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function initAnalytics(Analytics, $rootScope) {
Analytics.offline(false);
Analytics.registerScriptTags();
Analytics.registerTrackers();
$rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
$rootScope.$on('$stateChangeSuccess', function (event, toState) {
Analytics.trackPage(toState.url);
Analytics.pageView();
});
Expand Down
2 changes: 1 addition & 1 deletion app/azure/models/container_group.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function ContainerGroupDefaultModel() {
this.Memory = 1;
}

function ContainerGroupViewModel(data, subscriptionId, resourceGroupName) {
function ContainerGroupViewModel(data) {
this.Id = data.id;
this.Name = data.name;
this.Location = data.location;
Expand Down
2 changes: 1 addition & 1 deletion app/azure/services/azureService.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function AzureServiceFactory($q, Azure, SubscriptionService, ResourceGroupServic

service.aggregate = function(resourcesBySubcription) {
var aggregatedResources = [];
Object.keys(resourcesBySubcription).forEach(function(key, index) {
Object.keys(resourcesBySubcription).forEach(function(key) {
aggregatedResources = aggregatedResources.concat(resourcesBySubcription[key]);
});
return aggregatedResources;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function ($q, $scope, $state, AzureService, Notifications) {

$scope.state.actionInProgress = true;
AzureService.createContainerGroup(model, subscriptionId, resourceGroupName)
.then(function success(data) {
.then(function success() {
Notifications.success('Container successfully created', model.Name);
$state.go('azure.containerinstances');
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function (PaginationService, DatatableService, EndpointProvider) {
PaginationService.setPaginationLimit(this.tableKey, this.state.paginatedItemLimit);
};

this.applyFilters = function(value, index, array) {
this.applyFilters = function(value) {
var container = value;
var filters = ctrl.filters;
for (var i = 0; i < filters.state.values.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function (PaginationService, DatatableService) {
PaginationService.setPaginationLimit(this.tableKey, this.state.paginatedItemLimit);
};

this.applyFilters = function(value, index, array) {
this.applyFilters = function(value) {
var image = value;
var filters = ctrl.filters;
if ((image.ContainerCount === 0 && filters.usage.showUnusedImages)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function (DatatableService) {
}
};

this.applyFilters = function(item, index, array) {
this.applyFilters = function(item) {
var filters = ctrl.filters;
for (var i = 0; i < filters.state.values.length; i++) {
var filter = filters.state.values[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function ($state, ServiceService, ServiceHelper, Notifications, ModalService, Im
var config = ServiceHelper.serviceToConfig(service.Model);
config.Mode.Replicated.Replicas = service.Replicas;
ServiceService.update(service, config)
.then(function success(data) {
.then(function success() {
Notifications.success('Service successfully scaled', 'New replica count: ' + service.Replicas);
$state.reload();
})
Expand Down Expand Up @@ -53,7 +53,7 @@ function ($state, ServiceService, ServiceHelper, Notifications, ModalService, Im
// value or an increment of the counter value to force an update.
config.TaskTemplate.ForceUpdate++;
ServiceService.update(service, config)
.then(function success(data) {
.then(function success() {
Notifications.success('Service successfully updated', service.Name);
})
.catch(function error(err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function (PaginationService, DatatableService) {
PaginationService.setPaginationLimit(this.tableKey, this.state.paginatedItemLimit);
};

this.applyFilters = function(value, index, array) {
this.applyFilters = function(value) {
var volume = value;
var filters = ctrl.filters;
if ((volume.dangling && filters.usage.showUnusedVolumes)
Expand Down
1 change: 0 additions & 1 deletion app/docker/components/log-viewer/logViewerController.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
angular.module('portainer.docker')
.controller('LogViewerController', ['clipboard',
function (clipboard) {
var ctrl = this;

this.state = {
copySupported: clipboard.supported,
Expand Down
6 changes: 0 additions & 6 deletions app/docker/helpers/containerHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ angular.module('portainer.docker')
for (var v in container.Mounts) {
if ({}.hasOwnProperty.call(container.Mounts, v)) {
var mount = container.Mounts[v];
var volume = {
'type': mount.Type,
'name': mount.Name || mount.Source,
'containerPath': mount.Destination,
'readOnly': mount.RW === false
};
var name = mount.Name || mount.Source;
var containerPath = mount.Destination;
if (name && containerPath) {
Expand Down
2 changes: 1 addition & 1 deletion app/docker/models/service.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function ServiceViewModel(data, runningTasks, allTasks, nodes) {
function ServiceViewModel(data, runningTasks, allTasks) {
this.Model = data;
this.Id = data.ID;
this.Tasks = [];
Expand Down
2 changes: 1 addition & 1 deletion app/docker/services/volumeService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('portainer.docker')
.factory('VolumeService', ['$q', 'Volume', 'VolumeHelper', 'ResourceControlService', 'UserService', 'TeamService', function VolumeServiceFactory($q, Volume, VolumeHelper, ResourceControlService, UserService, TeamService) {
.factory('VolumeService', ['$q', 'Volume', 'VolumeHelper', 'ResourceControlService', function VolumeServiceFactory($q, Volume, VolumeHelper, ResourceControlService) {
'use strict';
var service = {};

Expand Down
2 changes: 1 addition & 1 deletion app/docker/views/configs/edit/configController.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function ($scope, $transition$, $state, ConfigService, Notifications) {

$scope.removeConfig = function removeConfig(configId) {
ConfigService.remove(configId)
.then(function success(data) {
.then(function success() {
Notifications.success('Config successfully removed');
$state.go('docker.configs', {});
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function ($scope, $transition$, ContainerService, ImageService, EndpointProvider
$scope.containerCommands = [];

// Ensure the socket is closed before leaving the view
$scope.$on('$stateChangeStart', function (event, next, current) {
$scope.$on('$stateChangeStart', function () {
if (socket && socket !== null) {
socket.close();
}
Expand Down Expand Up @@ -69,7 +69,7 @@ function ($scope, $transition$, ContainerService, ImageService, EndpointProvider
socket = new WebSocket(url);

$scope.state.connected = true;
socket.onopen = function(evt) {
socket.onopen = function() {
term = new Terminal();

term.on('data', function (data) {
Expand All @@ -88,10 +88,10 @@ function ($scope, $transition$, ContainerService, ImageService, EndpointProvider
socket.onmessage = function (e) {
term.write(e.data);
};
socket.onerror = function (error) {
socket.onerror = function () {
$scope.state.connected = false;
};
socket.onclose = function(evt) {
socket.onclose = function() {
$scope.state.connected = false;
};
};
Expand Down
16 changes: 8 additions & 8 deletions app/docker/views/containers/create/createContainerController.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,16 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
return config;
}


function loadFromContainerCmd(d) {
function loadFromContainerCmd() {
if ($scope.config.Cmd) {
$scope.config.Cmd = ContainerHelper.commandArrayToString($scope.config.Cmd);
} else {
$scope.config.Cmd = '';
}
}

function loadFromContainerPortBindings(d) {
function loadFromContainerPortBindings() {
var bindings = [];
for (var p in $scope.config.HostConfig.PortBindings) {
if ({}.hasOwnProperty.call($scope.config.HostConfig.PortBindings, p)) {
Expand Down Expand Up @@ -386,7 +386,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
}
}

function loadFromContainerEnvironmentVariables(d) {
function loadFromContainerEnvironmentVariables() {
var envArr = [];
for (var e in $scope.config.Env) {
if ({}.hasOwnProperty.call($scope.config.Env, e)) {
Expand All @@ -397,15 +397,15 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
$scope.config.Env = envArr;
}

function loadFromContainerLabels(d) {
function loadFromContainerLabels() {
for (var l in $scope.config.Labels) {
if ({}.hasOwnProperty.call($scope.config.Labels, l)) {
$scope.formValues.Labels.push({ name: l, value: $scope.config.Labels[l]});
}
}
}

function loadFromContainerConsole(d) {
function loadFromContainerConsole() {
if ($scope.config.OpenStdin && $scope.config.Tty) {
$scope.formValues.Console = 'both';
} else if (!$scope.config.OpenStdin && $scope.config.Tty) {
Expand All @@ -417,7 +417,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
}
}

function loadFromContainerDevices(d) {
function loadFromContainerDevices() {
var path = [];
for (var dev in $scope.config.HostConfig.Devices) {
if ({}.hasOwnProperty.call($scope.config.HostConfig.Devices, dev)) {
Expand All @@ -428,7 +428,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
$scope.config.HostConfig.Devices = path;
}

function loadFromContainerImageConfig(d) {
function loadFromContainerImageConfig() {
var imageInfo = ImageHelper.extractImageAndRegistryFromRepository($scope.config.Image);
RegistryService.retrieveRegistryFromRepository($scope.config.Image)
.then(function success(data) {
Expand Down
10 changes: 5 additions & 5 deletions app/docker/views/containers/edit/containerController.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co

function executeContainerAction(id, action, successMessage, errorMessage) {
action(id)
.then(function success(data) {
.then(function success() {
Notifications.success(successMessage, id);
update();
})
Expand Down Expand Up @@ -104,7 +104,7 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
$scope.renameContainer = function () {
var container = $scope.container;
ContainerService.renameContainer($transition$.params().id, container.newContainerName)
.then(function success(data) {
.then(function success() {
container.Name = container.newContainerName;
Notifications.success('Container successfully renamed', container.Name);
})
Expand All @@ -120,7 +120,7 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
$scope.containerLeaveNetwork = function containerLeaveNetwork(container, networkId) {
$scope.state.leaveNetworkInProgress = true;
NetworkService.disconnectContainer(networkId, container.Id, false)
.then(function success(data) {
.then(function success() {
Notifications.success('Container left network', container.Id);
$state.reload();
})
Expand All @@ -135,7 +135,7 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
$scope.containerJoinNetwork = function containerJoinNetwork(container, networkId) {
$scope.state.joinNetworkInProgress = true;
NetworkService.connectContainer(networkId, container.Id)
.then(function success(data) {
.then(function success() {
Notifications.success('Container joined network', container.Id);
$state.reload();
})
Expand All @@ -151,7 +151,7 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
var image = $scope.config.Image;
var registry = $scope.config.Registry;
var imageConfig = ImageHelper.createImageConfigForCommit(image, registry.URL);
Commit.commitContainer({id: $transition$.params().id, tag: imageConfig.tag, repo: imageConfig.repo}, function (d) {
Commit.commitContainer({id: $transition$.params().id, tag: imageConfig.tag, repo: imageConfig.repo}, function () {
update();
Notifications.success('Container commited', $transition$.params().id);
}, function (e) {
Expand Down
4 changes: 0 additions & 4 deletions app/docker/views/containers/logs/containerLogsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ function ($scope, $transition$, $interval, ContainerService, Notifications, Http
}
}

function update(logs) {
$scope.logs = logs;
}

function setUpdateRepeater(skipHeaders) {
var refreshRate = $scope.state.refreshRate;
$scope.repeater = $interval(function() {
Expand Down
6 changes: 3 additions & 3 deletions app/docker/views/images/edit/imageController.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function ($q, $scope, $transition$, $state, $timeout, ImageService, RegistryServ
var registry = $scope.formValues.Registry;

ImageService.tagImage($transition$.params().id, image, registry.URL)
.then(function success(data) {
.then(function success() {
Notifications.success('Image successfully tagged');
$state.go('docker.images.image', {id: $transition$.params().id}, {reload: true});
})
Expand All @@ -45,7 +45,7 @@ function ($q, $scope, $transition$, $state, $timeout, ImageService, RegistryServ
var registry = data;
return ImageService.pushImage(repository, registry);
})
.then(function success(data) {
.then(function success() {
Notifications.success('Image successfully pushed', repository);
})
.catch(function error(err) {
Expand All @@ -63,7 +63,7 @@ function ($q, $scope, $transition$, $state, $timeout, ImageService, RegistryServ
var registry = data;
return ImageService.pullImage(repository, registry, false);
})
.then(function success(data) {
.then(function success() {
Notifications.success('Image successfully pulled', repository);
})
.catch(function error(err) {
Expand Down
2 changes: 1 addition & 1 deletion app/docker/views/images/imagesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function ($scope, $state, ImageService, Notifications, ModalService, HttpRequest

$scope.state.actionInProgress = true;
ImageService.pullImage(image, registry, false)
.then(function success(data) {
.then(function success() {
Notifications.success('Image successfully pulled', image);
$state.reload();
})
Expand Down
10 changes: 5 additions & 5 deletions app/docker/views/networks/edit/networkController.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
angular.module('portainer.docker')
.controller('NetworkController', ['$scope', '$state', '$transition$', '$filter', 'NetworkService', 'Container', 'ContainerHelper', 'Notifications', 'HttpRequestHelper',
function ($scope, $state, $transition$, $filter, NetworkService, Container, ContainerHelper, Notifications, HttpRequestHelper) {
.controller('NetworkController', ['$scope', '$state', '$transition$', '$filter', 'NetworkService', 'Container', 'Notifications', 'HttpRequestHelper',
function ($scope, $state, $transition$, $filter, NetworkService, Container, Notifications, HttpRequestHelper) {

$scope.removeNetwork = function removeNetwork(networkId) {
$scope.removeNetwork = function removeNetwork() {
NetworkService.remove($transition$.params().id, $transition$.params().id)
.then(function success(data) {
.then(function success() {
Notifications.success('Network removed', $transition$.params().id);
$state.go('docker.networks', {});
})
Expand All @@ -16,7 +16,7 @@ function ($scope, $state, $transition$, $filter, NetworkService, Container, Cont
$scope.containerLeaveNetwork = function containerLeaveNetwork(network, container) {
HttpRequestHelper.setPortainerAgentTargetHeader(container.NodeName);
NetworkService.disconnectContainer($transition$.params().id, container.Id, false)
.then(function success(data) {
.then(function success() {
Notifications.success('Container left network', $transition$.params().id);
$state.go('docker.networks.network', { id: network.Id }, { reload: true });
})
Expand Down
2 changes: 1 addition & 1 deletion app/docker/views/nodes/edit/nodeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function ($scope, $state, $transition$, LabelHelper, Node, NodeHelper, Task, Not
config.Role = node.Role;
config.Labels = LabelHelper.fromKeyValueToLabelHash(node.Labels);

Node.update({ id: node.Id, version: node.Version }, config, function (data) {
Node.update({ id: node.Id, version: node.Version }, config, function () {
Notifications.success('Node successfully updated', 'Node updated');
$state.go('docker.nodes.node', {id: node.Id}, {reload: true});
}, function (e) {
Expand Down
2 changes: 1 addition & 1 deletion app/docker/views/secrets/edit/secretController.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function ($scope, $transition$, $state, SecretService, Notifications) {

$scope.removeSecret = function removeSecret(secretId) {
SecretService.remove(secretId)
.then(function success(data) {
.then(function success() {
Notifications.success('Secret successfully removed');
$state.go('docker.secrets', {});
})
Expand Down
3 changes: 1 addition & 2 deletions app/docker/views/services/create/createServiceController.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function ($q, $scope, $state, $timeout, Service, ServiceHelper, ConfigService, C
$scope.formValues.ContainerLabels.splice(index, 1);
};

$scope.addLogDriverOpt = function(value) {
$scope.addLogDriverOpt = function() {
$scope.formValues.LogDriverOpts.push({ name: '', value: ''});
};

Expand Down Expand Up @@ -492,7 +492,6 @@ function ($q, $scope, $state, $timeout, Service, ServiceHelper, ConfigService, C

function initView() {
var apiVersion = $scope.applicationState.endpoint.apiVersion;
var provider = $scope.applicationState.endpoint.mode.provider;

$q.all({
volumes: VolumeService.volumes(),
Expand Down
Loading

0 comments on commit e58acd7

Please sign in to comment.