All Options
This document provides a comprehensive reference for configuring DeepLint, including all available configuration options, their default values, and usage examples.
Configuration File
DeepLint can be configured using a configuration file. By default, DeepLint looks for the following files in the current directory:
deeplint.config.js
(JavaScript).deeplintrc.js
(JavaScript).deeplintrc.json
(JSON).deeplintrc.yml
(YAML).deeplintrc.yaml
(YAML)
You can also specify a custom configuration file using the --config
option:
deeplint --config=custom.config.js
Configuration Format
JavaScript Format
// deeplint.config.js
module.exports = {
contextBuilder: {
contextType: "light",
maxTokens: 8000,
tokensPerFile: 1000,
maxFileSize: 500,
includeDependencies: false,
includeStructure: true,
},
files: {
include: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
exclude: ["node_modules/**", "dist/**", "build/**"],
useGitignore: true,
},
git: {
includeUnstaged: false,
},
logging: {
level: "info",
},
llm: {
provider: "openai",
apiKey: "sk-...", // Optional, can use OPENAI_API_KEY env var
model: "gpt-4o", // Optional, can use OPENAI_MODEL env var
maxTokens: 16384,
temperature: 0, // Optional, controls randomness (0-1)
instructions: "Focus on security issues and performance optimizations", // Optional
},
};
YAML Format
# .deeplintrc.yml
contextBuilder:
contextType: light
maxTokens: 8000
tokensPerFile: 1000
maxFileSize: 500
includeDependencies: false
includeStructure: true
files:
include:
- "**/*.js"
- "**/*.ts"
- "**/*.jsx"
- "**/*.tsx"
exclude:
- "node_modules/**"
- "dist/**"
- "build/**"
useGitignore: true
git:
includeUnstaged: false
logging:
level: info
llm:
provider: openai
apiKey: sk-... # Optional, can use OPENAI_API_KEY env var
model: gpt-4o # Optional, can use OPENAI_MODEL env var
maxTokens: 16384
temperature: 0 # Optional, controls randomness (0-1)
instructions: Focus on security issues and performance optimizations # Optional
Configuration Options
Context Builder Options
The contextBuilder
section configures how DeepLint builds context for analysis.
contextType
string
"light"
Context depth ("light"
or "deep"
)
maxTokens
number
8000
Maximum tokens for the entire context
tokensPerFile
number
1000
Maximum tokens per file
maxFileSize
number
500
Maximum file size in KB
includeDependencies
boolean
false
Whether to include dependencies in the context
includeStructure
boolean
true
Whether to include code structure in the context
includeComments
boolean
true
Whether to include comments in the context
Example
contextBuilder: {
contextType: "deep",
maxTokens: 16000,
tokensPerFile: 2000,
maxFileSize: 1000,
includeDependencies: true,
includeStructure: true,
includeComments: true,
}
Git Options
The git
section configures how DeepLint interacts with Git.
includeUnstaged
boolean
false
Whether to include unstaged changes
hooks.preCommit
boolean
false
Whether to enable the pre-commit hook
Example
git: {
includeUnstaged: true,
hooks: {
preCommit: true,
},
}
LLM Options
The llm
section configures how DeepLint performs LLM-powered analysis.
provider
string
"openai"
LLM provider (currently only "openai")
apiKey
string
(none)
API key for the provider
model
string
"gpt-4o"
LLM model to use
maxTokens
number
16384
Maximum tokens for analysis
temperature
number
0
Temperature for the LLM (0-1), controls randomness
instructions
string
(none)
Additional instructions for the LLM
Example
llm: {
provider: "openai",
apiKey: "sk-...",
model: "gpt-4o",
maxTokens: 16384,
temperature: 0.7,
instructions: "Focus on security issues and performance optimizations",
}
See the Configuration Guide for full details, including LLM options, precedence, and environment variables.
Rules Options
The rules
section configures how DeepLint applies rules and policies.
severity
string
"warning"
Default severity level ("error"
, "warning"
, "info"
)
policies
string[]
[]
Natural language policies to enforce
Example
rules: {
severity: "error",
policies: [
"Ensure all functions have proper error handling",
"Follow the repository's naming conventions",
"Avoid using any type in TypeScript",
"Ensure all API endpoints have proper validation",
],
}
Output Options
The output
section configures how DeepLint formats and displays output.
format
string
"text"
Output format ("text"
, "json"
)
colorize
boolean
true
Whether to colorize the output
verbose
boolean
false
Whether to enable verbose output
Example
output: {
format: "json",
colorize: false,
verbose: true,
}
Environment Variables
DeepLint also supports configuration through environment variables. Environment variables take precedence over configuration file values.
OPENAI_API_KEY
OpenAI API key
OPENAI_API_KEY=sk-...
OPENAI_MODEL
Default model for OpenAI
OPENAI_MODEL=gpt-4o
LOG_LEVEL
Set the logging level
LOG_LEVEL=debug
DEBUG
Enable debug mode
DEBUG=true
Configuration Methods
DeepLint uses a cascading configuration system, where values are resolved in the following order (highest precedence first):
Command-line options
Environment variables
Configuration file
Default values
LLM options follow this same precedence. See the Configuration Guide for more.
TypeScript Configuration
If you're using TypeScript, you can use the defineConfig
helper to get type checking for your configuration:
// deeplint.config.ts
import { defineConfig } from "deeplint";
export default defineConfig({
contextBuilder: {
contextType: "light",
maxTokens: 8000,
},
// Other options...
});
Configuration Examples
Minimal Configuration
// deeplint.config.js
module.exports = {
// Use all defaults
};
Development Configuration
// deeplint.config.js
module.exports = {
contextBuilder: {
contextType: "light",
maxTokens: 8000,
},
git: {
includeUnstaged: true,
},
output: {
verbose: true,
},
};
Production Configuration
// deeplint.config.js
module.exports = {
contextBuilder: {
contextType: "deep",
maxTokens: 16000,
includeDependencies: true,
},
git: {
hooks: {
preCommit: true,
},
},
rules: {
severity: "error",
policies: [
"Ensure all functions have proper error handling",
"Follow the repository's naming conventions",
],
},
};
Custom Rules Configuration
// deeplint.config.js
module.exports = {
rules: {
severity: "warning",
policies: [
"Ensure all functions have proper error handling",
"Follow the repository's naming conventions",
"Avoid using any type in TypeScript",
"Ensure all API endpoints have proper validation",
"Use async/await instead of raw promises",
"Avoid deeply nested conditionals",
"Keep functions small and focused",
"Use descriptive variable names",
],
},
};
Extending Configurations
You can extend existing configurations using the extends
property:
// deeplint.config.js
module.exports = {
extends: "./base.config.js",
contextBuilder: {
maxTokens: 16000, // Override the base configuration
},
};
Configuration Validation
DeepLint validates your configuration when it starts. If there are any errors, DeepLint will display an error message and exit.
Common validation errors include:
Invalid option values
Unknown options
Type mismatches
Missing required options
Related Documentation
Last updated