Skip to content

Commit

Permalink
Remove /* globals */ wave 4 (#12999)
Browse files Browse the repository at this point in the history
* Remove /* globals */ from files wave 1

* Fix lint

* Remove /* globals */ wave 2

* remove-globals-wave-3

* Remove /* globals */ wave 4

* Remove some // eslint comments
  • Loading branch information
MarcosSpessatto authored and rodrigok committed Dec 20, 2018
1 parent 3b7de77 commit ce3da9e
Show file tree
Hide file tree
Showing 52 changed files with 68 additions and 83 deletions.
10 changes: 10 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,43 @@
"alerts" : false,
"Apps" : false,
"Assets" : false,
"AudioRecorder" : false,
"CachedChatSubscription" : false,
"ChatMessage" : false,
"ChatMessages" : false,
"chatMessages" : false,
"ChatRoom" : false,
"ChatSubscription" : false,
"chrome" : false,
"cordova" : false,
"device" : false,
"DynamicCss" : false,
"facebookConnectPlugin" : false,
"FileUpload" : false,
"fileUpload" : false,
"fileUploadHandler" : false,
"fireGlobalEvent" : false,
"handleError" : false,
"getAvatarUrlFromUsername" : false,
"getAvatarSuggestionForUser" : false,
"globals" : true,
"isChrome" : false,
"isFirefox" : false,
"isRtl" : false,
"JitsiMeetExternalAPI" : false,
"jscolor" : false,
"KonchatNotification" : false,
"language_names" : true,
"msgStream" : false,
"MsgTyping" : false,
"modal" : false,
"Modernizr" : false,
"menu" : false,
"Npm" : false,
"openRoom" : false,
"OnePassword" : false,
"Package" : false,
"popout" : false,
"popover" : false,
"readMessage" : false,
"RocketChat" : true,
Expand All @@ -47,9 +55,11 @@
"Servers" : false,
"Settings" : false,
"SideNav" : false,
"TAPi18next" : false,
"t" : false,
"toolbarSearch" : false,
"TwitterConnect" : false,
"updateAvatarOfUsername" : false,
"UserRoles" : false,
"VideoRecorder" : false,
"VRecDialog" : false
Expand Down
2 changes: 0 additions & 2 deletions .scripts/version.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint object-shorthand: 0, prefer-template: 0 */

const path = require('path');
let pkgJson = {};

Expand Down
5 changes: 2 additions & 3 deletions packages/rocketchat-grant/server/providers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { check } from 'meteor/check';
import { Match, check } from 'meteor/check';

import { Storage } from './storage';
import { routes } from './routes';
Expand All @@ -7,8 +7,7 @@ class Providers extends Storage {
register(name, options, getUser) {
check(name, String);
check(options, {
// eslint-disable-next-line
scope: Match.OneOf(String, [String])
scope: Match.OneOf(String, [String]),
});
check(getUser, Function);

Expand Down
6 changes: 3 additions & 3 deletions packages/rocketchat-lib/client/lib/openRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import _ from 'underscore';

export let currentTracker = undefined;

openRoom = function(type, name) { // eslint-disable-line
openRoom = function(type, name) {
Session.set('openedRoom', null);

return Meteor.defer(() =>
Expand All @@ -33,7 +33,7 @@ openRoom = function(type, name) { // eslint-disable-line
Meteor.call('createDirectMessage', name, function(error) {
if (!error) {
RoomManager.close(type + name);
return openRoom('d', name); // eslint-disable-line
return openRoom('d', name);
} else {
Session.set('roomNotFound', { type, name, error });
BlazeLayout.render('main', { center: 'roomNotFound' });
Expand All @@ -48,7 +48,7 @@ openRoom = function(type, name) { // eslint-disable-line
} else {
RocketChat.models.Rooms.upsert({ _id: record._id }, _.omit(record, '_id'));
RoomManager.close(type + name);
return openRoom(type, name); // eslint-disable-line
return openRoom(type, name);
}
});
}
Expand Down
1 change: 0 additions & 1 deletion packages/rocketchat-lib/server/methods/saveSetting.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint new-cap: 0 */
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint new-cap: [2, {"capIsNewExceptions": ["Match.ObjectIncluding", "Match.Optional"]}] */
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
Expand Down
1 change: 0 additions & 1 deletion packages/rocketchat-livechat/server/methods/saveInfo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint new-cap: [2, {"capIsNewExceptions": ["Match.ObjectIncluding", "Match.Optional"]}] */
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint new-cap: [2, {"capIsNewExceptions": ["Match.ObjectIncluding"]}] */
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint new-cap: [2, {"capIsNewExceptions": ["MD5"]}] */
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { RocketChat } from 'meteor/rocketchat:lib';
Expand Down
2 changes: 0 additions & 2 deletions packages/rocketchat-livechat/server/methods/transfer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint new-cap: [2, {"capIsNewExceptions": ["Match.Optional"]}] */

import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import { RocketChat } from 'meteor/rocketchat:lib';
Expand Down
4 changes: 2 additions & 2 deletions packages/rocketchat-ui-sidenav/client/sidebarHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const extendedViewOption = (user) => {
const showToolbar = new ReactiveVar(false);

const selectorSearch = '.toolbar__search .rc-input__element';
toolbarSearch = { //eslint-disable-line
toolbarSearch = {
shortcut: false,
clear() {
const $inputMessage = $('.js-input-message');
Expand Down Expand Up @@ -67,7 +67,7 @@ const toolbarButtons = (user) => [{
name: t('Search'),
icon: 'magnifier',
action: () => {
toolbarSearch.show(false); //eslint-disable-line
toolbarSearch.show(false);
},
},
{
Expand Down
3 changes: 1 addition & 2 deletions packages/rocketchat-ui/client/lib/RoomHistoryManager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* globals readMessage UserRoles RoomRoles*/
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Blaze } from 'meteor/blaze';
Expand All @@ -22,7 +21,7 @@ export const upsertMessage = ({ msg, subscription }) => {
return ChatMessage.upsert({ _id: msg._id }, msg);
};

RoomHistoryManager = new class { //eslint-disable-line
RoomHistoryManager = new class {
constructor() {
this.defaultLimit = 50;
this.histories = {};
Expand Down
5 changes: 2 additions & 3 deletions packages/rocketchat-ui/client/lib/RoomManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FlowRouter } from 'meteor/kadira:flow-router';
import { Template } from 'meteor/templating';
import _ from 'underscore';
import { upsertMessage } from './RoomHistoryManager';

import { CachedChatRoom } from './collections';

const maxRoomsOpen = parseInt(localStorage && localStorage.getItem('rc-maxRoomsOpen')) || 5 ;

Expand All @@ -22,14 +22,13 @@ const onDeleteMessageBulkStream = ({ rid, ts, excludePinned, users }) => {
ChatMessage.remove(query);
};

RoomManager = new function() { //eslint-disable-line
RoomManager = new function() {
const openedRooms = {};
const msgStream = new Meteor.Streamer('room-messages');
const onlineUsers = new ReactiveVar({});
const Dep = new Tracker.Dependency();
const Cls = class {
static initClass() {
/* globals CachedChatRoom CachedChatSubscription */
this.prototype.openedRooms = openedRooms;
this.prototype.onlineUsers = onlineUsers;
this.prototype.computation = Tracker.autorun(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui/client/lib/accountBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BlazeLayout } from 'meteor/kadira:blaze-layout';
import { Session } from 'meteor/session';
import _ from 'underscore';

AccountBox = (function() { //eslint-disable-line
AccountBox = (function() {
let status = 0;
const items = new ReactiveVar([]);
function setStatus(status) {
Expand Down
3 changes: 1 addition & 2 deletions packages/rocketchat-ui/client/lib/avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ export const getAvatarAsPng = function(username, cb) {
};
};

updateAvatarOfUsername = function(username) { //eslint-disable-line

updateAvatarOfUsername = function(username) {
const key = `avatar_random_${ username }`;
Session.set(key, Math.round(Math.random() * 1000));

Expand Down
4 changes: 2 additions & 2 deletions packages/rocketchat-ui/client/lib/chatMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Meteor.startup(() => {
});
});

ChatMessages = class ChatMessages { //eslint-disable-line
ChatMessages = class ChatMessages {
constructor() {

this.saveTextMessageBox = _.debounce((rid, value) => { // eslint
this.saveTextMessageBox = _.debounce((rid, value) => {
const key = `messagebox_${ rid }`;
return value.length ? localStorage.setItem(key, value) : localStorage.removeItem(key);
}, 1000);
Expand Down
20 changes: 10 additions & 10 deletions packages/rocketchat-ui/client/lib/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ import { Mongo } from 'meteor/mongo';
import { Tracker } from 'meteor/tracker';
import _ from 'underscore';

ChatMessage = new Mongo.Collection(null); //eslint-disable-line
this.CachedChatRoom = new RocketChat.CachedCollection({ name: 'rooms' });
ChatRoom = this.CachedChatRoom.collection;
ChatMessage = new Mongo.Collection(null);
export const CachedChatRoom = new RocketChat.CachedCollection({ name: 'rooms' });
ChatRoom = CachedChatRoom.collection;

CachedChatSubscription = new RocketChat.CachedCollection({ name: 'subscriptions' }); //eslint-disable-line
ChatSubscription = CachedChatSubscription.collection; //eslint-disable-line
UserRoles = new Mongo.Collection(null); //eslint-disable-line
RoomRoles = new Mongo.Collection(null); //eslint-disable-line
CachedChatSubscription = new RocketChat.CachedCollection({ name: 'subscriptions' });
ChatSubscription = CachedChatSubscription.collection;
UserRoles = new Mongo.Collection(null);
RoomRoles = new Mongo.Collection(null);
this.UserAndRoom = new Mongo.Collection(null);
this.CachedChannelList = new Mongo.Collection(null);
this.CachedUserList = new Mongo.Collection(null);

RocketChat.models.Users = _.extend({}, RocketChat.models.Users, Meteor.users);
RocketChat.models.Subscriptions = _.extend({}, RocketChat.models.Subscriptions, ChatSubscription); //eslint-disable-line
RocketChat.models.Subscriptions = _.extend({}, RocketChat.models.Subscriptions, ChatSubscription);
RocketChat.models.Rooms = _.extend({}, RocketChat.models.Rooms, ChatRoom);
RocketChat.models.Messages = _.extend({}, RocketChat.models.Messages, ChatMessage);

Meteor.startup(() => {
Tracker.autorun(() => {
if (!Meteor.userId() && RocketChat.settings.get('Accounts_AllowAnonymousRead') === true) {
this.CachedChatRoom.init();
CachedChatSubscription.ready.set(true); //eslint-disable-line
CachedChatRoom.init();
CachedChatSubscription.ready.set(true);
}
});
});
2 changes: 1 addition & 1 deletion packages/rocketchat-ui/client/lib/fireEvent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Tracker } from 'meteor/tracker';

fireGlobalEvent = function _fireGlobalEvent(eventName, params) { //eslint-disable-line
fireGlobalEvent = function _fireGlobalEvent(eventName, params) {
window.dispatchEvent(new CustomEvent(eventName, { detail: params }));

Tracker.autorun((computation) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/rocketchat-ui/client/lib/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import s from 'underscore.string';
import { e2e } from 'meteor/rocketchat:e2e';
import { getAvatarAsPng } from './avatar';

KonchatNotification = { //eslint-disable-line
KonchatNotification = {
notificationStatus: new ReactiveVar,

// notificacoes HTML5
getDesktopPermission() {
if (window.Notification && (Notification.permission !== 'granted') && !Meteor.settings.public.sandstorm) {
return Notification.requestPermission(function(status) {
KonchatNotification.notificationStatus.set(status); //eslint-disable-line
KonchatNotification.notificationStatus.set(status);
if (Notification.permission !== status) {
return Notification.permission = status;
}
Expand Down Expand Up @@ -88,7 +88,7 @@ KonchatNotification = { //eslint-disable-line

return getAvatarAsPng(notification.payload.sender.username, function(avatarAsPng) {
notification.icon = avatarAsPng;
return KonchatNotification.notify(notification); //eslint-disable-line
return KonchatNotification.notify(notification);
});
},

Expand Down
1 change: 0 additions & 1 deletion packages/rocketchat-ui/client/lib/rocket.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* globals Modernizr */
RocketChat.Login = (function() {
function onClick(el) {
const $el = $(el);
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui/client/lib/sideNav.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FlowRouter } from 'meteor/kadira:flow-router';
import { Session } from 'meteor/session';

SideNav = new class { //eslint-disable-line
SideNav = new class {
constructor() {
this.initiated = false;
this.sideNav = {};
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui/client/lib/tapi18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ this.tr = function(key, options, ...replaces) {
}
};

isRtl = (lang) => { //eslint-disable-line
isRtl = (lang) => {
const language = lang || localStorage.getItem('userLanguage') || 'en-US';
return ['ar', 'dv', 'fa', 'he', 'ku', 'ps', 'sd', 'ug', 'ur', 'yi'].includes(language.split('-').shift().toLowerCase());
};
3 changes: 1 addition & 2 deletions packages/rocketchat-ui/client/views/app/alerts.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* globals alerts */
import { Blaze } from 'meteor/blaze';
import { Template } from 'meteor/templating';

alerts = { //eslint-disable-line
alerts = {
renderedAlert: null,
open(config) {
this.close(false);
Expand Down
1 change: 0 additions & 1 deletion packages/rocketchat-ui/client/views/app/modal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* globals modal */
import { Meteor } from 'meteor/meteor';
import { Blaze } from 'meteor/blaze';
import { Template } from 'meteor/templating';
Expand Down
1 change: 0 additions & 1 deletion packages/rocketchat-ui/client/views/app/popout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
import { Blaze } from 'meteor/blaze';
import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating';
Expand Down
3 changes: 1 addition & 2 deletions packages/rocketchat-ui/client/views/app/popover.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* globals popover isRtl */
import { Meteor } from 'meteor/meteor';
import { Blaze } from 'meteor/blaze';
import { FlowRouter } from 'meteor/kadira:flow-router';
Expand All @@ -8,7 +7,7 @@ import _ from 'underscore';

import { hide, leave } from 'meteor/rocketchat:lib';

popover = { //eslint-disable-line
popover = {
renderedPopover: null,
open({ currentTarget, ...config }) {
// Popover position must be computed as soon as possible, avoiding DOM changes over currentTarget
Expand Down
6 changes: 2 additions & 4 deletions packages/rocketchat-ui/client/views/app/room.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* globals chatMessages, fileUpload , fireGlobalEvent , cordova , readMessage , RoomRoles, popover , device */
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Random } from 'meteor/random';
Expand All @@ -8,15 +7,15 @@ import { FlowRouter } from 'meteor/kadira:flow-router';
import { RocketChatTabBar } from 'meteor/rocketchat:lib';
import { Session } from 'meteor/session';
import { Template } from 'meteor/templating';

import { WebRTC } from 'meteor/rocketchat:webrtc';
import _ from 'underscore';
import moment from 'moment';
import mime from 'mime-type/with-db';
import Clipboard from 'clipboard';

import { lazyloadtick } from 'meteor/rocketchat:lazy-load';

chatMessages = {}; // eslint-disable-line
chatMessages = {};
const isSubscribed = (_id) => ChatSubscription.find({ rid: _id }).count() > 0;

const favoritesEnabled = () => RocketChat.settings.get('Favorite_Rooms');
Expand Down Expand Up @@ -1114,7 +1113,6 @@ Template.room.onRendered(function() {
});

wrapper.addEventListener('scroll', () => updateUnreadCount());
/* globals WebRTC */
// salva a data da renderização para exibir alertas de novas mensagens
$.data(this.firstNode, 'renderedAt', new Date);

Expand Down
1 change: 0 additions & 1 deletion packages/rocketchat-ui/client/views/app/secretURL.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* globals KonchatNotification */
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { FlowRouter } from 'meteor/kadira:flow-router';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* globals WebRTC */
import { Session } from 'meteor/session';
import { Template } from 'meteor/templating';
import { WebRTC } from 'meteor/rocketchat:webrtc';

Template.videoButtons.helpers({
videoAvaliable() {
Expand Down
Loading

0 comments on commit ce3da9e

Please sign in to comment.