or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli.mdconfiguration.mdcore-api.mderror-reporting.mdindex.mdrule-management.md
tile.json

cli.mddocs/

Command Line Interface

CoffeeLint provides a comprehensive command-line interface for linting CoffeeScript files and directories. The CLI supports batch processing, multiple output formats, configuration management, and integration with build systems and editors.

Basic Usage

# Lint a single file
coffeelint file.coffee

# Lint multiple files
coffeelint app.coffee utils.coffee main.coffee

# Lint directories (recursively finds .coffee files)
coffeelint src/ test/ lib/

# Lint mixed files and directories
coffeelint src/ test/spec.coffee lib/utils.coffee

Configuration Options

# Use custom configuration file
coffeelint -f coffeelint.json src/
coffeelint --file coffeelint.json src/

# Generate default configuration file
coffeelint --makeconfig > coffeelint.json

# Generate minimal configuration (non-default values only)
coffeelint --trimconfig

# Configuration must be provided via file or auto-discovery
# (there is no --configfromstdin option)

Configuration File Examples:

# Create a basic configuration file
coffeelint --makeconfig > .coffeelintrc

# Create project-specific configuration
cat > coffeelint.json << EOF
{
  "max_line_length": {
    "level": "error",
    "value": 100
  },
  "no_tabs": {
    "level": "error"
  },
  "indentation": {
    "level": "error",
    "value": 2
  }
}
EOF

# Use the configuration
coffeelint -f coffeelint.json src/

Input Sources

# Lint from standard input
cat app.coffee | coffeelint --stdin

# Read from stdin (errors reported as 'stdin')
echo 'console.log "test"' | coffeelint --stdin

# Combine stdin with file linting
cat lib.coffee | coffeelint --stdin src/ test/

Output Formats

CoffeeLint supports multiple output formats for integration with different tools and workflows:

# Default human-readable output
coffeelint src/

# CSV format for spreadsheet analysis
coffeelint --reporter csv src/

# JSLint XML format for IDE integration
coffeelint --reporter jslint src/

# Checkstyle XML format for CI/CD systems
coffeelint --reporter checkstyle src/

# Raw JSON format for programmatic processing
coffeelint --reporter raw src/

Output Format Examples:

# Default output
$ coffeelint app.coffee
app.coffee:5:1: error: Unnecessary double quotes (no_unnecessary_double_quotes)
app.coffee:8:15: warn: Line exceeds maximum allowed length (max_line_length)

# CSV output
$ coffeelint --reporter csv app.coffee
filename,lineNumber,level,message,rule
app.coffee,5,error,Unnecessary double quotes,no_unnecessary_double_quotes
app.coffee,8,warn,Line exceeds maximum allowed length,max_line_length

# JSON output for automation
$ coffeelint --reporter raw app.coffee
[
  {
    "filename": "app.coffee",
    "lineNumber": 5,
    "level": "error", 
    "message": "Unnecessary double quotes",
    "rule": "no_unnecessary_double_quotes"
  }
]

File Discovery and Processing

# Recursive directory processing (default .coffee extension)
coffeelint src/

# Include additional file extensions
coffeelint --ext coffee,litcoffee src/

# Process literate CoffeeScript files
coffeelint --literate docs/

# Exclude patterns using .coffeelintignore file
echo '**/node_modules/**' > .coffeelintignore
coffeelint src/

Exit Codes and CI/CD Integration

# Standard exit codes:
# 0 - No errors found
# 1 - Errors found
# 2 - Invalid usage or configuration

# CI/CD pipeline integration
coffeelint src/ test/
if [ $? -eq 0 ]; then
  echo "Linting passed"
else
  echo "Linting failed"
  exit 1
fi

# Git pre-commit hook
#!/bin/sh
coffeelint --reporter csv $(git diff --cached --name-only --diff-filter=ACM | grep '\.coffee$')

Advanced CLI Features

Quiet Output

# Suppress warnings, show only errors
coffeelint --quiet src/

Configuration Discovery

The CLI automatically discovers configuration in this order:

  1. Explicit -f/--file configuration file
  2. coffeelint.json in current directory or parent directories
  3. coffeelintConfig section in package.json
  4. ~/.coffeelint.json in user home directory
  5. Built-in default configuration
# Use only built-in defaults (ignore configuration files)
coffeelint --noconfig src/

Integration Examples

Build System Integration

Makefile:

lint:
	coffeelint src/ test/
	
lint-ci:
	coffeelint --reporter checkstyle src/ test/ > coffeelint-results.xml

.PHONY: lint lint-ci

npm scripts (package.json):

{
  "scripts": {
    "lint": "coffeelint src test",
    "lint:fix": "coffeelint src test --fix",
    "lint:ci": "coffeelint --reporter checkstyle src test > reports/coffeelint.xml"
  }
}

Grunt task:

grunt.loadNpmTasks('grunt-coffeelint');

grunt.initConfig({
  coffeelint: {
    app: ['src/**/*.coffee'],
    tests: ['test/**/*.coffee'],
    options: {
      configFile: 'coffeelint.json'
    }
  }
});

Editor Integration

VS Code settings.json:

{
  "coffeelint.enable": true,
  "coffeelint.configPath": "./coffeelint.json",
  "coffeelint.lintOnSave": true
}

Vim/Neovim with ALE:

let g:ale_linters = {'coffee': ['coffeelint']}
let g:ale_coffee_coffeelint_options = '-f coffeelint.json'

Error Handling and Troubleshooting

# Show version information
coffeelint --version

# Display help information
coffeelint --help

Common Issues:

# Configuration file not found
$ coffeelint -f missing.json src/
# Process continues with default configuration

# Invalid CoffeeScript syntax
$ coffeelint broken.coffee  
broken.coffee:3:1: error: unexpected INDENT

# No files found in directory
$ coffeelint empty-dir/
# No output, exit code 0

Performance Optimization

# Enable caching for improved performance
coffeelint --cache src/