Skip to main content
Glama
require-file-header.test.js1.55 kB
/** * Simplified unit tests for the require-file-header ESLint rule */ const { RuleTester } = require('eslint'); const requireFileHeader = require('../require-file-header-test'); // Configure rule tester const ruleTester = new RuleTester({ languageOptions: { ecmaVersion: 2020 } }); // Run tests ruleTester.run('require-file-header', requireFileHeader, { valid: [ // Valid file with proper header comment (default options) { code: `/** * This is a valid header comment that meets the minimum length requirement. * It provides helpful context about the purpose of this file. */ function example() { return true; }`, options: [{ minLength: 50 }] } ], invalid: [ // Missing header comment { code: `function example() { return true; }`, options: [{ minLength: 50 }], errors: [{ messageId: 'missingHeader' }] }, // Header comment too short { code: `/** * Too short comment. */ function example() { return true; }`, options: [{ minLength: 50 }], errors: [{ messageId: 'headerTooShort' }] }, // Header comment too long { code: `/** * This is a very long comment that exceeds the maximum length. * It goes on and on with unnecessary details that don't add value. * This makes the comment harder to read and less focused on what matters. * Shorter, more concise comments are often more effective. */ function example() { return true; }`, options: [{ maxLength: 100 }], errors: [{ messageId: 'headerTooLong' }] } ] });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tbreeding/jira-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server