ci: Fix lint warnings in @n8n/chat and @n8n/nodes-langchain (no-changelog) (#7884)

Solve lint warnings shown on all PRs for `@n8n/chat` and
`@n8n/nodes-langchain`

Example: https://github.com/n8n-io/n8n/pull/7883/files
This commit is contained in:
Iván Ovejero 2023-11-30 13:22:27 +01:00 committed by GitHub
parent 627ddb91fb
commit b024cc52e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 23 deletions

View file

@ -9,6 +9,8 @@ module.exports = {
...sharedOptions(__dirname, 'frontend'),
rules: {
'n8n-local-rules/dangerously-use-html-string-missing': 'off',
// TODO: Remove these
'id-denylist': 'warn',
'import/extensions': 'warn',
@ -31,9 +33,7 @@ module.exports = {
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn',
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
@ -42,7 +42,6 @@ module.exports = {
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/restrict-plus-operands': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',
'@typescript-eslint/unbound-method': 'warn',
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
'@typescript-eslint/no-redundant-type-constituents': 'warn',

View file

@ -86,7 +86,7 @@ describe('createChat()', () => {
expect.objectContaining({
method: 'POST',
headers: {},
body: expect.stringMatching(/"action":"loadPreviousSession"/),
body: expect.stringContaining('"action":"loadPreviousSession"') as unknown,
mode: 'cors',
cache: 'no-cache',
}),
@ -160,7 +160,7 @@ describe('createChat()', () => {
expect.objectContaining({
method: 'POST',
headers: {},
body: expect.stringMatching(/"action":"sendMessage"/),
body: expect.stringMatching(/"action":"sendMessage"/) as unknown,
mode: 'cors',
cache: 'no-cache',
}),

View file

@ -192,13 +192,11 @@ export class LmOpenAi implements INodeType {
uri = `${options.baseURL}/models`;
}
const data = (
await this.helpers.requestWithAuthentication.call(this, 'openAiApi', {
method: 'GET',
uri,
json: true,
})
).data as Array<{ owned_by: string; id: string }>;
const { data } = (await this.helpers.requestWithAuthentication.call(this, 'openAiApi', {
method: 'GET',
uri,
json: true,
})) as { data: Array<{ owned_by: string; id: string }> };
for (const model of data) {
if (!model.owned_by?.startsWith('system')) continue;

View file

@ -1,4 +1,4 @@
import type { IDataObject, ILoadOptionsFunctions } from 'n8n-workflow';
import { ApplicationError, type IDataObject, type ILoadOptionsFunctions } from 'n8n-workflow';
import { Pinecone } from '@pinecone-database/pinecone';
export async function pineconeIndexSearch(this: ILoadOptionsFunctions) {
@ -24,16 +24,18 @@ export async function supabaseTableNameSearch(this: ILoadOptionsFunctions) {
const results = [];
const paths = (
await this.helpers.requestWithAuthentication.call(this, 'supabaseApi', {
headers: {
Prefer: 'return=representation',
},
method: 'GET',
uri: `${credentials.host}/rest/v1/`,
json: true,
})
).paths as IDataObject;
if (typeof credentials.host !== 'string') {
throw new ApplicationError('Expected Supabase credentials host to be a string');
}
const { paths } = (await this.helpers.requestWithAuthentication.call(this, 'supabaseApi', {
headers: {
Prefer: 'return=representation',
},
method: 'GET',
uri: `${credentials.host}/rest/v1/`,
json: true,
})) as { paths: IDataObject };
for (const path of Object.keys(paths)) {
//omit introspection path