Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Update tsconfig base target to es2020 #27552

Merged
merged 21 commits into from
Dec 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions _templates/service/new/tsconfig.json.ejs.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,9 @@
to: ee/apps/<%= name %>/tsconfig.json
---
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.base.server.json",
"compilerOptions": {
"target": "es2018",
"lib": ["esnext", "dom"],
"allowJs": true,
"checkJs": false,
"incremental": true,

/* Strict Type-Checking Options */
"noImplicitAny": true,
"strictNullChecks": true,
"strictPropertyInitialization": false,
"strictFunctionTypes": false,

/* Additional Checks */
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": false,

/* Module Resolution Options */
"outDir": "./dist",
"importsNotUsedAsValues": "preserve",
"declaration": false,
"declarationMap": false
"outDir": "./dist"
},
"files": ["./src/service.ts"],
"include": ["../../../apps/meteor/definition/externals/meteor"],
Expand Down
45 changes: 1 addition & 44 deletions apps/meteor/ee/server/services/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,5 @@
{
"compilerOptions": {
"module": "CommonJS",
"target": "es2018",
"lib": ["esnext", "dom"],

"allowJs": true,
"checkJs": false,
"jsx": "react",
// "incremental": true,
// "noEmit": true,

/* Strict Type-Checking Options */
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictPropertyInitialization": false,

/* Additional Checks */
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": false,

/* Module Resolution Options */
"baseUrl": ".",
"paths": {
/* Support absolute /imports/* with a leading '/' */
"/*": ["*"]
},
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"preserveSymlinks": true,

"outDir": "./dist",

"skipLibCheck": true

// "sourceMap": true,
// "declaration": true,
// "removeComments": false,
// "emitDecoratorMetadata": true,
// "experimentalDecorators": true,
},
"extends": "../../../tsconfig.json",
"include": ["./**/*", "../../../definition/externals/meteor/rocketchat-streamer.d.ts", "../../../../../ee/apps/account-service/src/lib"],
"exclude": ["./dist", "./ecosystem.config.js", "../../../definition/methods"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import proxyquire from 'proxyquire';
import { expect } from 'chai';
import sinon from 'sinon';
import { IUser } from '@rocket.chat/core-typings';
import type { IUser } from '@rocket.chat/core-typings';

const { executeSlashCommand } = proxyquire.noCallThru().load('../../../../../../../../app/federation-v2/server/infrastructure/rocket-chat/slash-commands/action', {
'@rocket.chat/models': {
Expand Down
12 changes: 6 additions & 6 deletions apps/meteor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
"stylelint:fix": "stylelint --fix \"app/**/*.css\" \"client/**/*.css\" \"app/**/*.less\" \"client/**/*.less\" \"ee/**/*.less\"",
"typecheck": "cross-env NODE_OPTIONS=\"--max-old-space-size=4098\" tsc -p tsconfig.typecheck.json",
"deploy": "npm run build && pm2 startOrRestart pm2.json",
"coverage": "nyc -r html mocha --config ./.mocharc.js",
"coverage": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' nyc -r html mocha --config ./.mocharc.js",
"test:e2e": "playwright test",
"test:e2e:nyc": "nyc report --reporter=text-summary --reporter=lcov",
"testapi": "mocha --config ./.mocharc.api.js",
"testapi": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha --config ./.mocharc.api.js",
"testunit": "npm run .testunit:definition && npm run .testunit:client && npm run .testunit:server",
".testunit:server": "mocha --config ./.mocharc.js",
".testunit:client": "mocha --config ./.mocharc.client.js",
".testunit:definition": "mocha --config ./.mocharc.definition.js",
"testunit-watch": "mocha --watch --config ./.mocharc.js",
".testunit:server": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha --config ./.mocharc.js",
".testunit:client": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha --config ./.mocharc.client.js",
".testunit:definition": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha --config ./.mocharc.definition.js",
"testunit-watch": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha --watch --config ./.mocharc.js",
"test": "npm run testapi && npm run testui",
"translation-diff": "node .scripts/translationDiff.js",
"translation-check": "node .scripts/check-i18n.js",
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/tests/data/livechat/business-hours.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ILivechatBusinessHour } from '@rocket.chat/core-typings';
import type { ILivechatBusinessHour } from '@rocket.chat/core-typings';
import { credentials, methodCall, request } from '../api-data';

export const saveBusinessHour = async (businessHour: ILivechatBusinessHour) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/tests/data/livechat/canned-responses.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import faker from '@faker-js/faker';
import { IOmnichannelCannedResponse } from '@rocket.chat/core-typings';
import type { IOmnichannelCannedResponse } from '@rocket.chat/core-typings';
import { api, credentials, request } from '../api-data';
import type { DummyResponse } from './utils';

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/tests/data/livechat/custom-fields.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Response } from 'supertest';
import { ILivechatCustomField } from '@rocket.chat/core-typings';
import type { ILivechatCustomField } from '@rocket.chat/core-typings';
import { credentials, request, methodCall, api } from './../api-data';

export const createCustomField = (customField: ILivechatCustomField) => new Promise((resolve, reject) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/tests/data/livechat/department.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { api, credentials, methodCall, request } from '../api-data';
import { password } from '../user';
import { createUser, login } from '../users.helper';
import { createAgent, makeAgentAvailable } from './rooms';
import { DummyResponse } from './utils';
import type { DummyResponse } from './utils';

export const createDepartment = (): Promise<ILivechatDepartment> =>
new Promise((resolve, reject) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/tests/data/livechat/priorities.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import faker from '@faker-js/faker';
import { ILivechatPriority } from '@rocket.chat/core-typings';
import type { ILivechatPriority } from '@rocket.chat/core-typings';
import { credentials, methodCall, request } from '../api-data';
import { DummyResponse } from './utils';
import type { DummyResponse } from './utils';

export const savePriority = (): Promise<ILivechatPriority> => {
return new Promise((resolve, reject) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/tests/data/livechat/rooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import faker from '@faker-js/faker';
import type { IInquiry, ILivechatAgent, ILivechatDepartment, ILivechatVisitor, IMessage, IOmnichannelRoom } from '@rocket.chat/core-typings';
import { api, credentials, methodCall, request } from '../api-data';
import { adminUsername } from '../user';
import { DummyResponse } from './utils';
import type { DummyResponse } from './utils';

export const createLivechatRoom = (visitorToken: string): Promise<IOmnichannelRoom> =>
new Promise((resolve) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/tests/data/livechat/tags.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import faker from '@faker-js/faker';
import { ILivechatTag } from '@rocket.chat/core-typings';
import type { ILivechatTag } from '@rocket.chat/core-typings';
import { credentials, methodCall, request } from '../api-data';
import { DummyResponse } from './utils';
import type { DummyResponse } from './utils';

export const saveTags = (): Promise<ILivechatTag> => {
return new Promise((resolve, reject) => {
Expand Down
6 changes: 3 additions & 3 deletions apps/meteor/tests/data/livechat/triggers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import faker from '@faker-js/faker';
import { ILivechatTrigger } from '@rocket.chat/core-typings';
import type { ILivechatTrigger } from '@rocket.chat/core-typings';
import { api, credentials, methodCall, request } from '../api-data';
import { DummyResponse } from './utils';
import type { DummyResponse } from './utils';

export const createTrigger = (name: string): Promise<boolean> => {
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -37,4 +37,4 @@ export const fetchTriggers = (): Promise<ILivechatTrigger[]> => {
resolve(res.body.triggers);
});
});
};
};
6 changes: 3 additions & 3 deletions apps/meteor/tests/data/livechat/units.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import faker from "@faker-js/faker";
import { IOmnichannelBusinessUnit } from "@rocket.chat/core-typings";
import type { IOmnichannelBusinessUnit } from "@rocket.chat/core-typings";
import { methodCall, credentials, request } from "../api-data";
import { DummyResponse } from "./utils";
import type { DummyResponse } from "./utils";

export const createMonitor = async (username: string): Promise<{ _id: string; username: string }> => {
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -45,4 +45,4 @@ export const createUnit = async (monitorId: string, username: string, department
resolve(JSON.parse(res.body.message).result);
});
});
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import proxyquire from 'proxyquire';
import { expect } from 'chai';
import sinon from 'sinon';
import { IUser } from '@rocket.chat/core-typings';
import type { IUser } from '@rocket.chat/core-typings';

const {
normalizeExternalInviteeId,
Expand Down
12 changes: 2 additions & 10 deletions apps/meteor/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "CommonJS",
"target": "es2018",
"module": "esNext",
"lib": ["esnext", "dom"],

"allowJs": true,
"checkJs": false,
"jsx": "react",
// "incremental": true,
"noEmit": true,

/* Strict Type-Checking Options */
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictPropertyInitialization": false,

/* Additional Checks */
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": false,

Expand All @@ -28,9 +23,6 @@
/* Support absolute /imports/* with a leading '/' */
"/*": ["*"]
},
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"preserveSymlinks": true

// "sourceMap": true,
Expand Down
6 changes: 6 additions & 0 deletions docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '3.8'

services:
rocketchat:
platform: linux/amd64
build:
dockerfile: ${RC_DOCKERFILE}
context: /tmp/build
Expand All @@ -25,6 +26,7 @@ services:
traefik.http.routers.rocketchat.rule: PathPrefix(`/`)

authorization-service:
platform: linux/amd64
build:
dockerfile: ee/apps/authorization-service/Dockerfile
args:
Expand All @@ -40,6 +42,7 @@ services:
- nats

account-service:
platform: linux/amd64
build:
dockerfile: ee/apps/account-service/Dockerfile
args:
Expand All @@ -55,6 +58,7 @@ services:
- nats

presence-service:
platform: linux/amd64
build:
dockerfile: ee/apps/presence-service/Dockerfile
args:
Expand All @@ -70,6 +74,7 @@ services:
- nats

ddp-streamer-service:
platform: linux/amd64
build:
dockerfile: ee/apps/ddp-streamer/Dockerfile
args:
Expand All @@ -91,6 +96,7 @@ services:
traefik.http.routers.ddp-streamer-service.rule: PathPrefix(`/websocket`) || PathPrefix(`/sockjs`)

stream-hub-service:
platform: linux/amd64
build:
dockerfile: ee/apps/stream-hub-service/Dockerfile
args:
Expand Down
16 changes: 4 additions & 12 deletions ee/apps/account-service/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.base.server.json",
"compilerOptions": {
"target": "es2018",
"lib": ["esnext", "dom"],
"allowJs": true,
"checkJs": false,
"allowJs": true, // TODO remove asap
"incremental": true,

/* Strict Type-Checking Options */
"noImplicitAny": true,
"strictNullChecks": true,
"strictPropertyInitialization": false,
"strictFunctionTypes": false,

/* Additional Checks */
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": false,

/* Module Resolution Options */
"outDir": "./dist",
"importsNotUsedAsValues": "preserve",
"declaration": false,
"declarationMap": false

"outDir": "./dist"
},
"files": ["./src/service.ts"],
"include": ["../../../apps/meteor/definition/externals/meteor"],
Expand Down
28 changes: 4 additions & 24 deletions ee/apps/authorization-service/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.base.server.json",
"compilerOptions": {
"target": "es2018",
"lib": ["esnext", "dom"],
"allowJs": true,
"checkJs": false,
"incremental": true,

/* Strict Type-Checking Options */
"noImplicitAny": true,
"strictNullChecks": true,
"strictPropertyInitialization": false,
"strictFunctionTypes": false,

/* Additional Checks */
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": false,

/* Module Resolution Options */
"outDir": "./dist",
"importsNotUsedAsValues": "preserve",
"declaration": false,
"declarationMap": false
"strictPropertyInitialization": false, // TODO: Remove this line
"allowJs": true, // TODO: Remove this line
"outDir": "./dist"
},
"files": ["./src/service.ts"],
"include": ["../../../apps/meteor/definition/externals/meteor"],
Expand Down
Loading