Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
62 lines
2.2 KiB
TypeScript
62 lines
2.2 KiB
TypeScript
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/no-deprecated-workflow-functions': 'error',
|
|
'@n8n/community-nodes/node-usable-as-tool': 'error',
|
|
'@n8n/community-nodes/package-name-convention': 'error',
|
|
'@n8n/community-nodes/credential-test-required': 'error',
|
|
'@n8n/community-nodes/no-credential-reuse': 'error',
|
|
'@n8n/community-nodes/icon-validation': 'error',
|
|
'@n8n/community-nodes/resource-operation-pattern': 'warn',
|
|
'@n8n/community-nodes/credential-documentation-url': '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/no-deprecated-workflow-functions': 'error',
|
|
'@n8n/community-nodes/node-usable-as-tool': 'error',
|
|
'@n8n/community-nodes/package-name-convention': 'error',
|
|
'@n8n/community-nodes/credential-test-required': 'error',
|
|
'@n8n/community-nodes/no-credential-reuse': 'error',
|
|
'@n8n/community-nodes/icon-validation': 'error',
|
|
'@n8n/community-nodes/credential-documentation-url': 'error',
|
|
'@n8n/community-nodes/resource-operation-pattern': 'warn',
|
|
},
|
|
},
|
|
} satisfies Record<string, Linter.Config>;
|
|
|
|
const pluginWithConfigs = { ...plugin, configs } satisfies ESLint.Plugin;
|
|
|
|
const n8nCommunityNodesPlugin = pluginWithConfigs;
|
|
export default pluginWithConfigs;
|
|
export { rules, configs, n8nCommunityNodesPlugin };
|