CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-loopback--build

A comprehensive set of build tools and configurations for LoopBack 4 and TypeScript projects providing CLI commands for compilation, linting, testing, and coverage

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

code-linting.mddocs/

Code Linting

ESLint integration with automatic configuration discovery and LoopBack-specific rules for maintaining code quality and consistency.

Capabilities

lb-eslint Command

Runs ESLint with automatic configuration discovery and default file extensions.

CLI Usage:

# Lint current directory
lb-eslint .

# Lint specific files
lb-eslint src/index.ts src/utils.ts

# Lint with fix
lb-eslint --fix .

# Report unused disable directives
lb-eslint --report-unused-disable-directives .

# Lint specific extensions
lb-eslint --ext .js,.jsx,.ts,.tsx src/

Note: ESLint functionality is only available through the lb-eslint CLI command. It is not exported as a programmatic function from the main module.

Configuration Discovery

Automatically discovers ESLint configuration files in the project.

Configuration Search Order:

  1. .eslintrc.js in project root
  2. .eslintrc.json in project root
  3. Falls back to @loopback/build/config/.eslintrc.js

Default Configuration:

// @loopback/build/config/.eslintrc.js
module.exports = {
  extends: '@loopback/eslint-config',
};

Ignore File Support

Automatically discovers and uses ESLint ignore files.

// Automatically uses .eslintignore if present in project root
// Falls back to @loopback/build/config/.eslintignore

Default Ignore Patterns:

node_modules
dist

File Extension Handling

Automatically sets default file extensions if not specified.

// Default extensions: .js,.ts
// Only applied if --ext option is not provided

Extension Examples:

# Uses default extensions (.js,.ts)
lb-eslint src/

# Custom extensions override defaults
lb-eslint --ext .js,.jsx,.ts,.tsx src/

Command Line Option Passthrough

All ESLint command line options are supported and passed through.

interface ESLintOptions {
  "--fix": boolean;                    // Automatically fix problems
  "--fix-dry-run": boolean;           // Show fixes without applying
  "--ext": string;                    // File extensions to lint
  "-c" | "--config": string;          // Configuration file path
  "--ignore-path": string;            // Ignore file path
  "--report-unused-disable-directives": boolean; // Report unused disable comments
  "--max-warnings": number;           // Maximum number of warnings allowed
  "--output-file": string;            // Output file for results
  "--format": string;                 // Output format (stylish, json, etc.)
  "--quiet": boolean;                 // Report errors only
  "--cache": boolean;                 // Enable result caching
  "--cache-location": string;         // Cache file location
}

Integration with LoopBack ESLint Config

Uses @loopback/eslint-config for consistent code style across LoopBack projects.

Features of @loopback/eslint-config:

  • TypeScript support with type-aware rules
  • Consistent formatting rules aligned with Prettier
  • Best practices for Node.js and LoopBack development
  • Import/export validation
  • Accessibility rules for web components

Usage Examples

Command Line Usage:

# Basic linting with default configuration
lb-eslint .

# Fix issues automatically
lb-eslint --fix src/

Package.json Integration:

{
  "scripts": {
    "lint": "lb-eslint --report-unused-disable-directives .",
    "lint:fix": "lb-eslint --fix .",
    "lint:check": "lb-eslint ."
  }
}

Custom Configuration:

# Use custom config file
lb-eslint -c .eslintrc.custom.js src/

# Use custom ignore file
lb-eslint --ignore-path .eslintignore.custom src/

# Lint specific file types
lb-eslint --ext .ts,.d.ts src/

Error Handling

ESLint errors are properly propagated and handled.

// Process exits with non-zero code on lint errors
// Warnings do not cause process exit unless --max-warnings is exceeded
// Configuration errors are reported with helpful messages

docs

code-coverage.md

code-formatting.md

code-linting.md

file-cleanup.md

index.md

process-management.md

test-execution.md

typescript-compilation.md

tile.json