Problem
No linting configuration exists. Code style is inconsistent and potential bugs (like the wriable typo) go undetected.
Suggestion
Add ESLint with a standard configuration.
Setup
{
"devDependencies": {
"eslint": "^8.0.0"
},
"scripts": {
"lint": "eslint AJAXRequest.js",
"lint:fix": "eslint AJAXRequest.js --fix"
}
}
Configuration
Create .eslintrc.json with rules appropriate for browser JavaScript:
no-undef to catch misspelled variables
no-unused-vars to detect dead code
consistent-return for functions that sometimes return and sometimes do not
eqeqeq to enforce strict equality
Expected Outcome
- All existing lint errors fixed
- Lint runs as part of CI pipeline
Problem
No linting configuration exists. Code style is inconsistent and potential bugs (like the
wriabletypo) go undetected.Suggestion
Add ESLint with a standard configuration.
Setup
{ "devDependencies": { "eslint": "^8.0.0" }, "scripts": { "lint": "eslint AJAXRequest.js", "lint:fix": "eslint AJAXRequest.js --fix" } }Configuration
Create
.eslintrc.jsonwith rules appropriate for browser JavaScript:no-undefto catch misspelled variablesno-unused-varsto detect dead codeconsistent-returnfor functions that sometimes return and sometimes do noteqeqeqto enforce strict equalityExpected Outcome