Skip to content

Commit

Permalink
Merge pull request #1 from RocketChat/develop
Browse files Browse the repository at this point in the history
Chore: Upgrade ESLint (RocketChat#26132)
  • Loading branch information
TimiBolu authored Jul 22, 2022
2 parents 65c4906 + bff5d48 commit 0c13bdc
Show file tree
Hide file tree
Showing 172 changed files with 1,806 additions and 1,768 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"eslint.workingDirectories": [
{
"directory": "packages/*",
"pattern": "packages/*",
"changeProcessCWD": true
},
{
"directory": "apps/meteor",
"pattern": "apps/*",
"changeProcessCWD": true
}
],
Expand Down
7 changes: 7 additions & 0 deletions _templates/package/new/.eslintrc.json.ejs.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
to: packages/<%= name %>/.eslintrc.json
---
{
"extends": ["@rocket.chat/eslint-config"],
"ignorePatterns": ["**/dist"]
}
12 changes: 1 addition & 11 deletions _templates/package/new/package.json.ejs.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,5 @@ to: packages/<%= name %>/package.json
"typings": "./dist/index.d.ts",
"files": [
"/dist"
],
"dependencies": {
},
"eslintConfig": {
"extends": [
"@rocket.chat/eslint-config"
],
"ignorePatterns": [
"**/dist"
]
}
]
}
File renamed without changes.
1 change: 0 additions & 1 deletion apps/meteor/.storybook/.eslintrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions apps/meteor/.storybook/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../client/.eslintrc.json"
}
2 changes: 1 addition & 1 deletion apps/meteor/app/api/server/v1/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
import { Meteor } from 'meteor/meteor';
import {
ise2eGetUsersOfRoomWithoutKeyParamsGET,
Expand Down Expand Up @@ -134,6 +133,7 @@ API.v1.addRoute(
},
{
post() {
// eslint-disable-next-line @typescript-eslint/naming-convention
const { public_key, private_key } = Meteor.call('e2e.fetchMyKeys');

Meteor.call('e2e.setUserPublicAndPrivateKeys', {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/api/server/v1/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ API.v1.addRoute(
);

declare module '@rocket.chat/rest-typings' {
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
// eslint-disable-next-line @typescript-eslint/naming-convention
interface Endpoints {
'method.call/:method': {
POST: (params: { method: string; args: any[] }) => any;
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/apps/server/bridges/rooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class AppRoomBridge extends RoomBridge {

const discussion = {
prid: rcRoom.prid,
t_name: rcRoom.fname, // eslint-disable-line @typescript-eslint/camelcase
t_name: rcRoom.fname,
pmid: rcMessage ? rcMessage._id : undefined,
reply: reply && reply.trim() !== '' ? reply : undefined,
users: members.length > 0 ? members : [],
Expand Down
13 changes: 0 additions & 13 deletions apps/meteor/app/assets/server/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const assets: IRocketChatAssets = {
extensions: ['svg', 'png', 'jpg', 'jpeg'],
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
favicon_ico: {
label: 'favicon (ico)',
defaultUrl: 'favicon.ico',
Expand All @@ -57,7 +56,6 @@ const assets: IRocketChatAssets = {
extensions: ['svg'],
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
favicon_16: {
label: 'favicon 16x16 (png)',
defaultUrl: 'images/logo/favicon-16x16.png',
Expand All @@ -68,7 +66,6 @@ const assets: IRocketChatAssets = {
height: 16,
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
favicon_32: {
label: 'favicon 32x32 (png)',
defaultUrl: 'images/logo/favicon-32x32.png',
Expand All @@ -79,7 +76,6 @@ const assets: IRocketChatAssets = {
height: 32,
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
favicon_192: {
label: 'android-chrome 192x192 (png)',
defaultUrl: 'images/logo/android-chrome-192x192.png',
Expand All @@ -90,7 +86,6 @@ const assets: IRocketChatAssets = {
height: 192,
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
favicon_512: {
label: 'android-chrome 512x512 (png)',
defaultUrl: 'images/logo/android-chrome-512x512.png',
Expand All @@ -101,7 +96,6 @@ const assets: IRocketChatAssets = {
height: 512,
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
touchicon_180: {
label: 'apple-touch-icon 180x180 (png)',
defaultUrl: 'images/logo/apple-touch-icon.png',
Expand All @@ -112,7 +106,6 @@ const assets: IRocketChatAssets = {
height: 180,
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
touchicon_180_pre: {
label: 'apple-touch-icon-precomposed 180x180 (png)',
defaultUrl: 'images/logo/apple-touch-icon-precomposed.png',
Expand All @@ -123,7 +116,6 @@ const assets: IRocketChatAssets = {
height: 180,
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
tile_70: {
label: 'mstile 70x70 (png)',
defaultUrl: 'images/logo/mstile-70x70.png',
Expand All @@ -134,7 +126,6 @@ const assets: IRocketChatAssets = {
height: 70,
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
tile_144: {
label: 'mstile 144x144 (png)',
defaultUrl: 'images/logo/mstile-144x144.png',
Expand All @@ -145,7 +136,6 @@ const assets: IRocketChatAssets = {
height: 144,
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
tile_150: {
label: 'mstile 150x150 (png)',
defaultUrl: 'images/logo/mstile-150x150.png',
Expand All @@ -156,7 +146,6 @@ const assets: IRocketChatAssets = {
height: 150,
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
tile_310_square: {
label: 'mstile 310x310 (png)',
defaultUrl: 'images/logo/mstile-310x310.png',
Expand All @@ -167,7 +156,6 @@ const assets: IRocketChatAssets = {
height: 310,
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
tile_310_wide: {
label: 'mstile 310x150 (png)',
defaultUrl: 'images/logo/mstile-310x150.png',
Expand All @@ -178,7 +166,6 @@ const assets: IRocketChatAssets = {
height: 150,
},
},
// eslint-disable-next-line @typescript-eslint/camelcase
safari_pinned: {
label: 'safari pinned tab (svg)',
defaultUrl: 'images/logo/safari-pinned-tab.svg',
Expand Down
4 changes: 0 additions & 4 deletions apps/meteor/app/autotranslate/server/deeplTranslate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,7 @@ class DeeplAutoTranslate extends AutoTranslate {
try {
const result = HTTP.get(this.apiEndPointUrl, {
params: {
// eslint-disable-next-line @typescript-eslint/camelcase
auth_key: this.apiKey,
// eslint-disable-next-line @typescript-eslint/camelcase
target_lang: language,
},
query,
Expand Down Expand Up @@ -258,9 +256,7 @@ class DeeplAutoTranslate extends AutoTranslate {
try {
const result = HTTP.get(this.apiEndPointUrl, {
params: {
// eslint-disable-next-line @typescript-eslint/camelcase
auth_key: this.apiKey,
// eslint-disable-next-line @typescript-eslint/camelcase
target_lang: language,
},
query,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,9 @@ export class MatrixBridge implements IFederationBridge {
options: {
visibility,
preset,
// eslint-disable-next-line @typescript-eslint/camelcase
is_direct: true,
invite: externalInviteeIds,
// eslint-disable-next-line @typescript-eslint/camelcase
creation_content: {
// eslint-disable-next-line @typescript-eslint/camelcase
was_internally_programatically_created: true,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export class RocketChatSettingsAdapter {
}

public generateRegistrationFileObject(): Record<string, any> {
/* eslint-disable @typescript-eslint/camelcase */
return {
id: this.getApplicationServiceId(),
hs_token: this.getApplicationHomeServerToken(),
Expand Down Expand Up @@ -102,7 +101,6 @@ export class RocketChatSettingsAdapter {
],
},
};
/* eslint-enable @typescript-eslint/camelcase */
}

private async updateRegistrationFile(): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import _ from 'underscore';
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/app/lib/lib/MessageTypes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
import { Meteor } from 'meteor/meteor';

import { MessageTypes } from '../../ui-utils/lib/MessageTypes';
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/app/lib/server/functions/attachMessage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
import type { IMessage, IRoom } from '@rocket.chat/core-typings';
import { MessageAttachment } from '@rocket.chat/core-typings';

Expand Down
1 change: 0 additions & 1 deletion apps/meteor/app/lib/server/methods/restartServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Meteor } from 'meteor/meteor';
import { hasPermission } from '../../../authorization/server';

Meteor.methods({
// eslint-disable-next-line @typescript-eslint/camelcase
restart_server() {
const uid = Meteor.userId();

Expand Down
1 change: 0 additions & 1 deletion apps/meteor/app/lib/server/startup/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,6 @@ settingsRegistry.addGroup('General', function () {
],
});

// eslint-disable-next-line @typescript-eslint/camelcase
this.add(
'Site_Url',
typeof (global as any).__meteor_runtime_config__ !== 'undefined' && (global as any).__meteor_runtime_config__ !== null
Expand Down
5 changes: 0 additions & 5 deletions apps/meteor/app/mailer/server/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@ export const replace = (str: string, data: { [key: string]: unknown } = {}): str
}

const options = {
// eslint-disable-next-line @typescript-eslint/camelcase
Site_Name: settings.get<string>('Site_Name'),
// eslint-disable-next-line @typescript-eslint/camelcase
Site_URL: settings.get<string>('Site_Url'),
// eslint-disable-next-line @typescript-eslint/camelcase
Site_URL_Slash: settings.get<string>('Site_Url')?.replace(/\/?$/, '/'),
...(data.name
? {
Expand All @@ -61,9 +58,7 @@ export const replaceEscaped = (str: string, data: { [key: string]: unknown } = {
const siteUrl = settings.get<string>('Site_Url');

return replace(str, {
// eslint-disable-next-line @typescript-eslint/camelcase
Site_Name: siteName ? escapeHTML(siteName) : undefined,
// eslint-disable-next-line @typescript-eslint/camelcase
Site_Url: siteUrl ? escapeHTML(siteUrl) : undefined,
...Object.entries(data).reduce<{ [key: string]: string }>((ret, [key, value]) => {
if (value !== undefined && value !== null) {
Expand Down
2 changes: 0 additions & 2 deletions apps/meteor/app/metrics/server/lib/collectMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ const setPrometheusData = async (): Promise<void> => {
metrics.info.set(
{
version: Info.version,
// eslint-disable-next-line @typescript-eslint/camelcase
unique_id: settings.get<string>('uniqueID'),
// eslint-disable-next-line @typescript-eslint/camelcase
site_url: settings.get<string>('Site_Url'),
},
1,
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/app/notifications/server/lib/Presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export class UserPresence {
}

export class StreamPresence {
// eslint-disable-next-line @typescript-eslint/naming-convention
static getInstance(Streamer: IStreamerConstructor, name = 'user-presence'): IStreamer {
return new (class StreamPresence extends Streamer {
async _publish(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { WebApp } from 'meteor/webapp';
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/app/oembed/server/jumpToMessage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
import URL from 'url';
import QueryString from 'querystring';

Expand Down
1 change: 0 additions & 1 deletion apps/meteor/app/oembed/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ const getUrlMeta = async function (
const urlObj = URL.parse(url);
if (withFragment != null) {
const queryStringObj = querystring.parse(urlObj.query || '');
// eslint-disable-next-line @typescript-eslint/camelcase
queryStringObj._escaped_fragment_ = '';
urlObj.query = querystring.stringify(queryStringObj);
let path = urlObj.pathname;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export class PushNotification {
idOnly,
});

// eslint-disable-next-line @typescript-eslint/camelcase
metrics.notificationsSent.inc({ notification_type: 'mobile' });
Push.send(config);
}
Expand Down
5 changes: 3 additions & 2 deletions apps/meteor/app/settings/lib/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ export class SettingsBase {
private regexCallbacks = new Map<string, ISettingRegexCallbacks>();

// private ts = new Date()
public get<T extends SettingValue = SettingValue>(_id: RegExp, callback: SettingCallback): void;

public get<T extends SettingValue = SettingValue>(_id: string, callback: SettingCallback): void;
public get(_id: RegExp, callback: SettingCallback): void;

public get(_id: string, callback: SettingCallback): void;

public get<T extends SettingValue = SettingValue>(_id: RegExp): SettingComposedValue<T>[];

Expand Down
1 change: 1 addition & 0 deletions apps/meteor/app/settings/server/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { ISetting } from '@rocket.chat/core-typings';
import { Settings } from '../../models/server/models/Settings';
import { ICachedSettings } from './CachedSettings';

// eslint-disable-next-line @typescript-eslint/naming-convention
export function initializeSettings({ SettingsModel, settings }: { SettingsModel: Settings; settings: ICachedSettings }): void {
SettingsModel.find().forEach((record: ISetting) => {
settings.set(record);
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/app/ui/client/lib/fileUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type Uploading = {
};

declare module 'meteor/session' {
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Session {
function get(key: 'uploading'): Uploading[];
Expand Down
Loading

0 comments on commit 0c13bdc

Please sign in to comment.