Skip to content

Commit fb7f935

Browse files
authored
Merge branch 'main' into kloet/generate-custombg-unit-test
2 parents 0ddb09b + 3047b08 commit fb7f935

12 files changed

Lines changed: 213 additions & 144 deletions

File tree

.github/workflows/main.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,4 @@ jobs:
9494
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9595
EXTERNAL_ADAPTER_GENERATOR_NO_INTERACTIVE: 'true'
9696
EXTERNAL_ADAPTER_GENERATOR_STANDALONE: 'true'
97+
EXTERNAL_ADAPTER_GENERATOR_USE_LOCAL_FRAMEWORK_VERSION: 'true'

docs/reference-tables/ea-settings.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
| EA_MODE | enum | reader-writer | Port this EA will listen for REST requests on (if mode is set to "reader" or "reader-writer") | | |
3737
| EA_PORT | number | 8080 | Port through which the EA will listen for REST requests (if mode is set to "reader" or "reader-writer") | - Value must be an integer<br> - Value must be above the minimum<br> - Value must be below the maximum | 1 | 65535 |
3838
| EXPERIMENTAL_METRICS_ENABLED | boolean | true | Flag to specify whether or not to collect metrics. Used as fallback for METRICS_ENABLED | | |
39+
| FEED_ID_JSON | boolean | false | Flag to specify whether make feed id always a JSON string or not | | |
3940
| LOG_LEVEL | string | info | Minimum level required for logs to be output | | |
4041
| MAX_COMMON_KEY_SIZE | number | 300 | Maximum amount of characters that the common part of the cache key or feed ID can have | - Value must be an integer<br> - Value must be above the minimum<br> - Value must be below the maximum | 150 | 500 |
4142
| MAX_HTTP_REQUEST_QUEUE_LENGTH | number | 200 | The maximum amount of queued requests for Http transports before new ones push oldest ones out of the queue | - Value must be an integer<br> - Value must be above the minimum<br> - Value must be below the maximum | 1 | 2000 |

eslint.config.mjs

Lines changed: 153 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,168 @@
1-
import typescriptEslint from "@typescript-eslint/eslint-plugin";
2-
import tsdoc from "eslint-plugin-tsdoc";
3-
import tsParser from "@typescript-eslint/parser";
4-
import path from "node:path";
5-
import { fileURLToPath } from "node:url";
6-
import js from "@eslint/js";
7-
import { FlatCompat } from "@eslint/eslintrc";
8-
9-
const __filename = fileURLToPath(import.meta.url);
10-
const __dirname = path.dirname(__filename);
1+
import typescriptEslint from '@typescript-eslint/eslint-plugin'
2+
import tsdoc from 'eslint-plugin-tsdoc'
3+
import tsParser from '@typescript-eslint/parser'
4+
import path from 'node:path'
5+
import { fileURLToPath } from 'node:url'
6+
import js from '@eslint/js'
7+
import { FlatCompat } from '@eslint/eslintrc'
8+
9+
const __filename = fileURLToPath(import.meta.url)
10+
const __dirname = path.dirname(__filename)
1111
const compat = new FlatCompat({
12-
baseDirectory: __dirname,
13-
recommendedConfig: js.configs.recommended,
14-
allConfig: js.configs.all
15-
});
12+
baseDirectory: __dirname,
13+
recommendedConfig: js.configs.recommended,
14+
allConfig: js.configs.all,
15+
})
1616

