UNPKG

@mindfiredigital/eslint-plugin-hub

Version:

eslint-plugin-hub is a powerful, flexible ESLint plugin that provides a curated set of rules to enhance code readability, maintainability, and prevent common errors. Whether you're working with vanilla JavaScript, TypeScript, React, or Angular, eslint-plu

32 lines (31 loc) 822 B
module.exports = { rules: { 'class-pascalcase': { meta: { type: 'problem', docs: { description: 'Enforce PascalCase for class names', category: 'Stylistic Issues', recommended: false, }, schema: [], // Add schema if your rule has options }, create: function (context) { return { ClassDeclaration(node) { // Check if the class name is not in PascalCase if (!/^[A-Z][A-Za-z]*$/.test(node.id.name)) { context.report({ node: node.id, message: 'Class name "{{name}}" must be in PascalCase.', data: { name: node.id.name, }, }); } }, }; }, }, }, };