refactor: Impose import/order linting rule across nodes packages (no-changelog) (#12314)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-12-19 18:46:14 +01:00
committed by GitHub
parent 8c635993bd
commit bafac73eb5
1120 changed files with 2677 additions and 2827 deletions

View File

@@ -1,9 +1,9 @@
import type { INodeTypes } from 'n8n-workflow';
import nock from 'nock';
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
import type { WorkflowTestData } from '@test/nodes/types';
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
const queryMock = jest.fn(async function () {
return [{ success: true }];

View File

@@ -1,17 +1,16 @@
import mysql2 from 'mysql2/promise';
import type { IDataObject, INode } from 'n8n-workflow';
import mysql2 from 'mysql2/promise';
import * as deleteTable from '../../v2/actions/database/deleteTable.operation';
import { createMockExecuteFunction } from '@test/nodes/Helpers';
import * as deleteTable from '../../v2/actions/database/deleteTable.operation';
import * as executeQuery from '../../v2/actions/database/executeQuery.operation';
import * as insert from '../../v2/actions/database/insert.operation';
import * as select from '../../v2/actions/database/select.operation';
import * as update from '../../v2/actions/database/update.operation';
import * as upsert from '../../v2/actions/database/upsert.operation';
import type { Mysql2Pool, QueryRunner } from '../../v2/helpers/interfaces';
import { configureQueryRunner } from '../../v2/helpers/utils';
import { createMockExecuteFunction } from '@test/nodes/Helpers';
const mySqlMockNode: INode = {
id: '1',

View File

@@ -1,11 +1,12 @@
import type { IDataObject, INode } from 'n8n-workflow';
import mysql2 from 'mysql2/promise';
import { configureQueryRunner } from '../../v2/helpers/utils';
import type { Mysql2Pool, QueryRunner } from '../../v2/helpers/interfaces';
import { BATCH_MODE } from '../../v2/helpers/interfaces';
import type { IDataObject, INode } from 'n8n-workflow';
import { createMockExecuteFunction } from '@test/nodes/Helpers';
import type { Mysql2Pool, QueryRunner } from '../../v2/helpers/interfaces';
import { BATCH_MODE } from '../../v2/helpers/interfaces';
import { configureQueryRunner } from '../../v2/helpers/utils';
const mySqlMockNode: INode = {
id: '1',
name: 'MySQL node',

View File

@@ -1,6 +1,6 @@
import type { INode } from 'n8n-workflow';
import type { SortRule, WhereClause } from '../../v2/helpers/interfaces';
import type { SortRule, WhereClause } from '../../v2/helpers/interfaces';
import {
prepareQueryAndReplacements,
wrapData,

View File

@@ -1,10 +1,10 @@
import mysql2 from 'mysql2/promise';
import type {
ICredentialDataDecryptedObject,
IDataObject,
ILoadOptionsFunctions,
INodeListSearchResult,
} from 'n8n-workflow';
import mysql2 from 'mysql2/promise';
export async function createConnection(
credentials: ICredentialDataDecryptedObject,

View File

@@ -1,3 +1,4 @@
import type mysql2 from 'mysql2/promise';
import type {
ICredentialDataDecryptedObject,
ICredentialsDecrypted,
@@ -12,13 +13,11 @@ import type {
} from 'n8n-workflow';
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
import type mysql2 from 'mysql2/promise';
import { createConnection, searchTables } from './GenericFunctions';
import { oldVersionNotice } from '@utils/descriptions';
import { getResolvables } from '@utils/utilities';
import { createConnection, searchTables } from './GenericFunctions';
const versionDescription: INodeTypeDescription = {
displayName: 'MySQL',
name: 'mySql',

View File

@@ -6,11 +6,9 @@ import type {
INodeTypeDescription,
} from 'n8n-workflow';
import { listSearch, credentialTest, loadOptions } from './methods';
import { versionDescription } from './actions/versionDescription';
import { router } from './actions/router';
import { versionDescription } from './actions/versionDescription';
import { listSearch, credentialTest, loadOptions } from './methods';
export class MySqlV2 implements INodeType {
description: INodeTypeDescription;

View File

@@ -1,4 +1,5 @@
import type { INodeProperties } from 'n8n-workflow';
import { BATCH_MODE, SINGLE } from '../helpers/interfaces';
export const tableRLC: INodeProperties = {

View File

@@ -1,12 +1,12 @@
import type { INodeProperties } from 'n8n-workflow';
import { tableRLC } from '../common.descriptions';
import * as deleteTable from './deleteTable.operation';
import * as executeQuery from './executeQuery.operation';
import * as insert from './insert.operation';
import * as select from './select.operation';
import * as update from './update.operation';
import * as upsert from './upsert.operation';
import { tableRLC } from '../common.descriptions';
export { deleteTable, executeQuery, insert, select, update, upsert };

View File

@@ -6,21 +6,20 @@ import type {
} from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow';
import { updateDisplayOptions } from '@utils/utilities';
import type {
QueryRunner,
QueryValues,
QueryWithValues,
WhereClause,
} from '../../helpers/interfaces';
import { addWhereClauses, escapeSqlIdentifier } from '../../helpers/utils';
import {
optionsCollection,
selectRowsFixedCollection,
combineConditionsCollection,
} from '../common.descriptions';
import { updateDisplayOptions } from '@utils/utilities';
const properties: INodeProperties[] = [
{

View File

@@ -6,13 +6,12 @@ import type {
} from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow';
import type { QueryRunner, QueryWithValues } from '../../helpers/interfaces';
import { prepareQueryAndReplacements, replaceEmptyStringsByNulls } from '../../helpers/utils';
import { optionsCollection } from '../common.descriptions';
import { getResolvables, updateDisplayOptions } from '@utils/utilities';
import type { QueryRunner, QueryWithValues } from '../../helpers/interfaces';
import { prepareQueryAndReplacements, replaceEmptyStringsByNulls } from '../../helpers/utils';
import { optionsCollection } from '../common.descriptions';
const properties: INodeProperties[] = [
{
displayName: 'Query',

View File

@@ -5,19 +5,17 @@ import type {
INodeProperties,
} from 'n8n-workflow';
import { updateDisplayOptions } from '@utils/utilities';
import type {
QueryMode,
QueryRunner,
QueryValues,
QueryWithValues,
} from '../../helpers/interfaces';
import { AUTO_MAP, BATCH_MODE, DATA_MODE } from '../../helpers/interfaces';
import { escapeSqlIdentifier, replaceEmptyStringsByNulls } from '../../helpers/utils';
import { optionsCollection } from '../common.descriptions';
import { updateDisplayOptions } from '@utils/utilities';
const properties: INodeProperties[] = [
{

View File

@@ -5,6 +5,8 @@ import type {
INodeProperties,
} from 'n8n-workflow';
import { updateDisplayOptions } from '@utils/utilities';
import type {
QueryRunner,
QueryValues,
@@ -12,16 +14,13 @@ import type {
SortRule,
WhereClause,
} from '../../helpers/interfaces';
import { addSortRules, addWhereClauses, escapeSqlIdentifier } from '../../helpers/utils';
import {
optionsCollection,
sortFixedCollection,
selectRowsFixedCollection,
combineConditionsCollection,
} from '../common.descriptions';
import { updateDisplayOptions } from '@utils/utilities';
const properties: INodeProperties[] = [
{

View File

@@ -5,13 +5,12 @@ import type {
INodeProperties,
} from 'n8n-workflow';
import { updateDisplayOptions } from '@utils/utilities';
import type { QueryRunner, QueryValues, QueryWithValues } from '../../helpers/interfaces';
import { AUTO_MAP, DATA_MODE } from '../../helpers/interfaces';
import { escapeSqlIdentifier, replaceEmptyStringsByNulls } from '../../helpers/utils';
import { optionsCollection } from '../common.descriptions';
import { updateDisplayOptions } from '@utils/utilities';
const properties: INodeProperties[] = [
{

View File

@@ -5,13 +5,12 @@ import type {
INodeProperties,
} from 'n8n-workflow';
import { updateDisplayOptions } from '@utils/utilities';
import type { QueryRunner, QueryValues, QueryWithValues } from '../../helpers/interfaces';
import { AUTO_MAP, DATA_MODE } from '../../helpers/interfaces';
import { escapeSqlIdentifier, replaceEmptyStringsByNulls } from '../../helpers/utils';
import { optionsCollection } from '../common.descriptions';
import { updateDisplayOptions } from '@utils/utilities';
const properties: INodeProperties[] = [
{

View File

@@ -1,11 +1,11 @@
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow';
import { createPool } from '../transport';
import type { MysqlNodeCredentials, QueryRunner } from '../helpers/interfaces';
import { configureQueryRunner } from '../helpers/utils';
import * as database from './database/Database.resource';
import type { MySqlType } from './node.type';
import type { MysqlNodeCredentials, QueryRunner } from '../helpers/interfaces';
import { configureQueryRunner } from '../helpers/utils';
import { createPool } from '../transport';
export async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
let returnData: INodeExecutionData[] = [];

View File

@@ -6,10 +6,8 @@ import type {
IPairedItemData,
NodeExecutionWithMetadata,
} from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow';
import { generatePairedItemData } from '../../../../utils/utilities';
import type {
Mysql2Pool,
QueryMode,
@@ -18,8 +16,8 @@ import type {
SortRule,
WhereClause,
} from './interfaces';
import { BATCH_MODE } from './interfaces';
import { generatePairedItemData } from '../../../../utils/utilities';
export function escapeSqlIdentifier(identifier: string): string {
const parts = identifier.match(/(`[^`]*`|[^.`]+)/g) ?? [];

View File

@@ -4,8 +4,8 @@ import type {
INodeCredentialTestResult,
} from 'n8n-workflow';
import { createPool } from '../transport';
import type { MysqlNodeCredentials } from '../helpers/interfaces';
import { createPool } from '../transport';
export async function mysqlConnectionTest(
this: ICredentialTestFunctions,

View File

@@ -1,6 +1,7 @@
import type { IDataObject, ILoadOptionsFunctions, INodeListSearchResult } from 'n8n-workflow';
import { createPool } from '../transport';
import type { MysqlNodeCredentials } from '../helpers/interfaces';
import { createPool } from '../transport';
export async function searchTables(this: ILoadOptionsFunctions): Promise<INodeListSearchResult> {
const credentials = await this.getCredentials<MysqlNodeCredentials>('mySql');

View File

@@ -1,7 +1,8 @@
import type { IDataObject, ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
import { createPool } from '../transport';
import { escapeSqlIdentifier } from '../helpers/utils';
import type { MysqlNodeCredentials } from '../helpers/interfaces';
import { escapeSqlIdentifier } from '../helpers/utils';
import { createPool } from '../transport';
export async function getColumns(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const credentials = await this.getCredentials<MysqlNodeCredentials>('mySql');

View File

@@ -1,4 +1,3 @@
import { createServer, type AddressInfo } from 'node:net';
import mysql2 from 'mysql2/promise';
import type {
ICredentialTestFunctions,
@@ -6,10 +5,12 @@ import type {
IExecuteFunctions,
ILoadOptionsFunctions,
} from 'n8n-workflow';
import { createServer, type AddressInfo } from 'node:net';
import { LOCALHOST } from '@utils/constants';
import { formatPrivateKey } from '@utils/utilities';
import type { Mysql2Pool, MysqlNodeCredentials } from '../helpers/interfaces';
import { formatPrivateKey } from '@utils/utilities';
import { LOCALHOST } from '@utils/constants';
export async function createPool(
this: IExecuteFunctions | ICredentialTestFunctions | ILoadOptionsFunctions,