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

refactor(core): Update rule typescript-eslint/no-unused-vars to not error when variable starts with _ #4523

Merged
merged 5 commits into from
Nov 8, 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
16 changes: 10 additions & 6 deletions packages/@n8n_io/eslint-config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,6 @@ const config = (module.exports = {
*/
'@typescript-eslint/no-unused-expressions': 'error',

/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
*/
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '_' }],

/**
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md
*/
Expand Down Expand Up @@ -367,7 +362,16 @@ const config = (module.exports = {
*
* Disabled because eslint-plugin-diff fails to catch it. TODO: Revisit.
*/
'@typescript-eslint/no-unused-vars': 'warn',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],

// ----------------------------------
// import
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/credentials/credentials.service.ee.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/no-cycle */
/* eslint-disable no-param-reassign */
import { DeleteResult, EntityManager, FindManyOptions, In, Not } from 'typeorm';
import { Db, ICredentialsDb } from '..';
import { DeleteResult, EntityManager, In, Not } from 'typeorm';
import { Db } from '..';
import { RoleService } from '../role/role.service';
import { CredentialsService } from './credentials.service';

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/workflows/workflows.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class WorkflowsService {
workflow: WorkflowEntity,
workflowId: string,
tags?: string[],
// eslint-disable-next-line @typescript-eslint/no-unused-vars
forceSave?: boolean,
): Promise<WorkflowEntity> {
const shared = await Db.collections.SharedWorkflow.findOne({
Expand Down
10 changes: 3 additions & 7 deletions packages/nodes-base/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {

rules: {
// TODO: remove all the following rules
'eqeqeq': 'off',
eqeqeq: 'off',
'id-denylist': 'off',
'import/extensions': 'off',
'import/order': 'off',
Expand All @@ -25,10 +25,7 @@ module.exports = {
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/lines-between-class-members': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/naming-convention': [
'error',
{ selector: 'memberLike', format: null },
],
'@typescript-eslint/naming-convention': ['error', { selector: 'memberLike', format: null }],
'@typescript-eslint/no-duplicate-imports': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
Expand All @@ -49,7 +46,6 @@ module.exports = {
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
Expand Down Expand Up @@ -171,4 +167,4 @@ module.exports = {
},
},
],
};
};
8 changes: 1 addition & 7 deletions packages/nodes-base/credentials/Aws.credentials.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Request, sign } from 'aws4';
import { ICredentialTestRequest, IHttpRequestMethods } from 'n8n-workflow';
import { ICredentialTestRequest } from 'n8n-workflow';
import {
ICredentialDataDecryptedObject,
ICredentialType,
Expand Down Expand Up @@ -369,9 +369,3 @@ export class Aws implements ICredentialType {
},
};
}

function queryToString(params: IDataObject) {
return Object.keys(params)
.map((key) => key + '=' + params[key])
.join('&');
}
1 change: 0 additions & 1 deletion packages/nodes-base/credentials/DropboxApi.credentials.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
IAuthenticateGeneric,
ICredentialTestFunction,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
IAuthenticateGeneric,
ICredentialTestFunctions,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
Expand Down
2 changes: 0 additions & 2 deletions packages/nodes-base/credentials/MattermostApi.credentials.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
IAuthenticateGeneric,
ICredentialDataDecryptedObject,
ICredentialTestRequest,
ICredentialType,
IHttpRequestOptions,
INodeProperties,
} from 'n8n-workflow';

Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/credentials/MetabaseApi.credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
ICredentialTestRequest,
ICredentialType,
IHttpRequestHelper,
IHttpRequestOptions,
INodeProperties,
} from 'n8n-workflow';

