Skip to content

Commit

Permalink
ci: Introduce lint rule no-untyped-config-class-field (no-changelog)
Browse files Browse the repository at this point in the history
Pending #10433
  • Loading branch information
ivov committed Aug 15, 2024
1 parent 5754fe4 commit fcd2285
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/@n8n/config/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@ module.exports = {
extends: ['@n8n_io/eslint-config/node'],

...sharedOptions(__dirname),

overrides: [
{
files: ['**/*.config.ts'],
rules: {
'n8n-local-rules/no-untyped-config-class-field': 'error',
},
},
],
};
23 changes: 23 additions & 0 deletions packages/@n8n_io/eslint-config/local-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down

0 comments on commit fcd2285

Please sign in to comment.