diff --git a/packages/@n8n/config/.eslintrc.js b/packages/@n8n/config/.eslintrc.js index 032e99b09eab7..e5a8f3f0f9890 100644 --- a/packages/@n8n/config/.eslintrc.js +++ b/packages/@n8n/config/.eslintrc.js @@ -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', + }, + }, + ], }; diff --git a/packages/@n8n_io/eslint-config/local-rules.js b/packages/@n8n_io/eslint-config/local-rules.js index 09a9c00f0f852..92b0f6669e4c3 100644 --- a/packages/@n8n_io/eslint-config/local-rules.js +++ b/packages/@n8n_io/eslint-config/local-rules.js @@ -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) =>