👕 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

@ -18,7 +18,7 @@ import * as clientOAuth2 from 'client-oauth2';
import * as clientOAuth1 from 'oauth-1.0a';
import { RequestOptions } from 'oauth-1.0a';
import * as csrf from 'csrf';
import * as requestPromise from 'request-promise-native';
import * as requestPromise from 'request-promise-native';
import { createHmac } from 'crypto';
import {
@ -120,7 +120,7 @@ class App {
restEndpoint: string;
protocol: string;
sslKey: string;
sslKey: string;
sslCert: string;
presetCredentialsLoaded: boolean;
@ -143,7 +143,7 @@ class App {
this.activeExecutionsInstance = ActiveExecutions.getInstance();
this.protocol = config.get('protocol');
this.sslKey = config.get('ssl_key');
this.sslKey = config.get('ssl_key');
this.sslCert = config.get('ssl_cert');
this.externalHooks = ExternalHooks();
@ -204,7 +204,7 @@ class App {
}
// Check for and validate JWT if configured
const jwtAuthActive = config.get('security.jwtAuth.active') as boolean;
const jwtAuthActive = config.get('security.jwtAuth.active') as boolean;
if (jwtAuthActive === true) {
const jwtAuthHeader = await GenericHelpers.getConfigValue('security.jwtAuth.jwtHeader') as string;
if (jwtAuthHeader === '') {
@ -282,7 +282,7 @@ class App {
normalize: true, // Trim whitespace inside text nodes
normalizeTags: true, // Transform tags to lowercase
explicitArray: false, // Only put properties in array if length > 1
} }));
} }));
this.app.use(bodyParser.text({
limit: '16mb', verify: (req, res, buf) => {
@ -981,7 +981,7 @@ class App {
const callback = `${WebhookHelpers.getWebhookBaseUrl()}${this.restEndpoint}/oauth1-credential/callback?cid=${req.query.id}`;
const options: RequestOptions = {
const options: RequestOptions = {
method: 'POST',
url: (_.get(oauthCredentials, 'requestTokenUrl') as string),
data: {
@ -1049,7 +1049,7 @@ class App {
const decryptedDataOriginal = credentialsHelper.getDecrypted(result.name, result.type, true);
const oauthCredentials = credentialsHelper.applyDefaultsAndOverwrites(decryptedDataOriginal, result.type);
const options: OptionsWithUrl = {
const options: OptionsWithUrl = {
method: 'POST',
url: _.get(oauthCredentials, 'accessTokenUrl') as string,
qs: {

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 {