From 2662d203697a50e528700fd8f9ec1a6b0f0612e4 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sun, 1 Feb 2026 03:56:29 +0000 Subject: [PATCH] Initial upload: ErrorFix CLI with rule engine and pattern matching --- rules/javascript/errors.yaml | 98 ++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 rules/javascript/errors.yaml diff --git a/rules/javascript/errors.yaml b/rules/javascript/errors.yaml new file mode 100644 index 0000000..d4815ca --- /dev/null +++ b/rules/javascript/errors.yaml @@ -0,0 +1,98 @@ +- id: js-syntax-error-unexpected-token + name: "JavaScript Syntax Error - Unexpected Token" + pattern: "SyntaxError: Unexpected token" + fix: "Check for missing commas, parentheses, or braces. Review the specific line for syntax issues." + description: "An unexpected token was encountered" + severity: error + language: javascript + tool: node + tags: [syntax, token] + priority: 10 + +- id: js-reference-error + name: "JavaScript Reference Error" + pattern: "ReferenceError: (?P[a-zA-Z_][a-zA-Z0-9_]*) is not defined" + fix: "Define '{name}' before using it, or check for typos in the variable/function name." + description: "A reference to an undefined variable or function" + severity: error + language: javascript + tool: node + tags: [reference, undefined] + priority: 9 + +- id: js-type-error-cannot-read + name: "JavaScript Type Error - Cannot Read Property" + pattern: "TypeError: Cannot read (property|properties) '(?P[^']+)' of (?Pundefined|null)" + fix: "Check if '{object}' is defined before accessing '{property}'. Use optional chaining (?.) or null checks." + description: "Cannot read property of undefined or null" + severity: error + language: javascript + tool: node + tags: [type, property, undefined] + priority: 9 + +- id: js-type-error-cannot-call + name: "JavaScript Type Error - Not a Function" + pattern: "TypeError: (?P[a-zA-Z_][a-zA-Z0-9_]*) is not a function" + fix: "Check that '{object}' is a function. You may have forgotten parentheses when calling a function." + description: "Attempting to call a non-function" + severity: error + language: javascript + tool: node + tags: [type, function] + priority: 9 + +- id: js-module-not-found + name: "JavaScript Module Not Found" + pattern: "Error: Cannot find module '(?P[^']+)'" + fix: "Install the module: npm install {module}" + description: "A module could not be found" + severity: error + language: javascript + tool: node + tags: [module, import] + priority: 9 + +- id: js-cannot-use-strict + name: "JavaScript Strict Mode Error" + pattern: "SyntaxError: Cannot use strict mode inside with strict mode" + fix: "Remove the 'with' statement or refactor your code to not require it." + description: "Cannot use strict mode with 'with' statement" + severity: error + language: javascript + tool: node + tags: [strict, with] + priority: 8 + +- id: js-duplicate-identifier + name: "JavaScript Duplicate Identifier" + pattern: "SyntaxError: Duplicate binding" + fix: "Remove the duplicate variable/function declaration." + description: "A duplicate identifier was declared" + severity: error + language: javascript + tool: node + tags: [duplicate, declaration] + priority: 8 + +- id: ts-type-error + name: "TypeScript Type Error" + pattern: "TypeScript Error: (?P.*)" + fix: "Check types. {message}" + description: "TypeScript type checking failed" + severity: error + language: typescript + tool: tsc + tags: [typescript, type] + priority: 8 + +- id: ts-property-missing + name: "TypeScript Property Missing" + pattern: "Property '(?P[^']+)' does not exist on type '(?P[^']+)'" + fix: "Add the property '{property}' to the type definition or check for typos." + description: "A property is missing from a type" + severity: error + language: typescript + tool: tsc + tags: [typescript, property, type] + priority: 8