Integrate JSHint Static Analysis Tool for JavaScript Code Quality Flagging#63
Integrate JSHint Static Analysis Tool for JavaScript Code Quality Flagging#63
Conversation
|
Project 3B: Tool Analysis and Integration
|
Revert "Merge pull request #63 from CMU-313/jshint-integration"
Resolves #64
Context
NodeBB already lists jshint as a devDependency but it was never configured or wired up for use. This PR completes that integration by adding the necessary configuration files and an npm script so the tool can actually be run by developers on the team. JSHint flags suspicious JavaScript patterns — catching issues like undeclared variables, accidental == instead of ===, and unused variables before they reach production.
Changes in the Codebase
package.json
Added "lint:jshint": "jshint ." to the scripts section
jshint ^2.13.6 was already present in devDependencies — no new package was needed
.jshintrc (new file)
Sets esversion: 6, node: true, browser: true for NodeBB's mixed environment
Enables undef: true, unused: true, eqeqeq: true, and curly: true for stricter code quality checks
Enforces indent: 2 and maxlen: 100
.jshintignore (new file)
Excludes node_modules/, dist/, and coverage/ from analysis
How to Run
bashnpm run lint:jshint
Output:
npm run lint:jshint > jshint-output.txt 2>&1
The existing npm run lint (ESLint) is unchanged.
Evidence of Execution
jshint-output.txt was generated by running npm run lint:jshint and is attached to this PR as proof the tool ran successfully on the repository.
See https://github.com/CMU-313/nodebb-spring-26-team-4/blob/main/jshint-output.txt for full tool output.
Assessment: Pros & Cons
Pros
Cons
Customization Notes