17-
export default [{
17+
export default [
18+
{
1819
ignores: [
19-
"**/node_modules",
20-
"**/dist",
21-
"**/coverage",
22-
"scripts/generator-adapter",
23-
"**/.yarn",
24-
"**/.vscode",
25-
"**/srcdocs",
20+
'**/node_modules',
21+
'**/dist',
22+
'**/coverage',
23+
'scripts/generator-adapter',
24+
'**/.yarn',
25+
'**/.vscode',
26+
'**/srcdocs',
2627
],
27-
}, ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"), {
28+
},
29+
...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'),
30+
{
2831
plugins: {
29-
"@typescript-eslint": typescriptEslint,
30-
tsdoc,
32+
'@typescript-eslint': typescriptEslint,
33+
tsdoc,
3134
},
3235

3336
languageOptions: {
34-
parser: tsParser,
37+
parser: tsParser,
3538
},
3639

3740
rules: {
38-
"tsdoc/syntax": "warn",
39-
40-
"array-callback-return": ["error", {
41-
allowImplicit: false,
42-
checkForEach: true,
43-
}],
44-
45-
"no-constant-binary-expression": "error",
46-
"no-constructor-return": "error",
47-
"no-duplicate-imports": "error",
48-
"no-promise-executor-return": "error",
49-
"no-self-compare": "error",
50-
"no-template-curly-in-string": "error",
51-
"no-unmodified-loop-condition": "error",
52-
"no-unreachable-loop": "error",
53-
"no-unused-private-class-members": "error",
54-
"require-atomic-updates": "error",
55-
56-
"@typescript-eslint/no-unused-vars": ["warn", {
57-
argsIgnorePattern: "^_",
58-
caughtErrorsIgnorePattern: "^_"
59-
}],
60-
61-
"capitalized-comments": ["error", "always", {
62-
ignoreConsecutiveComments: true,
63-
}],
64-
65-
complexity: ["error", 25],
66-
curly: "error",
67-
"default-case-last": "error",
68-
"default-param-last": "error",
69-
eqeqeq: ["error", "smart"],
70-
"func-names": "error",
71-
72-
"func-style": ["error", "declaration", {
73-
allowArrowFunctions: true,
74-
}],
75-
76-
"grouped-accessor-pairs": ["error", "getBeforeSet"],
77-
"max-depth": ["error", 4],
78-
"max-nested-callbacks": ["error", 3],
79-
"max-params": ["error", 4],
80-
81-
"new-cap": ["error", {
82-
newIsCapExceptions: ["ctor"],
83-
}],
84-
85-
"no-caller": "error",
86-
87-
"no-confusing-arrow": ["error", {
88-
allowParens: true,
89-
}],
90-
91-
"no-console": ["warn"],
92-
"no-div-regex": "error",
93-
"no-eval": "error",
94-
"no-extend-native": "error",
95-
"no-extra-bind": "error",
96-
"no-extra-label": "error",
97-
"no-extra-semi": "error",
98-
"no-floating-decimal": "error",
99-
"no-implied-eval": "error",
100-
"no-invalid-this": "error",
101-
"no-labels": "error",
102-
"no-lonely-if": "error",
103-
"no-multi-assign": "error",
104-
"no-multi-str": "error",
105-
"no-nested-ternary": "error",
106-
"no-new": "error",
107-
"no-new-func": "error",
108-
"no-new-object": "error",
109-
"no-new-wrappers": "error",
110-
"no-param-reassign": "error",
111-
"no-proto": "error",
112-
"no-return-assign": "error",
113-
"no-return-await": "error",
114-
"no-sequences": "error",
115-
"no-shadow": "off",
116-
"@typescript-eslint/no-shadow": "error",
117-
"no-unneeded-ternary": "error",
118-
"no-useless-call": "error",
119-
"no-useless-computed-key": "error",
120-
"no-useless-concat": "error",
121-
"no-useless-rename": "error",
122-
"no-var": "error",
123-
"operator-assignment": ["error", "always"],
124-
"prefer-arrow-callback": "error",
125-
"prefer-const": "error",
126-
"prefer-exponentiation-operator": "error",
127-
"prefer-object-spread": "error",
128-
"prefer-promise-reject-errors": "error",
129-
"prefer-regex-literals": "error",
130-
"prefer-rest-params": "error",
131-
"prefer-spread": "error",
132-
"prefer-template": "error",
133-
"spaced-comment": ["error", "always"],
134-
"symbol-description": "error",
135-
yoda: "error",
41+
'tsdoc/syntax': 'warn',
42+
43+
'array-callback-return': [
44+
'error',
45+
{
46+
allowImplicit: false,
47+
checkForEach: true,
48+
},
49+
],
50+
51+
'no-constant-binary-expression': 'error',
52+
'no-constructor-return': 'error',
53+
'no-duplicate-imports': 'error',
54+
'no-promise-executor-return': 'error',
55+
'no-self-compare': 'error',
56+
'no-template-curly-in-string': 'error',
57+
'no-unmodified-loop-condition': 'error',
58+
'no-unreachable-loop': 'error',
59+
'no-unused-private-class-members': 'error',
60+
'require-atomic-updates': 'error',
61+
62+
'@typescript-eslint/no-unused-vars': [
63+
'warn',
64+
{
65+
argsIgnorePattern: '^_',
66+
caughtErrorsIgnorePattern: '^_',
67+
},
68+
],
69+
70+
'capitalized-comments': [
71+
'error',
72+
'always',
73+
{
74+
ignoreConsecutiveComments: true,
75+
},
76+
],
77+
78+
complexity: ['error', 25],
79+
curly: 'error',
80+
'default-case-last': 'error',
81+
'default-param-last': 'error',
82+
eqeqeq: ['error', 'smart'],
83+
'func-names': 'error',
84+
85+
'func-style': [
86+
'error',
87+
'declaration',
88+
{
89+
allowArrowFunctions: true,
90+
},
91+
],
92+
93+
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
94+
'max-depth': ['error', 4],
95+
'max-nested-callbacks': ['error', 3],
96+
'max-params': ['error', 4],
97+
98+
'new-cap': [
99+
'error',
100+
{
101+
newIsCapExceptions: ['ctor'],
102+
},
103+
],
104+
105+
'no-caller': 'error',
106+
107+
'no-confusing-arrow': [
108+
'error',
109+
{
110+
allowParens: true,
111+
},
112+
],
113+
114+
'no-console': ['warn'],
115+
'no-div-regex': 'error',
116+
'no-eval': 'error',
117+
'no-extend-native': 'error',
118+
'no-extra-bind': 'error',
119+
'no-extra-label': 'error',
120+
'no-extra-semi': 'error',
121+
'no-floating-decimal': 'error',
122+
'no-implied-eval': 'error',
123+
'no-invalid-this': 'error',
124+
'no-labels': 'error',
125+
'no-lonely-if': 'error',
126+
'no-multi-assign': 'error',
127+
'no-multi-str': 'error',
128+
'no-nested-ternary': 'error',
129+
'no-new': 'error',
130+
'no-new-func': 'error',
131+
'no-new-object': 'error',
132+
'no-new-wrappers': 'error',
133+
'no-param-reassign': 'error',
134+
'no-proto': 'error',
135+
'no-return-assign': 'error',
136+
'no-return-await': 'error',
137+
'no-sequences': 'error',
138+
'no-shadow': 'off',
139+
'@typescript-eslint/no-shadow': 'error',
140+
'no-unneeded-ternary': 'error',
141+
'no-useless-call': 'error',
142+
'no-useless-computed-key': 'error',
143+
'no-useless-concat': 'error',
144+
'no-useless-rename': 'error',
145+
'no-var': 'error',
146+
'operator-assignment': ['error', 'always'],
147+
'prefer-arrow-callback': 'error',
148+
'prefer-const': 'error',
149+
'prefer-exponentiation-operator': 'error',
150+
'prefer-object-spread': 'error',
151+
'prefer-promise-reject-errors': 'error',
152+
'prefer-regex-literals': 'error',
153+
'prefer-rest-params': 'error',
154+
'prefer-spread': 'error',
155+
'prefer-template': 'error',
156+
'spaced-comment': ['error', 'always'],
157+
'symbol-description': 'error',
158+
yoda: 'error',
136159
},
137-
}, {
138-
files: ["test/**/*.ts"],
160+
},
161+
{
162+
files: ['test/**/*.ts'],
139163

140164
rules: {
141-
"require-atomic-updates": "off",
165+
'require-atomic-updates': 'off',
142166
},
143-
}];
167+
},
168+
]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chainlink/external-adapter-framework",
3-
"version": "2.15.0",
3+
"version": "2.16.0",
44
"main": "dist/index.js",
55
"license": "MIT",
66
"repository": "git://github.com/smartcontractkit/ea-framework-js.git",

scripts/generator-adapter/generators/app/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default class extends Generator.default {
5656
// with the same content in the same directory and extend from it. Also, new packages and config files (jest, babel) will be added
5757
// to be able to run the tests
5858
standalone = process.env.EXTERNAL_ADAPTER_GENERATOR_STANDALONE === 'true'
59+
useLocalFrameworkVersion = process.env.EXTERNAL_ADAPTER_GENERATOR_USE_LOCAL_FRAMEWORK_VERSION === 'true'
5960

6061
constructor(args, opts) {
6162
super(args, opts, { customInstallTask: true })
@@ -96,11 +97,12 @@ export default class extends Generator.default {
9697
const endpointNames = Object.values(endpoints).map(e => e.normalizedEndpointName).join(', ')
9798

9899
const includeComments = await this._promptConfirmation(adapterName, endpointNames)
100+
const frameworkVersion = this.useLocalFrameworkVersion
101+
? 'file:../../dist/src'
102+
: (await require('../../../package.json')).version
99103

100104
this.props = {
101-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
102-
// @ts-ignore
103-
frameworkVersion: (await require('../../../package.json')).version,
105+
frameworkVersion,
104106
adapterName,
105107
endpoints,
106108
endpointNames,

0 commit comments

Comments
 (0)