import type { ESLint, Linter } from 'eslint'; import pkg from '../package.json' with { type: 'json' }; import { rules } from './rules/index.js'; const plugin = { meta: { name: pkg.name, version: pkg.version, namespace: '@n8n/community-nodes', }, // @ts-expect-error Rules type does not match for typescript-eslint and eslint rules: rules as ESLint.Plugin['rules'], } satisfies ESLint.Plugin; const configs = { recommended: { ignores: ['eslint.config.{js,mjs,ts,mts}'], plugins: { '@n8n/community-nodes': plugin, }, rules: { '@n8n/community-nodes/ai-node-package-json': 'error', '@n8n/community-nodes/no-restricted-globals': 'error', '@n8n/community-nodes/no-restricted-imports': 'error', '@n8n/community-nodes/credential-password-field': 'error', '@n8n/community-nodes/credential-unnecessary-password': 'warn', '@n8n/community-nodes/n8n-object-validation': 'error', '@n8n/community-nodes/no-deprecated-workflow-functions': 'error', '@n8n/community-nodes/no-emoji-in-options': 'error', '@n8n/community-nodes/node-usable-as-tool': 'error', '@n8n/community-nodes/open-ended-node-fields': 'warn', '@n8n/community-nodes/package-name-convention': 'error', '@n8n/community-nodes/credential-test-required': 'error', '@n8n/community-nodes/no-credential-reuse': 'error', '@n8n/community-nodes/no-dangerous-functions': 'error', '@n8n/community-nodes/no-dead-files': 'warn', '@n8n/community-nodes/no-forbidden-lifecycle-scripts': 'error', '@n8n/community-nodes/no-hardcoded-secrets': 'error', '@n8n/community-nodes/no-http-request-with-manual-auth': 'error', '@n8n/community-nodes/no-overrides-field': 'error', '@n8n/community-nodes/no-runtime-dependencies': 'error', '@n8n/community-nodes/no-silent-error-swallowing': 'error', '@n8n/community-nodes/no-template-placeholders': 'error', '@n8n/community-nodes/no-unsafe-connection-type-cast': 'error', '@n8n/community-nodes/icon-validation': 'error', '@n8n/community-nodes/icon-prefer-themed-variants': 'warn', '@n8n/community-nodes/resource-operation-pattern': 'error', '@n8n/community-nodes/trigger-node-conventions': 'error', '@n8n/community-nodes/credential-documentation-url': 'error', '@n8n/community-nodes/cred-class-field-icon-missing': 'error', '@n8n/community-nodes/cred-class-oauth2-naming': 'error', '@n8n/community-nodes/node-connection-type-literal': 'error', '@n8n/community-nodes/missing-paired-item': 'error', '@n8n/community-nodes/no-builder-hint-leakage': 'error', '@n8n/community-nodes/node-registration-complete': 'warn', '@n8n/community-nodes/require-files-array': 'warn', '@n8n/community-nodes/require-homepage': 'warn', '@n8n/community-nodes/require-node-api-error': 'error', '@n8n/community-nodes/require-node-description-fields': 'error', '@n8n/community-nodes/require-version': 'error', '@n8n/community-nodes/valid-author': 'error', '@n8n/community-nodes/valid-credential-references': 'error', '@n8n/community-nodes/valid-description': 'error', '@n8n/community-nodes/valid-node-categories': 'error', '@n8n/community-nodes/valid-peer-dependencies': 'error', '@n8n/community-nodes/webhook-lifecycle-complete': 'error', }, }, recommendedWithoutN8nCloudSupport: { ignores: ['eslint.config.{js,mjs,ts,mts}'], plugins: { '@n8n/community-nodes': plugin, }, rules: { '@n8n/community-nodes/ai-node-package-json': 'error', '@n8n/community-nodes/credential-password-field': 'error', '@n8n/community-nodes/credential-unnecessary-password': 'warn', '@n8n/community-nodes/n8n-object-validation': 'error', '@n8n/community-nodes/no-deprecated-workflow-functions': 'error', '@n8n/community-nodes/no-emoji-in-options': 'error', '@n8n/community-nodes/node-usable-as-tool': 'error', '@n8n/community-nodes/open-ended-node-fields': 'warn', '@n8n/community-nodes/package-name-convention': 'error', '@n8n/community-nodes/credential-test-required': 'error', '@n8n/community-nodes/no-credential-reuse': 'error', '@n8n/community-nodes/no-dangerous-functions': 'error', '@n8n/community-nodes/no-dead-files': 'warn', '@n8n/community-nodes/no-forbidden-lifecycle-scripts': 'error', '@n8n/community-nodes/no-hardcoded-secrets': 'error', '@n8n/community-nodes/no-http-request-with-manual-auth': 'error', '@n8n/community-nodes/no-overrides-field': 'error', '@n8n/community-nodes/no-runtime-dependencies': 'error', '@n8n/community-nodes/no-silent-error-swallowing': 'error', '@n8n/community-nodes/no-template-placeholders': 'error', '@n8n/community-nodes/no-unsafe-connection-type-cast': 'error', '@n8n/community-nodes/icon-validation': 'error', '@n8n/community-nodes/icon-prefer-themed-variants': 'warn', '@n8n/community-nodes/credential-documentation-url': 'error', '@n8n/community-nodes/resource-operation-pattern': 'error', '@n8n/community-nodes/trigger-node-conventions': 'error', '@n8n/community-nodes/cred-class-field-icon-missing': 'error', '@n8n/community-nodes/cred-class-oauth2-naming': 'error', '@n8n/community-nodes/node-connection-type-literal': 'error', '@n8n/community-nodes/missing-paired-item': 'error', '@n8n/community-nodes/no-builder-hint-leakage': 'error', '@n8n/community-nodes/node-registration-complete': 'warn', '@n8n/community-nodes/require-files-array': 'warn', '@n8n/community-nodes/require-homepage': 'warn', '@n8n/community-nodes/require-node-api-error': 'error', '@n8n/community-nodes/require-node-description-fields': 'error', '@n8n/community-nodes/require-version': 'error', '@n8n/community-nodes/valid-author': 'error', '@n8n/community-nodes/valid-credential-references': 'error', '@n8n/community-nodes/valid-description': 'error', '@n8n/community-nodes/valid-node-categories': 'error', '@n8n/community-nodes/valid-peer-dependencies': 'error', '@n8n/community-nodes/webhook-lifecycle-complete': 'error', }, }, } satisfies Record; const pluginWithConfigs = { ...plugin, configs } satisfies ESLint.Plugin; const n8nCommunityNodesPlugin = pluginWithConfigs; export default pluginWithConfigs; export { rules, configs, n8nCommunityNodesPlugin };