This guide will help you configure DeepLint for your project.
This is part of the Getting Started series:
Configuration (current page)
Initialization
The easiest way to configure DeepLint is to use the initialization command:
deeplint init
This command will:
Create a configuration file in your project root
Set up default configuration options
Detect whether your project is using ESM or CJS and create the appropriate file format
By default, the init command will detect your project's module format and create the appropriate configuration file:
For ESM projects (with "type": "module" in package.json): deeplint.config.js with ESM syntax
For CJS projects: deeplint.config.js or deeplint.config.cjs with CJS syntax
You can also specify the format you want to use:
deeplint init --cjs
This will create a deeplint.config.js or deeplint.config.cjs file with CommonJS syntax.
deeplint init --esm
This will create a deeplint.config.js or deeplint.config.mjs file with ECMAScript Modules syntax.
deeplint init --yaml
This will create a .deeplintrc.yml file.
deeplint init --json
This will create a .deeplintrc.json file.
Configuration File Locations
DeepLint uses cosmiconfig to find your configuration file. It will look for configuration in the following places (in order of precedence):
package.json with a "deeplint" property
.deeplintrc file (no extension) in JSON or YAML format
.deeplintrc.json, .deeplintrc.yaml, .deeplintrc.yml, .deeplintrc.js, .deeplintrc.cjs, or .deeplintrc.mjs file
deeplint.config.js, deeplint.config.cjs, deeplint.config.mjs, or deeplint.config.ts file
Any of the above in a .config subdirectory
This flexible configuration system allows you to use the format and location that best fits your project structure.
Configuration File
The configuration file contains settings for DeepLint's behavior. Here are examples for both ESM and CJS:
// For CJS projects
const { defineConfig } = require("deeplint-cli");
module.exports = defineConfig({
// Context builder configuration
contextBuilder: {
// Maximum number of tokens to use for the context
maxTokens: 8000,
// Maximum number of tokens to use per file
tokensPerFile: 1000,
// Maximum file size in KB to include in the context
maxFileSize: 500,
// Whether to include dependencies in the context
includeDependencies: true,
// Whether to include code structure in the context
includeStructure: true,
},
// File filtering configuration
files: {
// Patterns to include in the analysis
include: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
// Patterns to exclude from the analysis
exclude: ["node_modules/**", "dist/**", "build/**"],
// Whether to use .gitignore for file filtering
useGitignore: true,
},
// Git integration configuration
git: {
// Whether to include unstaged changes in the analysis
includeUnstaged: false,
},
// Logging configuration
logging: {
// Log level: "debug", "info", "success", "warn", "error", "none"
level: "info",
},
// LLM configuration
llm: {
// LLM provider to use (currently only "openai" is supported)
provider: "openai",
// API key for the provider (optional, can use OPENAI_API_KEY env var)
apiKey: "sk-...",
// Model to use (optional, can use OPENAI_MODEL env var, default: "gpt-4o")
model: "gpt-4o",
// Maximum number of tokens to use for the analysis
maxTokens: 16384,
},
// Additional files to ignore (deprecated, use files.exclude instead)
ignore: ["node_modules", "dist", "build"],
});
// For ESM projects (with "type": "module" in package.json)
import { defineConfig } from "deeplint-cli";
export default defineConfig({
// Context builder configuration
contextBuilder: {
// Maximum number of tokens to use for the context
maxTokens: 8000,
// Maximum number of tokens to use per file
tokensPerFile: 1000,
// Maximum file size in KB to include in the context
maxFileSize: 500,
// Whether to include dependencies in the context
includeDependencies: true,
// Whether to include code structure in the context
includeStructure: true,
},
// File filtering configuration
files: {
// Patterns to include in the analysis
include: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
// Patterns to exclude from the analysis
exclude: ["node_modules/**", "dist/**", "build/**"],
// Whether to use .gitignore for file filtering
useGitignore: true,
},
// Git integration configuration
git: {
// Whether to include unstaged changes in the analysis
includeUnstaged: false,
},
// Logging configuration
logging: {
// Log level: "debug", "info", "success", "warn", "error", "none"
level: "info",
},
// LLM configuration
llm: {
// LLM provider to use (currently only "openai" is supported)
provider: "openai",
// API key for the provider (optional, can use OPENAI_API_KEY env var)
apiKey: "sk-...",
// Model to use (optional, can use OPENAI_MODEL env var, default: "gpt-4o")
model: "gpt-4o",
// Maximum number of tokens to use for the analysis
maxTokens: 16384,
},
// Additional files to ignore (deprecated, use files.exclude instead)
ignore: ["node_modules", "dist", "build"],
});
# Context builder configuration
contextBuilder:
# Maximum number of tokens to use for the context
maxTokens: 8000
# Maximum number of tokens to use per file
tokensPerFile: 1000
# Maximum file size in KB to include in the context
maxFileSize: 500
# Whether to include dependencies in the context
includeDependencies: true
# Whether to include code structure in the context
includeStructure: true
# File filtering configuration
files:
# Patterns to include in the analysis
include:
- "**/*.js"
- "**/*.ts"
- "**/*.jsx"
- "**/*.tsx"
# Patterns to exclude from the analysis
exclude:
- "node_modules/**"
- "dist/**"
- "build/**"
# Whether to use .gitignore for file filtering
useGitignore: true
# Git integration configuration
git:
# Whether to include unstaged changes in the analysis
includeUnstaged: false
# Logging configuration
logging:
# Log level: debug, info, success, warn, error, none
level: info
# LLM configuration
llm:
# LLM provider to use (currently only "openai" is supported)
provider: openai
# API key for the provider (optional, can use OPENAI_API_KEY env var)
apiKey: sk-...
# Model to use (optional, can use OPENAI_MODEL env var, default: "gpt-4o")
model: gpt-4o
# Maximum number of tokens to use for the analysis
maxTokens: 16384
# Additional files to ignore (deprecated, use files.exclude instead)
ignore:
- node_modules
- dist
- build
Configuration Options
The following table shows all available configuration options and their implementation status:
Section
Status
Description
contextBuilder
✅ Implemented
Controls how DeepLint builds context for analysis
files
✅ Implemented
Controls which files are included in the analysis
git.includeUnstaged
✅ Implemented
Controls whether to include unstaged changes
logging
✅ Implemented
Controls logging behavior
llm
✅ Implemented
Controls LLM-powered analysis
ignore
⚠️ Deprecated
Use files.exclude instead
Context Builder
Configure how DeepLint builds context for analysis:
contextBuilder: {
// Maximum number of tokens to use for the context
maxTokens: 8000,
// Maximum number of tokens to use per file
tokensPerFile: 1000,
// Maximum file size in KB to include in the context
maxFileSize: 500,
// Whether to include dependencies in the context
includeDependencies: true,
// Whether to include code structure in the context
includeStructure: true,
},
File Filtering
Control which files are included in the analysis:
files: {
// Patterns to include in the analysis
include: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
// Patterns to exclude from the analysis
exclude: ["node_modules/**", "dist/**", "build/**"],
// Whether to use .gitignore for file filtering
useGitignore: true,
},
Git Integration
Configure Git integration:
git: {
// Whether to include unstaged changes in the analysis
includeUnstaged: false,
},
llm: {
// LLM provider (currently only "openai" is supported)
provider: "openai",
// API key for the provider (optional, can use OPENAI_API_KEY env var)
apiKey: "sk-...",
// Model to use (optional, can use OPENAI_MODEL env var, default: "gpt-4o")
model: "gpt-4o",
// Maximum number of tokens to use for the analysis
maxTokens: 16384,
},
LLM options can also be set via CLI flags or environment variables:
DeepLint validates your configuration when it loads it. If there are any issues with your configuration, DeepLint will:
Log warnings about invalid configuration options
Apply default values to fix invalid values
Continue with the corrected configuration
For example, if you specify an invalid value for contextBuilder.maxTokens:
contextBuilder: {
maxTokens: "not a number", // Invalid: should be a number
}
DeepLint will log a warning and use the default value:
WARN: Configuration validation failed with 1 errors:
- contextBuilder.maxTokens: Value must be a number.
INFO: Applying defaults to fix invalid values...
Validation Rules
Here are some key validation rules:
contextBuilder.maxTokens: Must be a number between 1,000 and 100,000
contextBuilder.tokensPerFile: Must be a number between 100 and 10,000
contextBuilder.maxFileSize: Must be a number between 1 and 10,000
contextBuilder.includeDependencies: Must be a boolean
contextBuilder.includeStructure: Must be a boolean
files.include and files.exclude: Must be arrays of strings
git.includeUnstaged: Must be a boolean
Related Resources
Developer Note: The configuration system uses a schema-based validation approach with automatic defaults. If a configuration option is invalid, DeepLint will apply a sensible default value and continue running.
Next Steps
Now that you've configured DeepLint, you can:
Note: For planned features such as custom rules, auto-fixes, and advanced hooks, see the .
For more details on context building, see .
For more details on Git integration, see .
For a full list of options and details, see the .
Configuration file (searched in the order listed in )
For a complete list of validation rules, see the documentation.
- Learn how context building works
- Technical details of the configuration system
- Command line options that override configuration