Expand Down
7 changes: 1 addition & 6 deletions packages/nodes-base/credentials/NocoDb.credentials.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
import { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow';

export class NocoDb implements ICredentialType {
name = 'nocoDb';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
import { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow';

export class NocoDbApiToken implements ICredentialType {
name = 'nocoDbApiToken';
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/credentials/ShopifyApi.credentials.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BINARY_ENCODING } from 'n8n-core';
import {
IAuthenticateGeneric,
ICredentialDataDecryptedObject,
ICredentialTestRequest,
ICredentialType,
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/credentials/TheHiveApi.credentials.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
IAuthenticate,
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
Expand Down
9 changes: 1 addition & 8 deletions packages/nodes-base/credentials/TwilioApi.credentials.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
IAuthenticateGeneric,
ICredentialDataDecryptedObject,
ICredentialTestRequest,
ICredentialType,
IHttpRequestOptions,
INodeProperties,
} from 'n8n-workflow';
import { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow';

export class TwilioApi implements ICredentialType {
name = 'twilioApi';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
IAuthenticateGeneric,
ICredentialDataDecryptedObject,
ICredentialTestRequest,
ICredentialType,
IHttpRequestOptions,
NodePropertyTypes,
} from 'n8n-workflow';

Expand Down
3 changes: 0 additions & 3 deletions packages/nodes-base/credentials/WhatsAppApi.credentials.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import {
IAuthenticateGeneric,
ICredentialDataDecryptedObject,
ICredentialTestRequest,
ICredentialType,
IHttpRequestOptions,
INodeProperties,
NodePropertyTypes,
} from 'n8n-workflow';

export class WhatsAppApi implements ICredentialType {
Expand Down
8 changes: 1 addition & 7 deletions packages/nodes-base/nodes/ActiveCampaign/GenericFunctions.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { IExecuteFunctions, IHookFunctions } from 'n8n-core';

import {
IDataObject,
ILoadOptionsFunctions,
INodeProperties,
NodeApiError,
NodeOperationError,
} from 'n8n-workflow';
import { IDataObject, ILoadOptionsFunctions, INodeProperties, NodeApiError } from 'n8n-workflow';

import { OptionsWithUri } from 'request';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ILoadOptionsFunctions,
IWebhookFunctions,
} from 'n8n-core';
import { IDataObject, NodeApiError, NodeOperationError } from 'n8n-workflow';
import { IDataObject, NodeApiError } from 'n8n-workflow';

export async function acuitySchedulingApiRequest(
this:
Expand All @@ -21,7 +21,7 @@ export async function acuitySchedulingApiRequest(
body: any = {},
qs: IDataObject = {},
uri?: string,
option: IDataObject = {},
_option: IDataObject = {},
// tslint:disable-next-line:no-any
): Promise<any> {
const authenticationMethod = this.getNodeParameter('authentication', 0);
Expand Down
2 changes: 0 additions & 2 deletions packages/nodes-base/nodes/Adalo/Adalo.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import {
IDataObject,
IExecuteSingleFunctions,
IHttpRequestOptions,
IN8nHttpFullResponse,
INodeExecutionData,
INodeType,
INodeTypeDescription,
} from 'n8n-workflow';
Expand Down
8 changes: 1 addition & 7 deletions packages/nodes-base/nodes/Affinity/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ import { OptionsWithUri } from 'request';

import { BINARY_ENCODING, IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-core';

import {
IDataObject,
IHookFunctions,
IWebhookFunctions,
NodeApiError,
NodeOperationError,
} from 'n8n-workflow';
import { IDataObject, IHookFunctions, IWebhookFunctions, NodeApiError } from 'n8n-workflow';

export async function affinityApiRequest(
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/AgileCrm/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export async function agileCrmApiRequestUpdate(
endpoint?: string,
// tslint:disable-next-line:no-any
body: any = {},
query: IDataObject = {},
_query: IDataObject = {},
uri?: string,
// tslint:disable-next-line:no-any
): Promise<any> {
Expand Down
13 changes: 0 additions & 13 deletions packages/nodes-base/nodes/Airtable/Airtable.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,14 @@ import { IExecuteFunctions } from 'n8n-core';

import {
IDataObject,
ILoadOptionsFunctions,
INodeExecutionData,
INodeListSearchResult,
INodeType,
INodeTypeDescription,
NodeOperationError,
} from 'n8n-workflow';

import { apiRequest, apiRequestAllItems, downloadRecordAttachments } from './GenericFunctions';

interface AirtableBase {
id: string;
name: string;
}

interface AirtableTable {
id: string;
name: string;
description: string;
}

export class Airtable implements INodeType {
description: INodeTypeDescription = {
displayName: 'Airtable',
Expand Down
2 changes: 0 additions & 2 deletions packages/nodes-base/nodes/Airtable/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export async function apiRequest(
option: IDataObject = {},
// tslint:disable-next-line:no-any
): Promise<any> {
const credentials = await this.getCredentials('airtableApi');

query = query || {};

// For some reason for some endpoints the bearer auth does not work
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-base/nodes/Autopilot/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function autopilotApiRequest(
body: any = {},
query: IDataObject = {},
uri?: string,
option: IDataObject = {},
_option: IDataObject = {},
// tslint:disable-next-line:no-any
): Promise<any> {
const credentials = (await this.getCredentials('autopilotApi')) as IDataObject;
Expand Down
5 changes: 2 additions & 3 deletions packages/nodes-base/nodes/Aws/AwsLambda.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
INodeTypeDescription,
JsonObject,
NodeApiError,
NodeOperationError,
} from 'n8n-workflow';

import { awsApiRequestREST } from './GenericFunctions';
Expand Down Expand Up @@ -191,10 +190,10 @@ export class AwsLambda implements INodeType {
);

if (responseData !== null && responseData?.errorMessage !== undefined) {
let errorMessage = responseData.errorMessage;
let _errorMessage = responseData.errorMessage;

if (responseData.stackTrace) {
errorMessage += `\n\nStack trace:\n${responseData.stackTrace}`;
_errorMessage += `\n\nStack trace:\n${responseData.stackTrace}`;
}

throw new NodeApiError(this.getNode(), responseData);
Expand Down
2 changes: 0 additions & 2 deletions packages/nodes-base/nodes/Aws/AwsSns.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {
INodePropertyOptions,
INodeType,
INodeTypeDescription,
NodeApiError,
NodeOperationError,
} from 'n8n-workflow';

import { awsApiRequestSOAP } from './GenericFunctions';
Expand Down
8 changes: 1 addition & 7 deletions packages/nodes-base/nodes/Aws/Comprehend/GenericFunctions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import { URL } from 'url';

import { Request, sign } from 'aws4';

import { OptionsWithUri } from 'request';

import { parseString } from 'xml2js';

import {
Expand All @@ -13,7 +7,7 @@ import {
IWebhookFunctions,
} from 'n8n-core';

import { ICredentialDataDecryptedObject, IHttpRequestOptions, NodeApiError, NodeOperationError } from 'n8n-workflow';
import { IHttpRequestOptions, NodeApiError } from 'n8n-workflow';

export async function awsApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
Expand Down
8 changes: 1 addition & 7 deletions packages/nodes-base/nodes/Aws/DynamoDB/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ import {
IWebhookFunctions,
} from 'n8n-core';

import {
deepCopy,
ICredentialDataDecryptedObject,
IDataObject,
IHttpRequestOptions,
INodeExecutionData,
} from 'n8n-workflow';
import { deepCopy, IDataObject, IHttpRequestOptions, INodeExecutionData } from 'n8n-workflow';

import { IRequestBody } from './types';

Expand Down
Loading