Linting Basics
Pickier’s linter is opinionated but lightweight. It focuses on practical checks and provides a plugin surface for additional rules.
Core checks
noDebugger(configurable severity): flagsdebuggerstatements and auto-fixes them when--fixis usednoConsole(configurable severity): flagsconsole.*usage- Quote preference diagnostics (TS/JS): warns when string quotes do not match
format.quotes - Indentation diagnostics (TS/JS): warns when indentation is not a multiple of
format.indentor when tabs are used
Optional heuristics via rules:
noCondAssign: flags assignments in the conditional segment ofif,while, andforstatementsnoTemplateCurlyInString: flags template literal syntax (${...}) in regular stringsnoUnusedCapturingGroup: flags regex literals with capturing groups that are not referenced (heuristic)
Built-in plugin rules
Enable via pluginRules in your config. See the Rules pages for details and examples:
sort-objects: object literal key ordering checkssort-imports: flags when the import block would be changed by the formattersort-named-imports: named specifiers within a single import statement must be sortedsort-heritage-clauses: sorts TypeScriptextends/implementssort-keys: ESLint-like object key sort checksort-exports: sorts contiguous export groupsmax-statements-per-line: enforces at most N statements per lineno-unused-vars: detects declared but unused variables/parameters (with ignore patterns)no-super-linear-backtracking: flags regex patterns that may catastrophically backtrack
See Advanced » Plugin System for options.
Inline disables
You can suppress issues for the next line using either ESLint-style or Pickier-style prefixes:
// eslint-disable-next-line no-console, quotes
console.log("x")
// pickier-disable-next-line sort-objects
const obj = { b: 1, a: 2 }
// eslint-disable-next-line pickier/sort-objects
const obj2 = { y: 1, x: 2 }
// pickier-disable-next-line ts/no-require-imports
const fs = require('node:fs')Notes:
- When no rule list is provided, all rules for the next line are suppressed.
- Rule matching accepts both prefixed and bare IDs (e.g.,
sort-objectsorpickier/sort-objects). - Block comment form is also supported on a single line:
/* eslint-disable-next-line no-console */.
CLI usage
# scan with stylish reporter (default)
pickier lint .
# auto-fix (removes debugger statements); then re-check issues
pickier lint src --fix
# simulate fixes without writing (logs a message per changed file when verbose)
pickier lint . --fix --dry-run --verbose
# fail when any warning is present
pickier lint . --max-warnings 0
# JSON reporter for CI
pickier lint . --reporter json > lint.json
# compact reporter (one-line per issue)
pickier lint . --reporter compactReporters
stylish(default): grouped by file with colored severitiesjson: machine-readable object witherrors,warnings, andissuescompact: single line per issue (path:line:col severity rule message)
Stylish example
src/index.ts
error 12:3 no-debugger Unexpected debugger statement.
warn 18:5 no-console Unexpected console usage.Configuration
Excerpt:
import type { PickierConfig } from 'pickier'
export default {
rules: {
noDebugger: 'error',
noConsole: 'warn',
// noCondAssign: 'warn',
// noUnusedCapturingGroup: 'off',
},
pluginRules: {
'pickier/no-unused-vars': ['error', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
'style/max-statements-per-line': ['warn', { max: 1 }],
},
} satisfies PickierConfigExamples
noDebugger with --fix
Before:
function load() {
debugger
return 42
}After pickier lint . --fix:
function load() {
return 42
}Quote and indent diagnostics
Given quotes: 'single' and indent: 2, the linter will warn on lines like:
const a = "hello" // prefer single quotes
doThing() // tabs not allowed; indent must be multiple of 2 spacesBest practices
- Start with
reporter: stylishlocally andreporter: compactin CI - Set
--max-warnings 0in CI to keep the bar high, while tuning rule severities in your config - Use
_prefixes (or project-specific patterns) withpickier/no-unused-varsto allow intentionally unused names - Pair the linter with the formatter so code style is both enforced and auto-corrected where safe
Troubleshooting
- “Why did a variable get flagged unused?” — ensure it’s referenced beyond its declaration; destructuring keys also count as names
- “Regex flagged for backtracking” — simplify overlapping
.*/.+constructs or add anchors/limits