@api3/commons 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +3 -3
  2. package/dist/blockchain-utilities/derivation.d.ts.map +1 -1
  3. package/dist/blockchain-utilities/derivation.js +3 -3
  4. package/dist/blockchain-utilities/derivation.js.map +1 -1
  5. package/dist/config-parsing/index.d.ts.map +1 -1
  6. package/dist/config-parsing/index.js +2 -2
  7. package/dist/config-parsing/index.js.map +1 -1
  8. package/dist/http/index.js +2 -2
  9. package/dist/http/index.js.map +1 -1
  10. package/dist/logger/async-storage.d.ts +0 -1
  11. package/dist/logger/async-storage.d.ts.map +1 -1
  12. package/dist/logger/index.d.ts.map +1 -1
  13. package/dist/node-index.d.ts.map +1 -1
  14. package/dist/node-index.js +0 -1
  15. package/dist/node-index.js.map +1 -1
  16. package/dist/processing/processing.d.ts.map +1 -1
  17. package/dist/processing/unsafe-evaluate.d.ts.map +1 -1
  18. package/dist/processing/unsafe-evaluate.js +1 -3
  19. package/dist/processing/unsafe-evaluate.js.map +1 -1
  20. package/dist/processing/vm-timers.d.ts +0 -5
  21. package/dist/processing/vm-timers.d.ts.map +1 -1
  22. package/package.json +11 -32
  23. package/src/logger/index.test.ts +0 -1
  24. package/src/node-index.ts +0 -1
  25. package/src/processing/unsafe-evaluate.ts +0 -1
  26. package/dist/eslint/internal.d.ts +0 -15
  27. package/dist/eslint/internal.d.ts.map +0 -1
  28. package/dist/eslint/internal.js +0 -24
  29. package/dist/eslint/internal.js.map +0 -1
  30. package/dist/eslint/jest.d.ts +0 -29
  31. package/dist/eslint/jest.d.ts.map +0 -1
  32. package/dist/eslint/jest.js +0 -38
  33. package/dist/eslint/jest.js.map +0 -1
  34. package/dist/eslint/next-js.d.ts +0 -27
  35. package/dist/eslint/next-js.d.ts.map +0 -1
  36. package/dist/eslint/next-js.js +0 -33
  37. package/dist/eslint/next-js.js.map +0 -1
  38. package/dist/eslint/react.d.ts +0 -90
  39. package/dist/eslint/react.d.ts.map +0 -1
  40. package/dist/eslint/react.js +0 -85
  41. package/dist/eslint/react.js.map +0 -1
  42. package/dist/eslint/universal.d.ts +0 -173
  43. package/dist/eslint/universal.d.ts.map +0 -1
  44. package/dist/eslint/universal.js +0 -203
  45. package/dist/eslint/universal.js.map +0 -1
  46. package/src/eslint/README.md +0 -87
  47. package/src/eslint/internal.js +0 -24
  48. package/src/eslint/jest.js +0 -36
  49. package/src/eslint/next-js.js +0 -31
  50. package/src/eslint/react.js +0 -88
  51. package/src/eslint/universal.js +0 -209
