Skip to content

Latest commit

 

History

History
66 lines (54 loc) · 1.69 KB

cred-class-field-properties-assertion.md

File metadata and controls

66 lines (54 loc) · 1.69 KB

cred-class-field-properties-assertion

In a credential class, the field properties must be typed INodeProperties and individual properties must have no assertions.

📋 This rule is part of the plugin:n8n-nodes-base/credentials config.

🔧 Run ESLint with --fix option to autofix the issue flagged by this rule.

Examples

❌ Example of incorrect code:

class TestApi implements ICredentialType {
    name = 'myTestApi';
    displayName = 'My Test API';
    documentationUrl = 'myTest';
    properties = [
        {
            displayName: 'API Root URL',
            name: 'URL',
            type: 'string' as NodePropertyTypes,
            default: 'https://kf.kobotoolbox.org/',
        },
    ];
}

class TestApi implements ICredentialType {
    name = 'myTestApi';
    displayName = 'My Test API';
    documentationUrl = 'myTest';
    properties: INodeProperties[] = [
        {
            displayName: 'API Root URL',
            name: 'URL',
            type: 'string' as NodePropertyTypes,
            default: 'https://kf.kobotoolbox.org/',
        },
    ];
}

✅ Example of correct code:

class TestApi implements ICredentialType {
    name = 'myTestApi';
    displayName = 'My Test API';
    documentationUrl = 'myTest';
    properties: INodeProperties[] = [
        {
            displayName: 'API Root URL',
            name: 'URL',
            type: 'string',
            default: 'https://kf.kobotoolbox.org/',
        },
    ];
}

Links