- ✅ Ticket 1.1: Estructura Clean Architecture en backend - ✅ Ticket 1.2: Schemas Zod compartidos - ✅ Ticket 1.3: Refactorización drugs.ts (1362 → 8 archivos modulares) - ✅ Ticket 1.4: Refactorización procedures.ts (3583 → 6 archivos modulares) - ✅ Ticket 1.5: Eliminación de duplicidades (~50 líneas) Cambios principales: - Creada estructura Clean Architecture en backend/src/ - Schemas Zod compartidos en backend/src/shared/schemas/ - Refactorización modular de drugs y procedures - Utilidades genéricas en src/utils/ (filter, validation) - Eliminados scripts obsoletos y documentación antigua - Corregidos errores: QueryClient, import test-error-handling - Build verificado y funcionando correctamente
67 lines
1.5 KiB
JavaScript
67 lines
1.5 KiB
JavaScript
/**
|
|
* @fileoverview A rule to disallow modifying variables of class declarations
|
|
* @author Toru Nagashima
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
const astUtils = require("./utils/ast-utils");
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Rule Definition
|
|
//------------------------------------------------------------------------------
|
|
|
|
/** @type {import('../types').Rule.RuleModule} */
|
|
module.exports = {
|
|
meta: {
|
|
type: "problem",
|
|
|
|
docs: {
|
|
description: "Disallow reassigning class members",
|
|
recommended: true,
|
|
url: "https://eslint.org/docs/latest/rules/no-class-assign",
|
|
},
|
|
|
|
schema: [],
|
|
|
|
messages: {
|
|
class: "'{{name}}' is a class.",
|
|
},
|
|
},
|
|
|
|
create(context) {
|
|
const sourceCode = context.sourceCode;
|
|
|
|
/**
|
|
* Finds and reports references that are non initializer and writable.
|
|
* @param {Variable} variable A variable to check.
|
|
* @returns {void}
|
|
*/
|
|
function checkVariable(variable) {
|
|
astUtils
|
|
.getModifyingReferences(variable.references)
|
|
.forEach(reference => {
|
|
context.report({
|
|
node: reference.identifier,
|
|
messageId: "class",
|
|
data: { name: reference.identifier.name },
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Finds and reports references that are non initializer and writable.
|
|
* @param {ASTNode} node A ClassDeclaration/ClassExpression node to check.
|
|
* @returns {void}
|
|
*/
|
|
function checkForClass(node) {
|
|
sourceCode.getDeclaredVariables(node).forEach(checkVariable);
|
|
}
|
|
|
|
return {
|
|
ClassDeclaration: checkForClass,
|
|
ClassExpression: checkForClass,
|
|
};
|
|
},
|
|
};
|