@@ -1,85 +0,0 @@
1
- "use strict";
2
- // eslint-disable-next-line @typescript-eslint/no-var-requires, lodash/import-scope
3
- const { merge } = require('lodash');
4
- // eslint-disable-next-line @typescript-eslint/no-var-requires
5
- const { universalRestrictedImportsConfig, universalImportOrderConfig } = require('./internal');
6
- module.exports = {
7
- parser: '@typescript-eslint/parser',
8
- parserOptions: {
9
- ecmaVersion: 2022, // Enable parsing of modern ECMAScript features.
10
- ecmaFeatures: {
11
- jsx: true, // Support JSX syntax.
12
- },
13
- sourceType: 'module', // Enable ES6 import/export syntax.
14
- },
15
- settings: {
16
- react: {
17
- version: 'detect', // Automatically detect the version of React.
18
- },
19
- },
20
- env: {
21
- node: true,
22
- browser: true,
23
- },
24
- extends: ['plugin:react/all', 'plugin:react-hooks/recommended'],
25
- plugins: ['react', '@typescript-eslint', 'import', 'lodash'],
26
- rules: {
27
- 'import/order': [
28
- 'error',
29
- merge({}, universalImportOrderConfig, {
30
- // Prioritize react imports.
31
- pathGroups: [
32
- {
33
- pattern: 'react',
34
- group: 'builtin',
35
- position: 'before',
36
- },
37
- ],
38
- }),
39
- ],
40
- /* Overrides for "react" plugin */
41
- 'react/destructuring-assignment': ['error', 'always', { destructureInSignature: 'ignore' }],
42
- 'react/forbid-component-props': ['error', { forbid: [] }],
43
- 'react/forbid-dom-props': ['error', { forbid: [] }],
44
- 'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never', propElementValues: 'always' }],
45
- 'react/jsx-curly-newline': 'off', // Conflicts with prettier.
46
- 'react/jsx-filename-extension': 'off', // We use .tsx extension.
47
- 'react/jsx-handler-names': 'off',
48
- 'react/jsx-indent': 'off', // Conflicts with prettier.
49
- 'react/jsx-indent-props': 'off', // Conflicts with prettier.
50
- 'react/jsx-max-depth': 'off', // Conflicts with prettier.
51
- 'react/jsx-max-props-per-line': 'off', // Conflicts with prettier.
52
- 'react/jsx-newline': 'off', // Conflicts with prettier.
53
- 'react/jsx-no-bind': 'off', // Conflicts with prettier.
54
- 'react/jsx-no-leaked-render': 'off',
55
- 'react/jsx-no-literals': 'off',
56
- 'react/jsx-one-expression-per-line': 'off', // Conflicts with prettier.
57
- 'react/jsx-props-no-spreading': 'off',
58
- 'react/jsx-sort-props': 'off',
59
- 'react/no-multi-comp': 'off',
60
- 'react/no-unescaped-entities': 'off',
61
- 'react/no-unused-prop-types': 'off',
62
- 'react/prefer-read-only-props': 'off',
63
- 'react/prop-types': 'off',
64
- 'react/react-in-jsx-scope': 'off',
65
- 'react/require-default-props': 'off',
66
- 'react/self-closing-comp': ['error', { component: true, html: true }],
67
- 'react/void-dom-elements-no-children': 'error',
68
- /* Overrides for "@typescript-eslint" plugin */
69
- '@typescript-eslint/no-restricted-imports': [
70
- 'error',
71
- merge({}, universalRestrictedImportsConfig, {
72
- paths: [
73
- {
74
- name: 'react',
75
- importNames: ['default'],
76
- message: 'Starting from React version 17, there is no need to globally import React. Use named imports for specific React APIs.',
77
- },
78
- ],
79
- }),
80
- ],
81
- /* Overrides for "lodash" plugin */
82
- 'lodash/import-scope': ['error', 'method'],
83
- },
84
- };
85
- //# sourceMappingURL=react.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/eslint/react.js"],"names":[],"mappings":";AAAA,mFAAmF;AACnF,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;A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AyB,EAAE,KAAK,EAAE,2BAA2B;QAC7D,8BAA8B,EAAE,KAAK,EAAE,yBAAyB;QAChE,yBAAyB,EAAE,KAAK;QAChC,kBAAkB,EAAE,KAAK,EAAE,2BAA2B;QACtD,wBAAwB,EAAE,KAAK,EAAE,2BAA2B;QAC5D,qBAAqB,EAAE,KAAK,EAAE,2BAA2B;QACzD,8BAA8B,EAAE,KAAK,EAAE,2BAA2B;QAClE,mBAAmB,EAAE,KAAK,EAAE,2BAA2B;QACvD,mBAAmB,EAAE,KAAK,EAAE,2BAA2B;QACvD,4BAA4B,EAAE,KAAK;QACnC,uBAAuB,EAAE,KAAK;QAC9B,mCAAmC,EAAE,KAAK,EAAE,2BAA2B;QACvE,8BAA8B,EAAE,KAAK;QACrC,sBAAsB,EAAE,KAAK;QAC7B,qBAAqB,EAAE,KAAK;QAC5B,6BAA6B,EAAE,KAAK;QACpC,4BAA4B,EAAE,KAAK;QACnC,8BAA8B,EAAE,KAAK;QACrC,kBAAkB,EAAE,KAAK;QACzB,0BAA0B,EAAE,KAAK;QACjC,6BAA6B,EAAE,KAAK;QACpC,yBAAyB,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACrE,qCAAqC,EAAE,OAAO;QAE9C,+CAA+C;QAC/C,0CAA0C,EAAE;YAC1C,OAAO;YACP,KAAK,CAAC,EAAE,EAAE,gCAAgC,EAAE;gBAC1C,KAAK,EAAE;oBACL;wBACE,IAAI,EAAE,OAAO;wBACb,WAAW,EAAE,CAAC,SAAS,CAAC;wBACxB,OAAO,EACL,uHAAuH;qBAC1H;iBACF;aACF,CAAC;SACH;QAED,mCAAmC;QACnC,qBAAqB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC3C;CACF,CAAC"}
@@ -1,173 +0,0 @@
1
- export declare let parser: string;
2
- export declare namespace parserOptions {
3
- let ecmaVersion: number;
4
- let sourceType: string;
5
- }
6
- export declare namespace env {
7
- let node: boolean;
8
- let browser: boolean;
9
- }
10
- declare let _extends: string[];
11
- export { _extends as extends };
12
- export declare let plugins: string[];
13
- export declare let rules: {
14
- camelcase: string;
15
- curly: string[];
16
- eqeqeq: string;
17
- 'no-await-in-loop': string;
18
- 'no-console': (string | {
19
- allow: string[];
20
- })[];
21
- 'no-constant-condition': string;
22
- 'no-fallthrough': string;
23
- 'no-inline-comments': string;
24
- 'no-lonely-if': string;
25
- 'no-nested-ternary': string;
26
- 'no-new-wrappers': string;
27
- 'no-return-await': string;
28
- 'no-unexpected-multiline': string;
29
- 'no-unused-expressions': string;
30
- 'object-shorthand': string;
31
- 'prefer-destructuring': (string | {
32
- array: boolean;
33
- object: boolean;
34
- enforceForRenamedProperties?: never;
35
- } | {
36
- enforceForRenamedProperties: boolean;
37
- array?: never;
38
- object?: never;
39
- })[];
40
- 'prefer-exponentiation-operator': string;
41
- 'prefer-named-capture-group': string;
42
- 'prefer-object-spread': string;
43
- 'prefer-spread': string;
44
- 'prefer-template': string;
45
- radix: string;
46
- 'sort-keys': (string | {
47
- caseSensitive: boolean;
48
- natural: boolean;
49
- minKeys: number;
50
- allowLineSeparatedGroups: boolean;
51
- })[];
52
- 'spaced-comment': (string | {
53
- line: {
54
- markers: string[];
55
- };
56
- })[];
57
- 'check-file/folder-naming-convention': (string | {
58
- '**/': string;
59
- })[];
60
- 'unicorn/filename-case': (string | {
61
- case: string;
62
- ignore: never[];
63
- })[];
64
- 'unicorn/consistent-function-scoping': string;
65
- 'unicorn/no-abusive-eslint-disable': string;
66
- 'unicorn/no-array-callback-reference': string;
67
- 'unicorn/no-array-reduce': string;
68
- 'unicorn/no-nested-ternary': string;
69
- 'unicorn/no-null': string;
70
- 'unicorn/no-object-as-default-parameter': string;
71
- 'unicorn/no-useless-undefined': (string | {
72
- checkArguments: boolean;
73
- })[];
74
- 'unicorn/prefer-module': string;
75
- 'unicorn/prevent-abbreviations': string;
76
- 'import/no-default-export': string;
77
- 'import/no-duplicates': string;
78
- 'import/no-named-as-default': string;
79
- 'import/no-unresolved': string;
80
- 'import/order': (string | {
81
- groups: string[];
82
- 'newlines-between': string;
83
- alphabetize: {
84
- order: string;
85
- caseInsensitive: boolean;
86
- };
87
- })[];
88
- '@typescript-eslint/comma-dangle': string;
89
- '@typescript-eslint/consistent-type-exports': (string | {
90
- fixMixedExportsWithInlineTypeSpecifier: boolean;
91
- })[];
92
- '@typescript-eslint/consistent-type-imports': (string | {
93
- prefer: string;
94
- disallowTypeAnnotations: boolean;
95
- fixStyle: string;
96
- })[];
97
- '@typescript-eslint/explicit-function-return-type': string;
98
- '@typescript-eslint/explicit-module-boundary-types': string;
99
- '@typescript-eslint/indent': string;
100
- '@typescript-eslint/init-declarations': string;
101
- '@typescript-eslint/lines-around-comment': string;
102
- '@typescript-eslint/member-delimiter-style': string;
103
- '@typescript-eslint/member-ordering': string;
104
- '@typescript-eslint/naming-convention': string;
105
- '@typescript-eslint/no-confusing-void-expression': (string | {
106
- ignoreArrowShorthand: boolean;
107
- })[];
108
- '@typescript-eslint/no-empty-function': string;
109
- '@typescript-eslint/no-explicit-any': string;
110
- '@typescript-eslint/no-extra-parens': string;
111
- '@typescript-eslint/no-magic-numbers': string;
112
- '@typescript-eslint/no-misused-promises': (string | {
113
- checksVoidReturn: {
114
- arguments: boolean;
115
- attributes: boolean;
116
- };
117
- })[];
118
- '@typescript-eslint/no-non-null-assertion': string;
119
- '@typescript-eslint/no-require-imports': string;
120
- '@typescript-eslint/no-restricted-imports': (string | {
121
- patterns: {
122
- group: string[];
123
- message: string;
124
- }[];
125
- })[];
126
- '@typescript-eslint/no-shadow': string;
127
- '@typescript-eslint/no-type-alias': string;
128
- '@typescript-eslint/no-unnecessary-condition': string;
129
- '@typescript-eslint/no-unsafe-argument': string;
130
- '@typescript-eslint/no-unsafe-assignment': string;
131
- '@typescript-eslint/no-unsafe-member-access': string;
132
- '@typescript-eslint/no-unsafe-return': string;
133
- '@typescript-eslint/no-unused-vars': (string | {
134
- argsIgnorePattern: string;
135
- varsIgnorePattern: string;
136
- vars: string;
137
- })[];
138
- '@typescript-eslint/no-use-before-define': string;
139
- '@typescript-eslint/object-curly-spacing': string;
140
- '@typescript-eslint/prefer-nullish-coalescing': (string | {
141
- ignoreConditionalTests: boolean;
142
- })[];
143
- '@typescript-eslint/prefer-readonly-parameter-types': string;
144
- '@typescript-eslint/quotes': string;
145
- '@typescript-eslint/semi': string;
146
- '@typescript-eslint/space-before-function-paren': string;
147
- '@typescript-eslint/strict-boolean-expressions': string;
148
- '@typescript-eslint/unbound-method': string;
149
- 'functional/no-classes': string;
150
- 'functional/no-promise-reject': string;
151
- 'functional/no-try-statements': string;
152
- 'functional/prefer-tacit': string;
153
- 'lodash/import-scope': string[];
154
- 'lodash/path-style': string;
155
- 'lodash/prefer-lodash-method': string;
156
- 'deprecation/deprecation': string;
157
- };
158
- export declare let overrides: {
159
- files: string[];
160
- env: {
161
- jest: boolean;
162
- };
163
- plugins: string[];
164
- extends: string[];
165
- rules: {
166
- 'jest/prefer-expect-assertions': string;
167
- 'jest/prefer-each': string;
168
- 'jest/require-top-level-describe': string;
169
- 'jest/max-expects': string;
170
- 'jest/valid-title': string;
171
- };
172
- }[];
173
- //# sourceMappingURL=universal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"universal.d.ts","sourceRoot":"","sources":["../../src/eslint/universal.js"],"names":[],"mappings":""}
@@ -1,203 +0,0 @@
1
- "use strict";
2
- // eslint-disable-next-line @typescript-eslint/no-var-requires
3
- const { universalRestrictedImportsConfig, universalImportOrderConfig } = require('./internal');
4
- module.exports = {
5
- parser: '@typescript-eslint/parser',
6
- parserOptions: {
7
- ecmaVersion: 2022, // Allows for the parsing of modern ECMAScript features.
8
- sourceType: 'module', // Allows for the use of imports.
9
- },
10
- env: {
11
- node: true,
12
- browser: true,
13
- },
14
- extends: [
15
- 'eslint:recommended',
16
- 'plugin:@typescript-eslint/all',
17
- 'plugin:import/recommended',
18
- 'plugin:import/typescript',
19
- 'plugin:unicorn/recommended',
20
- 'plugin:promise/recommended',
21
- 'plugin:lodash/recommended',
22
- ],
23
- plugins: ['@typescript-eslint', 'deprecation', 'functional', 'unicorn', 'check-file', 'import', 'lodash'],
24
- rules: {
25
- /* Rule definitions and overrides for standard ESLint rules */
26
- camelcase: 'error',
27
- curly: ['error', 'multi-line', 'consistent'],
28
- eqeqeq: 'error',
29
- 'no-await-in-loop': 'off', // Too restrictive, often false yields to more verbose code.
30
- 'no-console': ['error', { allow: ['info', 'groupCollapsed', 'groupEnd'] }],
31
- 'no-constant-condition': 'off', // Writing a "while(true)"" loop is often the most readable way to express the intent.
32
- 'no-fallthrough': 'off', // Does not work well with typescript exhaustive enums.
33
- 'no-inline-comments': 'off',
34
- 'no-lonely-if': 'error',
35
- 'no-nested-ternary': 'error',
36
- 'no-new-wrappers': 'error',
37
- 'no-return-await': 'off', // Superceded by @typescript-eslint/return-await.
38
- 'no-unexpected-multiline': 'off', // Conflicts with prettier.
39
- 'no-unused-expressions': 'off', // Superceded by @typescript-eslint/no-unused-expressions.
40
- 'object-shorthand': 'error',
41
- 'prefer-destructuring': [
42
- 'error',
43
- {
44
- array: false, // For arrays it is often confusing to use destructuring.
45
- object: true,
46
- },
47
- {
48
- enforceForRenamedProperties: false,
49
- },
50
- ],
51
- 'prefer-exponentiation-operator': 'error',
52
- 'prefer-named-capture-group': 'error',
53
- 'prefer-object-spread': 'error',
54
- 'prefer-spread': 'error',
55
- 'prefer-template': 'error',
56
- radix: 'error',
57
- // Sort keys does not have a fixer, but sorting lines can be trivially done by IDE (or some plugin). This rule has a
58
- // nice configuration option "minKeys" which can specify how many keys should be present in an object before sorting
59
- // is enforced. This is useful for small objects, where sorting is not necessary. Also, it allows creating groups
60
- // (separated by newlines) which are sorted independently.
61
- 'sort-keys': ['error', 'asc', { caseSensitive: true, natural: true, minKeys: 10, allowLineSeparatedGroups: true }],
62
- 'spaced-comment': [
63
- 'error',
64
- 'always',
65
- {
66
- line: {
67
- markers: ['/'],
68
- },
69
- },
70
- ],
71
- /* Rules to enforce kebab-case folder structure */
72
- 'check-file/folder-naming-convention': [
73
- 'error',
74
- {
75
- '**/': 'KEBAB_CASE',
76
- },
77
- ],
78
- 'unicorn/filename-case': [
79
- 'error',
80
- {
81
- case: 'kebabCase',
82
- ignore: [],
83
- },
84
- ],
85
- /* Rule overrides for "unicorn" plugin */
86
- 'unicorn/consistent-function-scoping': 'off', // Disabling due to the rule's constraints conflicting with established patterns, especially in test suites where local helper or mocking functions are prevalent and do not necessitate exports.
87
- 'unicorn/no-abusive-eslint-disable': 'off', // Already covered by different ruleset.
88
- 'unicorn/no-array-callback-reference': 'error', // Explicitly turned on, because it was initially disabled and "point free" notation was enforced using "functional/prefer-tacit". That said, the point free pattern is dangerous in JS. See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-callback-reference.md.
89
- 'unicorn/no-array-reduce': 'off', // We are OK with using reduce occasionally, but I agree with the author that the code using reduce can easily get complex.
90
- 'unicorn/no-nested-ternary': 'off', // This rule is smarter than the standard ESLint rule, but conflicts with prettier so it needs to be turned off. Nested ternaries are very unreadable so it's OK if all of them are flagged.
91
- 'unicorn/no-null': 'off', // We use both null and undefined for representing three state objects. We could use a string union instead, but using combination of null and undefined is less verbose.
92
- 'unicorn/no-object-as-default-parameter': 'off', // Too restrictive. TypeScript can ensure that the default value matches the type.
93
- 'unicorn/no-useless-undefined': ['error', { checkArguments: false }], // We need to disable "checkArguments", because if a function expects a value of type "T | undefined" the undefined value needs to be passed explicitly.
94
- 'unicorn/prefer-module': 'off', // We use CJS for configuration files and tests. There is no rush to migrate to ESM and the configuration files are probably not yet ready for ESM yet.
95
- 'unicorn/prevent-abbreviations': 'off', // This rule reports many false positives and leads to more verbose code.
96
- /* Rule overrides for "import" plugin */
97
- 'import/no-default-export': 'error',
98
- 'import/no-duplicates': 'error',
99
- 'import/no-named-as-default': 'off',
100
- 'import/no-unresolved': 'off', // Does not accept exports keyword. See: https://github.com/import-js/eslint-plugin-import/issues/1810.
101
- 'import/order': ['error', universalImportOrderConfig],
102
- /* Rule overrides for "@typescript-eslint" plugin */
103
- '@typescript-eslint/comma-dangle': 'off', // Conflicts with prettier.
104
- '@typescript-eslint/consistent-type-exports': [
105
- 'error',
106
- {
107
- fixMixedExportsWithInlineTypeSpecifier: true,
108
- },
109
- ],
110
- '@typescript-eslint/consistent-type-imports': [
111
- 'error',
112
- {
113
- prefer: 'type-imports',
114
- disallowTypeAnnotations: false, // It is quite common to do so. See: https://typescript-eslint.io/rules/consistent-type-imports/#disallowtypeannotations.
115
- fixStyle: 'inline-type-imports',
116
- },
117
- ],
118
- '@typescript-eslint/explicit-function-return-type': 'off', // Prefer inferring types to explicit annotations.
119
- '@typescript-eslint/explicit-module-boundary-types': 'off', // We export lot of functions in order to test them. Typing them all is not a good idea.
120
- '@typescript-eslint/indent': 'off', // Conflicts with prettier.
121
- '@typescript-eslint/init-declarations': 'off', // Too restrictive, TS is able to infer if value is initialized or not. This pattern does not work with declaring a variable and then initializing it conditionally (or later).
122
- '@typescript-eslint/lines-around-comment': 'off', // Do not agree with this rule.
123
- '@typescript-eslint/member-delimiter-style': 'off', // Conflicts with prettier.
124
- '@typescript-eslint/member-ordering': 'off', // Does not have a fixer. Also, sometimes it's beneficial to group related members together.
125
- '@typescript-eslint/naming-convention': 'off',
126
- '@typescript-eslint/no-confusing-void-expression': [
127
- 'error',
128
- {
129
- ignoreArrowShorthand: true, // See: https://typescript-eslint.io/rules/no-confusing-void-expression/#ignorearrowshorthand.
130
- },
131
- ],
132
- '@typescript-eslint/no-empty-function': 'off', // Too restrictive, often false yields to more verbose code.
133
- '@typescript-eslint/no-explicit-any': 'off', // Using "any" is sometimes necessary.
134
- '@typescript-eslint/no-extra-parens': 'off', // Conflicts with prettier.
135
- '@typescript-eslint/no-magic-numbers': 'off', // Too restrictive. There is often nothing wrong with inlining numbers.
136
- '@typescript-eslint/no-misused-promises': [
137
- 'error',
138
- {
139
- checksVoidReturn: {
140
- arguments: false, // It's common to pass async function where one expects a function returning void.
141
- attributes: false, // It's common to pass async function where one expects a function returning void.
142
- },
143
- },
144
- ],
145
- '@typescript-eslint/no-non-null-assertion': 'off', // Too restrictive. The inference is often not powerful enough or there is not enough context.
146
- '@typescript-eslint/no-require-imports': 'off', // We use a similar rule called "@typescript-eslint/no-var-imports" which bans require imports alltogether.
147
- '@typescript-eslint/no-restricted-imports': ['error', universalRestrictedImportsConfig],
148
- '@typescript-eslint/no-shadow': 'off', // It is often valid to shadow variable (e.g. for the lack of a better name).
149
- '@typescript-eslint/no-type-alias': 'off', // The rule is deprecated and "@typescript-eslint/consistent-type-definitions" is used instead.
150
- '@typescript-eslint/no-unnecessary-condition': 'off', // Suggests removing useful conditionals for index signatures and arrays. Would require enabling additional strict checks in TS, which is hard to ask.
151
- '@typescript-eslint/no-unsafe-argument': 'off', // Too restrictive, often false yields to more verbose code.
152
- '@typescript-eslint/no-unsafe-assignment': 'off', // Too restrictive, often false yields to more verbose code.
153
- '@typescript-eslint/no-unsafe-member-access': 'off', // Too restrictive, often false yields to more verbose code.
154
- '@typescript-eslint/no-unsafe-return': 'off', // Too restrictive, often false yields to more verbose code.
155
- '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_', vars: 'all' }],
156
- '@typescript-eslint/no-use-before-define': 'off', // Too restrictive, does not have a fixer and is not important.
157
- '@typescript-eslint/object-curly-spacing': 'off', // Conflicts with prettier.
158
- '@typescript-eslint/prefer-nullish-coalescing': [
159
- 'error',
160
- {
161
- ignoreConditionalTests: true, // Its more intuitive to use logical operators in conditionals.
162
- },
163
- ],
164
- '@typescript-eslint/prefer-readonly-parameter-types': 'off', // Too restrictive, often false yields to more verbose code.
165
- '@typescript-eslint/quotes': 'off', // Conflicts with prettier.
166
- '@typescript-eslint/semi': 'off', // Conflicts with prettier.
167
- '@typescript-eslint/space-before-function-paren': 'off', // Conflicts with prettier.
168
- '@typescript-eslint/strict-boolean-expressions': 'off', // While the rule is reasonable, it is often convenient and intended to just check whether the value is not null or undefined. Enabling this rule would make the code more verbose. See: https://typescript-eslint.io/rules/strict-boolean-expressions/
169
- '@typescript-eslint/unbound-method': 'off', // Reports issues for common patterns in tests (e.g. "expect(logger.warn)..."). Often the issue yields false positives.
170
- /* Rule overrides for "functional" plugin */
171
- 'functional/no-classes': 'error', // Functions are all we need.
172
- 'functional/no-promise-reject': 'error',
173
- 'functional/no-try-statements': 'error', // Use go utils instead.
174
- 'functional/prefer-tacit': 'off', // The rule is dangerous. See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-callback-reference.md.
175
- /* Overrides for "lodash" plugin */
176
- 'lodash/import-scope': ['error', 'member'], // We prefer member imports in node.js code. This is not recommended for FE projects, because lodash can't be tree shaken (written in CJS not ESM). This rule should be overridden for FE projects (and we do so in React ruleset).
177
- 'lodash/path-style': 'off', // Can potentially trigger TS errors. Both variants have use cases when they are more readable.
178
- 'lodash/prefer-lodash-method': 'off', // Disagree with this rule. Using the native method is often simpler.
179
- /* Rule overrides for other plugins and rules */
180
- // This rule unfortunately does not detect deprecated properties. See:
181
- // https://github.com/gund/eslint-plugin-deprecation/issues/13/
182
- 'deprecation/deprecation': 'error',
183
- },
184
- overrides: [
185
- // Overrides for Jest tests.
186
- {
187
- files: ['**/*.test.ts', '**/*.test.tsx'],
188
- env: {
189
- jest: true,
190
- },
191
- plugins: ['jest'],
192
- extends: ['plugin:jest/all', 'plugin:jest-formatting/recommended'],
193
- rules: {
194
- 'jest/prefer-expect-assertions': 'off', // Enabling this option would result in excessively verbose code.
195
- 'jest/prefer-each': 'off', // We prefer the traditional for loop.
196
- 'jest/require-top-level-describe': 'off', // This is not a good pattern. There is nothing wrong with having multiple top level describe blocks or tests.
197
- 'jest/max-expects': 'off', // It's good to limit the number of expects in a test, but this rule is too strict.
198
- 'jest/valid-title': 'off', // Prevents using "<function-name>.name" as a test name
199
- },
200
- },
201
- ],
202
- };
203
- //# sourceMapp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IAAyI;QAE3K,mCAAmC;QACnC,qBAAqB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,mOAAmO;QAC/Q,mBAAmB,EAAE,KAAK,EAAE,+FAA+F;QAC3H,6BAA6B,EAAE,KAAK,EAAE,qEAAqE;QAE3G,gDAAgD;QAChD,sEAAsE;QACtE,+DAA+D;QAC/D,yBAAyB,EAAE,OAAO;KACnC;IACD,SAAS,EAAE;QACT,4BAA4B;QAC5B;YACE,KAAK,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;YACxC,GAAG,EAAE;gBACH,IAAI,EAAE,IAAI;aACX;YACD,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,OAAO,EAAE,CAAC,iBAAiB,EAAE,oCAAoC,CAAC;YAClE,KAAK,EAAE;gBACL,+BAA+B,EAAE,KAAK,EAAE,iEAAiE;gBACzG,kBAAkB,EAAE,KAAK,EAAE,sCAAsC;gBACjE,iCAAiC,EAAE,KAAK,EAAE,8GAA8G;gBACxJ,kBAAkB,EAAE,KAAK,EAAE,mFAAmF;gBAC9G,kBAAkB,EAAE,KAAK,EAAE,uDAAuD;aACnF;SACF;KACF;CACF,CAAC"}
@@ -1,87 +0,0 @@
1
- # eslint
2
-
3
- > ESLint configurations used across API3 projects.
4
-
5
- The modules consists of multiple ESLint configurations supporting wide variety of targets:
6
-
7
- - `universal` - Linting rules for universal (both FE and BE) JS/TS code (with the emphasis on TS).
8
- - `react` - Linting rules for React code.
9
- - `next-js` - Linting rules for Next.js code.
10
- - `jest` - Linting rules for Jest tests. Note, that these rules are only applied for JS/TS files with `*.test.*`
11
- extensions.
12
-
13
- ## Getting started
14
-
15
- 1. Create an `.eslintrc.js` configuration file in the repo root.
16
- 2. Extend the desired configuration(s).
17
- 3. Specify the `parserOptions.project` option with the path to the `tsconfig.json` file(s).
18
- 4. Install `eslint` (which is a peer dependency of this module) as dev dependencies.
19
-
20
- For example:
21
-
22
- ```js
23
- module.exports = {
24
- // Unfortunately, the plugin does not comply with official ESLint naming convention which demands the plugin to be
25
- // published as "@api3/eslint-config-commons". As a workaround, you need to use a relative path instead.
26
- //
27
- // See: https://github.com/eslint/eslintrc/blob/242d569020dfe4f561e4503787b99ec016337457/lib/config-array-factory.js#L920
28
- extends: ['./node_modules/@api3/commons/dist/eslint/universal', './node_modules/@api3/commons/dist/eslint/jest'],
29
- parserOptions: {
30
- // We focus primarily on TS and for that we need to specify the TS configs which is project specific. The following
31
- // is a common monorepo setup (root config and a config for each package).
32
- project: ['./tsconfig.json', './packages/*/tsconfig.json'],
33
- },
34
- };
35
- ```
36
-
37
- ### Linting commands
38
-
39
- We recommend using the following linting commands inside `package.json` scripts:
40
-
41
- ```json
42
- {
43
- "eslint:check": "eslint --report-unused-disable-directives --cache --ext js,ts,tsx,jsx . --max-warnings 0",
44
- "eslint:fix": "pnpm run eslint:check --fix"
45
- }
46
- ```
47
-
48
- The `--cache` parameter makes ESLint create a `.eslintcache` file in the root of the project. This file should be put to
49
- `.gitignore`.
50
-
51
- ## Rules
52
-
53
- The configurations are a collection of various rulesets and the config is quite strict. In general there are rules that:
54
-
55
- - Have a fixer (import ordering)
56
- - Simplify code (combine two nested ifs)
57
- - Make code more consistent (make `return void` pattern be split on two lines)
58
- - Fix outdated stuff (avoid `!` ts operator when not necessary)
59
- - Avoid vulnerabilities and errors (Number.parseInt without radix)
60
-
61
- Tip: Some rules do have fixer with multiple variants of the fixes. You need to use the IDE to prompt the fixes and
62
- choose the one you want.
63
-
64
- ### Overriding rules
65
-
66
- To override a rule, you can use the `rules` section key in your `.eslintrc.js` file. For example:
67
-
68
- ```js
69
- {
70
- rules: {
71
- 'check-file/folder-naming-convention': 'off', // Turns of the kebab-case convention for folder names.
72
- 'unicorn/filename-case': 'off' // Turns of the kebab-case convention for filenames.
73
-
74
- 'import/no-default-export': 'off', // Turns off the rule that disallows default exports.
75
- 'import/prefer-default-export': 'error' // Turns on the rule that prefers default exports.
76
- }
77
- }
78
- ```
79
-
80
- ## Development notes
81
-
82
- - The implementation is intentionally written in JS so it can be used to lint the project itself. You can see that the
83
- root `.eslintrc.js` extends the configuration files from this module.
84
-
85
- - Unfortunately, the plugin does not comply with official ESLint naming convention which demands the plugin to be
86
- published as "@api3/eslint-config-commons". As a workaround, project need to use a relative path instead. See:
87
- https://github.com/eslint/eslintrc/blob/242d569020dfe4f561e4503787b99ec016337457/lib/config-array-factory.js#L920
@@ -1,24 +0,0 @@
1
- const universalRestrictedImportsConfig = {
2
- patterns: [
3
- {
4
- group: ['date-fns/*'],
5
- // The date-fns library is tree-shakeable and it's more convenient to use named imports.
6
- message: "Please use named imports from 'date-fns'.",
7
- },
8
- ],
9
- };
10
-
11
- const universalImportOrderConfig = {
12
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
13
- groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
14
- 'newlines-between': 'always',
15
- alphabetize: {
16
- order: 'asc',
17
- caseInsensitive: true,
18
- },
19
- };
20
-
21
- module.exports = {
22
- universalRestrictedImportsConfig,
23
- universalImportOrderConfig,
24
- };
@@ -1,36 +0,0 @@
1
- module.exports = {
2
- parser: '@typescript-eslint/parser',
3
- parserOptions: {
4
- ecmaVersion: 2022, // Enable parsing modern ECMAScript features.
5
- sourceType: 'module', // Enable the use of ES6 import/export syntax.
6
- },
7
- env: {
8
- node: true,
9
- browser: true,
10
- },
11
- // Configuration for specific files is done under 'overrides'.
12
- overrides: [
13
- {
14
- files: ['**/*.test.ts', '**/*.test.tsx', '**/*.test.js', '**/*.test.jsx'],
15
- env: {
16
- jest: true,
17
- },
18
- plugins: ['jest'],
19
- extends: ['plugin:jest/all', 'plugin:jest-formatting/recommended'],
20
- rules: {
21
- 'jest/prefer-expect-assertions': 'off', // While useful, enforcing this can lead to verbose tests.
22
- 'jest/prefer-each': 'off', // We find traditional for-loops more readable in certain contexts.
23
- 'jest/require-top-level-describe': 'off', // Multiple top-level describe blocks or tests can be acceptable.
24
- 'jest/max-expects': 'off', // Limiting expect statements is beneficial, but enforcing a strict count can be restrictive.
25
- 'jest/valid-title': 'off', // This restriction can prevent using titles like "<function-name>.name".
26
- 'jest/no-hooks': [
27
- 'error', // We advocate for setup functions over beforeXXX hooks. However, afterXyz hooks are sometimes indispensable, like for resetting Jest timers. See: https://kentcdodds.com/blog/avoid-nesting-when-youre-testing#inline-it.
28
- {
29
- allow: ['afterEach', 'afterAll'],
30
- },
31
- ],
32
- 'prefer-lowercase-title': 'off', // Sometimes we want to start the test with a capital letter and some words are all uppercase (e.g. AWS).
33
- },
34
- },
35
- ],
36
- };