Skip to content

Commit 9554dfb

Browse files
chore: Update prettier (kyma-project#4196)
* Update package * Format all with new prettier * Format all with new prettier * Correction after format
1 parent 269ef05 commit 9554dfb

File tree

552 files changed

+2753
-3451
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

552 files changed

+2753
-3451
lines changed

backend/companion/companionRouter.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import addLogger from '../logging';
99
const config = require('../config.js');
1010

1111
const tokenManager = new TokenManager();
12-
const COMPANION_API_BASE_URL = `${config.features?.KYMA_COMPANION?.config
13-
?.apiBaseUrl ?? ''}/api/conversations/`;
12+
const COMPANION_API_BASE_URL = `${
13+
config.features?.KYMA_COMPANION?.config?.apiBaseUrl ?? ''
14+
}/api/conversations/`;
1415
const SKIP_AUTH = config.features?.KYMA_COMPANION?.config?.skipAuth ?? false;
1516
const router = express.Router();
1617

@@ -106,13 +107,8 @@ async function handlePromptSuggestions(req, res) {
106107
}
107108

108109
async function handleChatMessage(req, res) {
109-
const {
110-
query,
111-
namespace,
112-
resourceType,
113-
groupVersion,
114-
resourceName,
115-
} = JSON.parse(req.body.toString());
110+
const { query, namespace, resourceType, groupVersion, resourceName } =
111+
JSON.parse(req.body.toString());
116112

117113
const authData = extractAuthHeaders(req);
118114
const conversationId = authData.sessionId;

backend/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ if (isDocker) {
8585
app.use('/backend', handleRequest);
8686
}
8787

88-
process.on('SIGINT', function() {
88+
process.on('SIGINT', function () {
8989
process.exit();
9090
});
9191

backend/kubernetes/handler.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ const escape = require('lodash.escape');
88
// https://github.tools.sap/sgs/SAP-Global-Trust-List/blob/master/approved.pem
99
const certs = fs.readFileSync('certs.pem', 'utf8');
1010

11-
const isHeaderDefined = headerValue => {
11+
const isHeaderDefined = (headerValue) => {
1212
return headerValue !== undefined && headerValue !== 'undefined';
1313
};
1414

15-
const decodeHeaderToBuffer = headerValue => {
15+
const decodeHeaderToBuffer = (headerValue) => {
1616
return isHeaderDefined(headerValue)
1717
? Buffer.from(headerValue, 'base64')
1818
: null;
@@ -21,7 +21,7 @@ const decodeHeaderToBuffer = headerValue => {
2121
// for some mysterious reason, request for node metrics
2222
// comes with "Connection: Upgrade" header, causing
2323
// "invalid upgrade response: status code 200" error
24-
const workaroundForNodeMetrics = req => {
24+
const workaroundForNodeMetrics = (req) => {
2525
if (req.originalUrl.includes('apis/metrics.k8s.io/v1beta1/nodes')) {
2626
req.headers['connection'] = 'close';
2727
}
@@ -39,7 +39,7 @@ export async function handleK8sRequests(req, res) {
3939
}
4040

4141
try {
42-
filters.forEach(filter => filter(req, headersData));
42+
filters.forEach((filter) => filter(req, headersData));
4343
} catch (e) {
4444
req.log.error('Filters rejected the request: ' + e.message);
4545
res.contentType('text/plain; charset=utf-8');
@@ -65,7 +65,7 @@ export async function handleK8sRequests(req, res) {
6565
};
6666
workaroundForNodeMetrics(req);
6767

68-
const k8sRequest = https.request(options, function(k8sResponse) {
68+
const k8sRequest = https.request(options, function (k8sResponse) {
6969
if (
7070
k8sResponse.headers &&
7171
(k8sResponse.headers['Content-Type']?.includes('\\') ||

backend/logging/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ function configureLogger() {
77

88
return PinoHttp({
99
autoLogging: !!isDev, //to disable the automatic "request completed" and "request errored" logging.
10-
genReqId: req => {
10+
genReqId: (req) => {
1111
req.id = uuid();
1212
return req.id;
1313
},
1414
serializers: {
15-
req: req => ({
15+
req: (req) => ({
1616
id: req.id,
1717
method: req.method,
1818
url: req.url,

backend/modules/communityRouter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async function handleGetCommunityResource(req, res) {
2020
const allowedDomains = ['github.com', 'github.io'];
2121
if (
2222
url.protocol !== 'https:' ||
23-
!allowedDomains.some(domain => url.hostname.endsWith(domain))
23+
!allowedDomains.some((domain) => url.hostname.endsWith(domain))
2424
) {
2525
return res.status(400).json({
2626
message: 'Invalid or untrusted link provided.',

backend/proxy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function isLocalDomain(hostname) {
1212
return true;
1313
}
1414

15-
return localSuffixes.some(suffix => hostname.endsWith(suffix));
15+
return localSuffixes.some((suffix) => hostname.endsWith(suffix));
1616
}
1717

1818
function isValidHost(hostname) {
@@ -97,7 +97,7 @@ async function proxyHandler(req, res) {
9797
timeout: 30000,
9898
};
9999

100-
const proxyReq = httpsRequest(options, proxyRes => {
100+
const proxyReq = httpsRequest(options, (proxyRes) => {
101101
res.writeHead(proxyRes.statusCode, proxyRes.headers);
102102
proxyRes.pipe(res);
103103
});

backend/request-filters.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export const localIpFilter = (_req, headersData) => {
22
//https://stackoverflow.com/a/62925185, but without 127.0.0.1 range
3-
const localIpRegex = /\b(0?10\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|172\.0?1[6-9]\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|172\.0?2[0-9]\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|172\.0?3[01]\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|192\.168\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|169\.254\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|::1|[fF][cCdD][0-9a-fA-F]{2}(?:[:][0-9a-fA-F]{0,4}){0,7}|[fF][eE][89aAbB][0-9a-fA-F](?:[:][0-9a-fA-F]{0,4}){0,7})(?:\/([789]|1?[0-9]{2}))?\b/;
3+
const localIpRegex =
4+
/\b(0?10\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|172\.0?1[6-9]\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|172\.0?2[0-9]\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|172\.0?3[01]\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|192\.168\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|169\.254\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|::1|[fF][cCdD][0-9a-fA-F]{2}(?:[:][0-9a-fA-F]{0,4}){0,7}|[fF][eE][89aAbB][0-9a-fA-F](?:[:][0-9a-fA-F]{0,4}){0,7})(?:\/([789]|1?[0-9]{2}))?\b/;
45

56
const host = headersData.targetApiServer.host || '';
67

@@ -9,7 +10,7 @@ export const localIpFilter = (_req, headersData) => {
910
}
1011
};
1112

12-
export const pathWhitelistFilter = req => {
13+
export const pathWhitelistFilter = (req) => {
1314
const path = req.originalUrl.replace(/^\/backend/, '');
1415

1516
// list comes from "/" call to API server
@@ -27,12 +28,12 @@ export const pathWhitelistFilter = req => {
2728
'/version',
2829
];
2930

30-
if (!whitelist.some(e => path.startsWith(e))) {
31+
if (!whitelist.some((e) => path.startsWith(e))) {
3132
throw Error(`Path ${path} is not whitelisted.`);
3233
}
3334
};
3435

35-
export const pathInvalidCharacterFilter = req => {
36+
export const pathInvalidCharacterFilter = (req) => {
3637
const encodedPath = req.originalUrl;
3738
let decodedPath;
3839

@@ -55,7 +56,7 @@ export const pathInvalidCharacterFilter = req => {
5556
}
5657
};
5758

58-
export const invalidRequestMethodFilter = req => {
59+
export const invalidRequestMethodFilter = (req) => {
5960
const path = req.originalUrl;
6061
const method = req.method;
6162

backend/statics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ export const serveStaticApp = (app, requestPath, directoryPath) => {
1818
);
1919
};
2020

21-
export const serveMonaco = app => {
21+
export const serveMonaco = (app) => {
2222
app.use('/vs', express.static(path.join(__dirname, '/core-ui/vs')));
2323
};

backend/utils/other.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export function requestLogger(httpModule) {
22
var original = httpModule.request;
3-
httpModule.request = function(options, callback) {
3+
httpModule.request = function (options, callback) {
44
console.log('Outgoing HTTP request with options', options);
55
return original(options, callback);
66
};

cypress/support/component-index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
<!-- prettier-ignore -->
12
<!DOCTYPE html>
2-
<html>
3+
<html lang="en">
34
<head>
45
<meta charset="utf-8" />
56
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

0 commit comments

Comments
 (0)