Initial upload: ErrorFix CLI with rule engine and pattern matching
Some checks failed
CI / test (push) Has been cancelled
Some checks failed
CI / test (push) Has been cancelled
This commit is contained in:
98
rules/javascript/errors.yaml
Normal file
98
rules/javascript/errors.yaml
Normal file
@@ -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<name>[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<property>[^']+)' of (?P<object>undefined|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<object>[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<module>[^']+)'"
|
||||||
|
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<message>.*)"
|
||||||
|
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<property>[^']+)' does not exist on type '(?P<type>[^']+)'"
|
||||||
|
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
|
||||||
Reference in New Issue
Block a user