:refactor: Fix lint issues

This commit is contained in:
Jan Oberhauser 2022-08-24 16:38:40 +02:00
parent 1a5b273c5b
commit 5a546e426d

View file

@ -151,7 +151,7 @@ function searchForHeader(headers: IDataObject, headerName: string) {
} }
async function generateContentLengthHeader(formData: FormData, headers: IDataObject) { async function generateContentLengthHeader(formData: FormData, headers: IDataObject) {
if (!formData || !formData.getLength) { if (!formData?.getLength) {
return; return;
} }
try { try {
@ -926,7 +926,7 @@ export async function requestOAuth2(
const { data } = await oAuthClient.credentials.getToken(); const { data } = await oAuthClient.credentials.getToken();
// Find the credentials // Find the credentials
if (!node.credentials || !node.credentials[credentialsType]) { if (!node.credentials?.[credentialsType]) {
throw new Error( throw new Error(
`The node "${node.name}" does not have credentials of type "${credentialsType}"!`, `The node "${node.name}" does not have credentials of type "${credentialsType}"!`,
); );
@ -1006,7 +1006,7 @@ export async function requestOAuth2(
credentials.oauthTokenData = newToken.data; credentials.oauthTokenData = newToken.data;
// Find the credentials // Find the credentials
if (!node.credentials || !node.credentials[credentialsType]) { if (!node.credentials?.[credentialsType]) {
throw new Error( throw new Error(
`The node "${node.name}" does not have credentials of type "${credentialsType}"!`, `The node "${node.name}" does not have credentials of type "${credentialsType}"!`,
); );
@ -1077,7 +1077,7 @@ export async function requestOAuth2(
credentials.oauthTokenData = newToken.data; credentials.oauthTokenData = newToken.data;
// Find the credentials // Find the credentials
if (!node.credentials || !node.credentials[credentialsType]) { if (!node.credentials?.[credentialsType]) {
throw new Error( throw new Error(
`The node "${node.name}" does not have credentials of type "${credentialsType}"!`, `The node "${node.name}" does not have credentials of type "${credentialsType}"!`,
); );
@ -1543,7 +1543,7 @@ export async function getCredentials(
} }
// Check if node has any credentials defined // Check if node has any credentials defined
if (!fullAccess && (!node.credentials || !node.credentials[type])) { if (!fullAccess && !node.credentials?.[type]) {
// If none are defined check if the credentials are required or not // If none are defined check if the credentials are required or not
if (nodeCredentialDescription?.required === true) { if (nodeCredentialDescription?.required === true) {
@ -1560,7 +1560,7 @@ export async function getCredentials(
} }
} }
if (fullAccess && (!node.credentials || !node.credentials[type])) { if (fullAccess && !node.credentials?.[type]) {
// Make sure that fullAccess nodes still behave like before that if they // Make sure that fullAccess nodes still behave like before that if they
// request access to credentials that are currently not set it returns undefined // request access to credentials that are currently not set it returns undefined
throw new NodeOperationError(node, 'Credentials not found'); throw new NodeOperationError(node, 'Credentials not found');