mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
ci: Introduce lint rule no-untyped-config-class-field
(no-changelog) (#10436)
This commit is contained in:
parent
6bca879d4a
commit
bb4582fa2f
|
@ -7,4 +7,13 @@ module.exports = {
|
||||||
extends: ['@n8n_io/eslint-config/node'],
|
extends: ['@n8n_io/eslint-config/node'],
|
||||||
|
|
||||||
...sharedOptions(__dirname),
|
...sharedOptions(__dirname),
|
||||||
|
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['**/*.config.ts'],
|
||||||
|
rules: {
|
||||||
|
'n8n-local-rules/no-untyped-config-class-field': 'error',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -492,6 +492,29 @@ module.exports = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'no-untyped-config-class-field': {
|
||||||
|
meta: {
|
||||||
|
type: 'problem',
|
||||||
|
docs: {
|
||||||
|
description: 'Enforce explicit typing of config class fields',
|
||||||
|
recommended: 'error',
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
noUntypedConfigClassField:
|
||||||
|
'Class field must have an explicit type annotation, e.g. `field: type = value`. See: https://github.com/n8n-io/n8n/pull/10433',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
create(context) {
|
||||||
|
return {
|
||||||
|
PropertyDefinition(node) {
|
||||||
|
if (!node.typeAnnotation) {
|
||||||
|
context.report({ node: node.key, messageId: 'noUntypedConfigClassField' });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const isJsonParseCall = (node) =>
|
const isJsonParseCall = (node) =>
|
||||||
|
|
Loading…
Reference in a new issue