tessl install tessl/npm-eslint-config-node@3.0.0Pluggable ESLint configuration for Node.js that extends ESNext with Node.js-specific safety checks and best practices
Agent Success
Agent success rate when using this tile
73%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.12x
Baseline
Agent success rate without this tile
65%
Create a tool that validates JavaScript files for legacy patterns that violate modern ESNext standards.
Build a code validator that analyzes JavaScript files and reports violations of modern JavaScript best practices. The validator should detect legacy patterns including: var declarations, non-arrow callback functions, direct arguments usage, and unsafe practices like eval() or with statements.
The tool accepts a file path, analyzes the code, and returns a structured violation report.
filePath (string): Path to the JavaScript file to validateoptions (object, optional): Configuration for which checks to enable
checkVarUsage (boolean): Check for var usage (default: true)checkCallbacks (boolean): Check for non-arrow callbacks (default: true)checkArguments (boolean): Check for arguments usage (default: true)checkUnsafe (boolean): Check for unsafe practices (default: true)A validation report object with:
filePath (string): The analyzed file pathviolations (array): List of violation objects, each containing:
type (string): Violation category - one of: "var-usage", "arguments-usage", "non-arrow-callback", "unsafe-practice"line (number): Line number of the violationmessage (string): Human-readable descriptionYour validator should detect:
Variable Declaration Issues
var keyword (should use let or const)Function Syntax Issues
arguments object (should use rest parameters)Unsafe Practices
eval()with statementsvar x = 5;, the report includes a violation with type "var-usage" @testfunction callback() {} passed to array methods like map, the report includes a violation with type "non-arrow-callback" @testarguments usage in a function, the report includes a violation with type "arguments-usage" @testeval(), the report includes a violation with type "unsafe-practice" @test@generates
/**
* Validates a JavaScript file for legacy patterns
* @param {string} filePath - Path to the JavaScript file to validate
* @param {Object} options - Optional configuration
* @param {boolean} options.checkVarUsage - Check for var usage (default: true)
* @param {boolean} options.checkCallbacks - Check for non-arrow callbacks (default: true)
* @param {boolean} options.checkArguments - Check for arguments usage (default: true)
* @param {boolean} options.checkUnsafe - Check for unsafe practices (default: true)
* @returns {Promise<Object>} Validation report with filePath and violations array
*/
async function validateFile(filePath, options = {}) {
// Implementation
}
module.exports = { validateFile };Provides JavaScript linting capabilities and AST parsing for code analysis.
Provides opinionated ESLint configuration for modern JavaScript (ESNext) with rules that enforce modern patterns like const/let over var, arrow functions for callbacks, rest parameters over arguments, and safety rules against eval and with statements.