Skip to content

Commit cfc8b59

Browse files
committed
Addresing n8n review
1 parent 2a0eab8 commit cfc8b59

File tree

7 files changed

+513
-1201
lines changed

7 files changed

+513
-1201
lines changed

.eslintrc.js

Lines changed: 98 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,112 @@ module.exports = {
3434
plugins: ['eslint-plugin-n8n-nodes-base'],
3535
extends: ['plugin:n8n-nodes-base/credentials'],
3636
rules: {
37-
'n8n-nodes-base/cred-class-field-documentation-url-missing': 'off',
37+
'n8n-nodes-base/cred-class-field-authenticate-type-assertion': 'error',
38+
'n8n-nodes-base/cred-class-field-display-name-missing-oauth2': 'error',
39+
'n8n-nodes-base/cred-class-field-display-name-miscased': 'error',
40+
'n8n-nodes-base/cred-class-field-documentation-url-missing': 'error',
3841
'n8n-nodes-base/cred-class-field-documentation-url-miscased': 'off',
42+
'n8n-nodes-base/cred-class-field-name-missing-oauth2': 'error',
43+
'n8n-nodes-base/cred-class-field-name-unsuffixed': 'error',
44+
'n8n-nodes-base/cred-class-field-name-uppercase-first-char': 'error',
45+
'n8n-nodes-base/cred-class-field-properties-assertion': 'error',
46+
'n8n-nodes-base/cred-class-field-type-options-password-missing': 'error',
47+
'n8n-nodes-base/cred-class-name-missing-oauth2-suffix': 'error',
48+
'n8n-nodes-base/cred-class-name-unsuffixed': 'error',
49+
'n8n-nodes-base/cred-filename-against-convention': 'error',
3950
},
4051
},
4152
{
4253
files: ['./nodes/**/*.ts'],
4354
plugins: ['eslint-plugin-n8n-nodes-base'],
4455
extends: ['plugin:n8n-nodes-base/nodes'],
4556
rules: {
46-
'n8n-nodes-base/node-execute-block-missing-continue-on-fail': 'off',
47-
'n8n-nodes-base/node-resource-description-filename-against-convention': 'off',
48-
'n8n-nodes-base/node-param-fixed-collection-type-unsorted-items': 'off',
57+
'n8n-nodes-base/node-class-description-credentials-name-unsuffixed': 'error',
58+
'n8n-nodes-base/node-class-description-display-name-unsuffixed-trigger-node': 'error',
59+
'n8n-nodes-base/node-class-description-empty-string': 'error',
60+
'n8n-nodes-base/node-class-description-icon-not-svg': 'error',
61+
'n8n-nodes-base/node-class-description-inputs-wrong-regular-node': 'off',
62+
'n8n-nodes-base/node-class-description-inputs-wrong-trigger-node': 'error',
63+
'n8n-nodes-base/node-class-description-missing-subtitle': 'error',
64+
'n8n-nodes-base/node-class-description-non-core-color-present': 'error',
65+
'n8n-nodes-base/node-class-description-name-miscased': 'error',
66+
'n8n-nodes-base/node-class-description-name-unsuffixed-trigger-node': 'error',
67+
'n8n-nodes-base/node-class-description-outputs-wrong': 'off',
68+
'n8n-nodes-base/node-dirname-against-convention': 'error',
69+
'n8n-nodes-base/node-execute-block-double-assertion-for-items': 'error',
70+
'n8n-nodes-base/node-execute-block-wrong-error-thrown': 'error',
71+
'n8n-nodes-base/node-filename-against-convention': 'error',
72+
'n8n-nodes-base/node-param-array-type-assertion': 'error',
73+
'n8n-nodes-base/node-param-color-type-unused': 'error',
74+
'n8n-nodes-base/node-param-default-missing': 'error',
75+
'n8n-nodes-base/node-param-default-wrong-for-boolean': 'error',
76+
'n8n-nodes-base/node-param-default-wrong-for-collection': 'error',
77+
'n8n-nodes-base/node-param-default-wrong-for-fixed-collection': 'error',
78+
'n8n-nodes-base/node-param-default-wrong-for-fixed-collection': 'error',
79+
'n8n-nodes-base/node-param-default-wrong-for-multi-options': 'error',
80+
'n8n-nodes-base/node-param-default-wrong-for-number': 'error',
81+
'n8n-nodes-base/node-param-default-wrong-for-simplify': 'error',
82+
'n8n-nodes-base/node-param-default-wrong-for-string': 'error',
83+
'n8n-nodes-base/node-param-description-boolean-without-whether': 'error',
84+
'n8n-nodes-base/node-param-description-comma-separated-hyphen': 'error',
85+
'n8n-nodes-base/node-param-description-empty-string': 'error',
86+
'n8n-nodes-base/node-param-description-excess-final-period': 'error',
87+
'n8n-nodes-base/node-param-description-excess-inner-whitespace': 'error',
88+
'n8n-nodes-base/node-param-description-identical-to-display-name': 'error',
89+
'n8n-nodes-base/node-param-description-line-break-html-tag': 'error',
90+
'n8n-nodes-base/node-param-description-lowercase-first-char': 'error',
91+
'n8n-nodes-base/node-param-description-miscased-id': 'error',
92+
'n8n-nodes-base/node-param-description-miscased-json': 'error',
93+
'n8n-nodes-base/node-param-description-miscased-url': 'error',
94+
'n8n-nodes-base/node-param-description-missing-final-period': 'error',
95+
'n8n-nodes-base/node-param-description-missing-for-ignore-ssl-issues': 'error',
96+
'n8n-nodes-base/node-param-description-missing-for-return-all': 'error',
97+
'n8n-nodes-base/node-param-description-missing-for-simplify': 'error',
98+
'n8n-nodes-base/node-param-description-missing-from-dynamic-multi-options': 'error',
99+
'n8n-nodes-base/node-param-description-missing-from-dynamic-options': 'error',
100+
'n8n-nodes-base/node-param-description-missing-from-limit': 'error',
101+
'n8n-nodes-base/node-param-description-unencoded-angle-brackets': 'error',
102+
'n8n-nodes-base/node-param-description-unneeded-backticks': 'error',
103+
'n8n-nodes-base/node-param-description-untrimmed': 'error',
104+
'n8n-nodes-base/node-param-description-url-missing-protocol': 'error',
105+
'n8n-nodes-base/node-param-description-weak': 'error',
106+
'n8n-nodes-base/node-param-description-wrong-for-dynamic-multi-options': 'error',
107+
'n8n-nodes-base/node-param-description-wrong-for-dynamic-options': 'error',
108+
'n8n-nodes-base/node-param-description-wrong-for-ignore-ssl-issues': 'error',
109+
'n8n-nodes-base/node-param-description-wrong-for-limit': 'error',
110+
'n8n-nodes-base/node-param-description-wrong-for-return-all': 'error',
111+
'n8n-nodes-base/node-param-description-wrong-for-simplify': 'error',
112+
'n8n-nodes-base/node-param-description-wrong-for-upsert': 'error',
113+
'n8n-nodes-base/node-param-display-name-excess-inner-whitespace': 'error',
114+
'n8n-nodes-base/node-param-display-name-miscased-id': 'error',
115+
'n8n-nodes-base/node-param-display-name-miscased': 'error',
116+
'n8n-nodes-base/node-param-display-name-not-first-position': 'error',
117+
'n8n-nodes-base/node-param-display-name-untrimmed': 'error',
118+
'n8n-nodes-base/node-param-display-name-wrong-for-dynamic-multi-options': 'error',
119+
'n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options': 'error',
120+
'n8n-nodes-base/node-param-display-name-wrong-for-simplify': 'error',
121+
'n8n-nodes-base/node-param-display-name-wrong-for-update-fields': 'error',
122+
'n8n-nodes-base/node-param-min-value-wrong-for-limit': 'error',
123+
'n8n-nodes-base/node-param-multi-options-type-unsorted-items': 'error',
124+
'n8n-nodes-base/node-param-name-untrimmed': 'error',
125+
'n8n-nodes-base/node-param-operation-option-action-wrong-for-get-many': 'error',
126+
'n8n-nodes-base/node-param-operation-option-description-wrong-for-get-many': 'error',
127+
'n8n-nodes-base/node-param-operation-option-without-action': 'error',
128+
'n8n-nodes-base/node-param-operation-without-no-data-expression': 'error',
129+
'n8n-nodes-base/node-param-option-description-identical-to-name': 'error',
130+
'n8n-nodes-base/node-param-option-name-containing-star': 'error',
131+
'n8n-nodes-base/node-param-option-name-duplicate': 'error',
132+
'n8n-nodes-base/node-param-option-name-wrong-for-get-many': 'error',
133+
'n8n-nodes-base/node-param-option-name-wrong-for-upsert': 'error',
134+
'n8n-nodes-base/node-param-option-value-duplicate': 'error',
135+
'n8n-nodes-base/node-param-options-type-unsorted-items': 'error',
136+
'n8n-nodes-base/node-param-placeholder-miscased-id': 'error',
137+
'n8n-nodes-base/node-param-placeholder-missing-email': 'error',
138+
'n8n-nodes-base/node-param-required-false': 'error',
139+
'n8n-nodes-base/node-param-resource-with-plural-option': 'error',
140+
'n8n-nodes-base/node-param-resource-without-no-data-expression': 'error',
141+
'n8n-nodes-base/node-param-type-options-missing-from-limit': 'error',
142+
'n8n-nodes-base/node-param-type-options-password-missing': 'error',
49143
},
50144
},
51145
],

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ The node returns the raw JSON received from SearchApi.io. See the [official docs
109109

110110
## Contributing
111111

112-
1. Run `pnpm build && pnpm link` on the project root
113-
2. Run `pnpm link @searchapi/n8n-nodes-searchapi`
112+
1. Run build with `pnpm build`
113+
2. Run `npm link` on the project root
114+
3. Run `npm link @searchapi/n8n-nodes-searchapi` on `$HOME/.n8n/custom`
114115

115-
After that build the node on each change and it should be reflected in n8n local interface.
116+
After that build the node on each change and it should be reflected in n8n local interface. Note: You can see we are using pnpm to build, and npm to test. With asdf this seems to be the best approach.

nodes/SearchApi/SearchApi.node.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
1+
import { INodeType, INodeTypeDescription, NodeConnectionType } from 'n8n-workflow';
22
import { google } from './engines/google';
33
import { google_images } from './engines/google_images';
44
import { google_maps } from './engines/google_maps';
55
import { google_shopping } from './engines/google_shopping';
66

7+
78
export class SearchApi implements INodeType {
89
description: INodeTypeDescription = {
910
displayName: 'SearchApi',
@@ -15,14 +16,12 @@ export class SearchApi implements INodeType {
1516
'Access real-time search results from Google, Google Images, Google Maps, Google Shopping and more. Use this when you need current, up-to-date information, product searches, location data, or visual content that may not be available in your training data.',
1617
subtitle: '={{ $parameter["engine"] }}',
1718
defaults: { name: 'SearchApi' },
18-
// @ts-ignore
19-
inputs: ['main'],
20-
// @ts-ignore
21-
outputs: ['main'],
19+
inputs: [NodeConnectionType.Main],
20+
outputs: [NodeConnectionType.Main],
2221
credentials: [{ name: 'searchApi', required: true }],
2322
usableAsTool: true,
2423
requestDefaults: {
25-
baseURL: 'https://www.searchapi.io/api/v1',
24+
baseURL: 'https://www.searchapi.io/api/v1',
2625
method: 'GET',
2726
url: '/search',
2827
headers: { Accept: 'application/json' },
@@ -51,7 +50,7 @@ export class SearchApi implements INodeType {
5150
google_images.resource,
5251
google_maps.resource,
5352
google_shopping.resource,
54-
53+
5554
],
5655
default: google.resource.value,
5756
},

0 commit comments

Comments
 (0)