👕 Fix lint issue

This commit is contained in:
Jan Oberhauser
2020-07-14 13:59:37 +02:00
parent 93c37f3844
commit df3077b5d2
8 changed files with 27 additions and 27 deletions

View File

@@ -11,6 +11,7 @@
"start:default": "cd packages/cli/bin && ./n8n",
"start:windows": "cd packages/cli/bin && n8n",
"test": "lerna run test",
"tslint": "lerna exec npm run tslint",
"watch": "lerna run --parallel watch"
},
"devDependencies": {

View File

@@ -16,11 +16,11 @@ export async function googleApiRequest(
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
method: string,
resource: string,
body: any = {},
body: IDataObject = {},
qs: IDataObject = {},
uri?: string,
headers: IDataObject = {}
): Promise<any> {
): Promise<any> { // tslint:disable-line:no-any
const options: OptionsWithUri = {
headers: {
'Content-Type': 'application/json'
@@ -65,9 +65,9 @@ export async function googleApiRequestAllItems(
propertyName: string,
method: string,
endpoint: string,
body: any = {},
body: IDataObject = {},
query: IDataObject = {}
): Promise<any> {
): Promise<any> { // tslint:disable-line:no-any
const returnData: IDataObject[] = [];
let responseData;

View File

@@ -14,7 +14,7 @@ export function copyInputItem(
properties: string[],
): IDataObject {
// Prepare the data to insert and copy it to be returned
let newItem: IDataObject = {};
const newItem: IDataObject = {};
for (const property of properties) {
if (item.json[property] === undefined) {
newItem[property] = null;
@@ -70,14 +70,14 @@ export function createTableStruct(
export function executeQueryQueue(
tables: ITables,
buildQueryQueue: Function,
): Promise<any[]> {
): Promise<any[]> { // tslint:disable-line:no-any
return Promise.all(
Object.keys(tables).map(table => {
const columnsResults = Object.keys(tables[table]).map(columnString => {
return Promise.all(
buildQueryQueue({
table: table,
columnString: columnString,
table,
columnString,
items: tables[table][columnString],
}),
);
@@ -94,7 +94,7 @@ export function executeQueryQueue(
* @returns {string} (Val1, Val2, ...)
*/
export function extractValues(item: IDataObject): string {
return `(${Object.values(item as any)
return `(${Object.values(item as any) // tslint:disable-line:no-any
.map(val => (typeof val === 'string' ? `'${val}'` : val)) // maybe other types such as dates have to be handled as well
.join(',')})`;
}

View File

@@ -2,6 +2,6 @@ import { IDataObject } from 'n8n-workflow';
export interface ITables {
[key: string]: {
[key: string]: Array<IDataObject>;
[key: string]: IDataObject[];
};
}

View File

@@ -40,7 +40,7 @@ export function pgQuery(
pgp: pgPromise.IMain<{}, pg.IClient>,
db: pgPromise.IDatabase<{}, pg.IClient>,
input: INodeExecutionData[],
): Promise<Array<object>> {
): Promise<object[]> {
const queries: string[] = [];
for (let i = 0; i < input.length; i++) {
queries.push(getNodeParam('query', i) as string);
@@ -63,7 +63,7 @@ export async function pgInsert(
pgp: pgPromise.IMain<{}, pg.IClient>,
db: pgPromise.IDatabase<{}, pg.IClient>,
items: INodeExecutionData[],
): Promise<Array<IDataObject[]>> {
): Promise<IDataObject[][]> {
const table = getNodeParam('table', 0) as string;
const schema = getNodeParam('schema', 0) as string;
let returnFields = (getNodeParam('returnFields', 0) as string).split(',') as string[];
@@ -103,7 +103,7 @@ export async function pgUpdate(
pgp: pgPromise.IMain<{}, pg.IClient>,
db: pgPromise.IDatabase<{}, pg.IClient>,
items: INodeExecutionData[],
): Promise<Array<IDataObject>> {
): Promise<IDataObject[]> {
const table = getNodeParam('table', 0) as string;
const updateKey = getNodeParam('updateKey', 0) as string;
const columnString = getNodeParam('columns', 0) as string;

View File

@@ -70,10 +70,9 @@ export async function zoomApiRequestAllItems(
propertyName: string,
method: string,
endpoint: string,
body: any = {},
body: IDataObject = {},
query: IDataObject = {}
): Promise<any> {
// tslint:disable-line:no-any
): Promise<any> { // tslint:disable-line:no-any
const returnData: IDataObject[] = [];
let responseData;
query.page_number = 0;

View File

@@ -14,7 +14,7 @@
* chunk(['a', 'b', 'c', 'd'], 3)
* // => [['a', 'b', 'c'], ['d']]
*/
export function chunk(array: any[], size: number = 1) {
export function chunk(array: any[], size = 1) { // tslint:disable-line:no-any
const length = array == null ? 0 : array.length;
if (!length || size < 1) {
return [];
@@ -40,11 +40,11 @@ export function chunk(array: any[], size: number = 1) {
* // => ['a', 'b', 'c', 'd']
*
*/
export function flatten(nestedArray: any[][]) {
export function flatten(nestedArray: any[][]) { // tslint:disable-line:no-any
const result = [];
(function loop(array: any[]) {
for (var i = 0; i < array.length; i++) {
(function loop(array: any[]) { // tslint:disable-line:no-any
for (let i = 0; i < array.length; i++) {
if (Array.isArray(array[i])) {
loop(array[i]);
} else {