Skip to content

Commit

Permalink
#197 Follow up and housekeeping
Browse files Browse the repository at this point in the history
- Follow-up of #135: Align duplicate `ws` dependency version
- Update eslint config to use dynamic year in headers
- Re-generate yarn.lock to update several dependencies and resolve several dependabot alerts
- Due to CI problems after Theia update: Increase pod resource limits
  • Loading branch information
ndoschek committed Jan 20, 2023
1 parent e8752f2 commit 85faf95
Show file tree
Hide file tree
Showing 7 changed files with 1,513 additions and 1,461 deletions.
27 changes: 27 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** @type {import('eslint').Linter.Config} */
const year = new Date().getFullYear();
module.exports = {
root: true,
extends: ['./configs/base.eslintrc.json', './configs/warnings.eslintrc.json', './configs/errors.eslintrc.json'],
Expand All @@ -14,6 +15,32 @@ module.exports = {
'no-unused-expressions': 0,
'no-invalid-this': 0
}
},
{
files: ['*.ts', '*.tsx'],
rules: {
// eslint-plugin-header
'header/header': [
2,
'block',
[
{
pattern: '[\n\r]+ \\* Copyright \\([cC]\\) \\d{4}(-\\d{4})? .*[\n\r]+',
template: `********************************************************************************
* Copyright (c) ${year} EclipseSource and others..
*
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0, or the MIT License which is
* available at https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: EPL-2.0 OR MIT
********************************************************************************`
}
]
]
}
}
]
};
8 changes: 4 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ spec:
tty: true
resources:
limits:
memory: "2Gi"
cpu: "1"
memory: "4Gi"
cpu: "2"
requests:
memory: "2Gi"
cpu: "1"
memory: "4Gi"
cpu: "2"
command:
- cat
volumeMounts:
Expand Down
19 changes: 0 additions & 19 deletions configs/errors.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,6 @@
}
],
"@typescript-eslint/semi": ["error", "always"],
// eslint-plugin-header
"header/header": [
2,
"block",
[
"*******************************************************************************",
{
"pattern": " \\* Copyright \\([cC]\\) \\d{4}(-\\d{4})? .+"
},
" *",
" * This program and the accompanying materials are made available under the",
" * terms of the Eclipse Public License v. 2.0 which is available at",
" * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is",
" * available at https://opensource.org/licenses/MIT.",
" *",
" * SPDX-License-Identifier: EPL-2.0 OR MIT",
" ******************************************************************************"
]
],
// eslint-plugin-import
"import/export": "off", // we have multiple exports due to namespaces, enums and classes that share the same name
"import/no-deprecated": "error",
Expand Down
2 changes: 1 addition & 1 deletion packages/modelserver-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"fast-json-patch": "^3.1.0",
"isomorphic-ws": "^4.0.1",
"urijs": "^1.19.11",
"ws": "^7.4.6"
"ws": "8.5.0"
},
"devDependencies": {
"@types/moxios": "0.4.14",
Expand Down
8 changes: 2 additions & 6 deletions packages/modelserver-client/src/model-server-client-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0 OR MIT
*******************************************************************************/
import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import { deepClone } from 'fast-json-patch';
import WebSocket from 'isomorphic-ws';
import URI from 'urijs';
Expand Down Expand Up @@ -344,7 +344,7 @@ export class ModelServerClientV2 implements ModelServerClientApiV2 {
}
return mapper(response.data);
} catch (error) {
if (isAxiosError(error)) {
if (axios.isAxiosError(error)) {
const message = error.response?.data ? error.response.data : error.message;
throw new ModelServerError(message, error.code);
} else {
Expand All @@ -354,10 +354,6 @@ export class ModelServerClientV2 implements ModelServerClientApiV2 {
}
}

function isAxiosError(error: any): error is AxiosError {
return error !== undefined && error instanceof Error && 'isAxiosError' in error && error['isAxiosError'];
}

/**
* Helper type for method overloads where on parameter could either be
* a 'format' string or a typeguard to cast the response to a concrete type.
Expand Down
8 changes: 2 additions & 6 deletions packages/modelserver-client/src/model-server-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0 OR MIT
*******************************************************************************/
import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import WebSocket from 'isomorphic-ws';
import URI from 'urijs';

Expand Down Expand Up @@ -266,7 +266,7 @@ export class ModelServerClient implements ModelServerClientApiV1 {
}
return mapper(response.data);
} catch (error) {
if (isAxiosError(error)) {
if (axios.isAxiosError(error)) {
const message = error.response?.data ? error.response.data : error.message;
throw new ModelServerError(message, error.code);
} else {
Expand All @@ -276,10 +276,6 @@ export class ModelServerClient implements ModelServerClientApiV1 {
}
}

function isAxiosError(error: any): error is AxiosError {
return error !== undefined && error instanceof Error && 'isAxiosError' in error && error['isAxiosError'];
}

/**
* Helper type for method overloads where on parameter could either be
* a 'format' string or a typeguard to cast the response to a concrete type.
Expand Down
Loading

0 comments on commit 85faf95

Please sign in to comment.