CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-eslint-config-node

tessl install tessl/npm-eslint-config-node@3.0.0

Pluggable 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%

task.mdevals/scenario-6/

Node.js Code Quality Checker

Build a command-line tool that analyzes Node.js source files for common code quality issues and provides feedback to developers.

Requirements

Your tool should:

  1. Accept a file path as a command-line argument
  2. Read and parse the JavaScript file
  3. Check for the following issues:
    • String concatenation with __dirname or __filename
    • Direct usage of process.exit()
    • Synchronous file system operations (methods ending with Sync)
  4. Output a clear report listing any issues found, including line numbers
  5. Exit with code 0 if no issues found, or code 1 if issues are detected

Example Usage

node checker.js ./sample.js

Example Output

Issues found in ./sample.js:

Line 5: Avoid string concatenation with __dirname or __filename
Line 12: Avoid calling process.exit() directly
Line 18: Synchronous method detected (readFileSync)

Total issues: 3

Test Cases

  • When analyzing a file with var path = __dirname + '/config.json', it detects the string concatenation issue @test
  • When analyzing a file with process.exit(1), it detects the direct process.exit usage @test
  • When analyzing a file with fs.readFileSync('data.txt'), it detects the synchronous method @test
  • When analyzing a clean file with no issues, it reports 0 issues and exits with code 0 @test

Implementation

@generates

API

/**
 * Analyzes a JavaScript file for Node.js code quality issues
 * @param {string} filePath - Path to the file to analyze
 * @returns {object} Analysis result with issues array
 */
function analyzeFile(filePath) {
  // Returns: { issues: [{line, message}], count }
}

/**
 * Formats and prints the analysis report
 * @param {string} filePath - The analyzed file path
 * @param {object} result - Analysis result from analyzeFile
 */
function printReport(filePath, result) {
  // Prints formatted report
}

module.exports = { analyzeFile, printReport };

Dependencies { .dependencies }

eslint { .dependency }

Provides code analysis and linting capabilities for JavaScript.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/eslint-config-node@3.0.x
tile.json