Type Aware Rules
Some of the strongest TypeScript lint rules require type information — they need to resolve what a value actually is at runtime, not just what its local syntax looks like. Opt into type-aware linting by pointing at your tsconfig.json:
import pleaseai from '@pleaseai/eslint-config'
export default pleaseai({
typescript: {
tsconfigPath: 'tsconfig.json',
},
})Config Composer
pleaseai() returns a FlatConfigComposer, so you can fluently override, prepend, remove, or rename named config blocks when the plain options object isn’t granular enough:
import pleaseai from '@pleaseai/eslint-config'
export default pleaseai()
.prepend(
// flat configs before the main PleaseAI config
)
.override('antfu/stylistic/rules', {
rules: {
'style/generator-star-spacing': ['error', { after: true, before: false }],
},
})
.renamePlugins({
'old-prefix': 'new-prefix',
})
.remove('antfu/stylistic')Reach for this API when:
- You want to remove a named config block entirely
- You need to rename a plugin prefix without writing a custom config
- You want to override rules inside a specific named block (more surgical than the top-level
overrides)
command Codemods
@pleaseai/eslint-config ships eslint-plugin-command — an on-demand micro-codemod system triggered by triple-slash comments. It’s not a typical lint rule; you explicitly opt in per-site.
Built-in triggers include:
/// to-function— arrow function →functiondeclaration/// to-arrow—functiondeclaration → arrow function/// to-for-each—forloop →.forEach()/// to-for-of—.forEach()→for-of/// keep-sorted— sort the next object/array/interface
See the plugin docs for the full catalogue.
Usage — place the trigger one line above the code:
/// to-function
const greet = async (name: string): Promise<void> => {
console.log(`Hello, ${name}`)
}After eslint --fix:
async function greet(name: string): Promise<void> {
console.log(`Hello, ${name}`)
}The trigger comment is one-off — it’s removed along with the transformation.
Anti-slop Rules
antislop turns on rules from eslint-plugin-slop and a curated subset of eslint-plugin-sonarjs through @antfu/eslint-config’s antislop option. Both plugins are optional peer dependencies:
bun add -D eslint-plugin-slop eslint-plugin-sonarjsWhen you leave antislop unset, each plugin’s rules turn on if that plugin is installed. Upgrading without the plugins changes nothing, and please-style installs both for new projects.
antislop: true requires both plugins. An object requires each plugin it turns on explicitly (slop: true or slop: { ... }; a numeric cognitiveComplexity turns on sonarjs), and a plugin it does not mention follows what is installed. An object that ends up turning on neither plugin leaves antislop off. A missing required plugin throws: `antislop` requires `eslint-plugin-sonarjs`. Install with `bun add -D eslint-plugin-sonarjs`, or set `antislop: false`. Turn off one part with { sonarjs: false } or { slop: false }, or everything with false.
import pleaseai from '@pleaseai/eslint-config'
export default pleaseai({
antislop: { cognitiveComplexity: 20 },
})cognitiveComplexitysets thesonarjs/cognitive-complexitythreshold (default 15).falsedisables it.slop: { cwd, inspection }sets which changes thesloprules report: the whole file, uncommitted lines, or lines from recent commits.inspectionis'full'(default),'uncommitted'or'recent-changes'. Keep'full'in CI: the other modes depend on git state (shallow clones, clean checkouts) and give different results locally and in CI.slop/no-em-dashis a warning in Markdown files and an error elsewhere. It has no autofix.- On non-JS files (CSS, HTML, Vue, JSON, YAML, TOML, Markdown, and so on), the rule runs only where another config already parses them. Enabling
antislopnever makes ESLint lint new file types, so you get no parsing errors on CSS or HTML.
When this repository first turned antislop on, it reported 193 findings: 174 slop/no-em-dash (136 in Markdown), 8 sonarjs/cognitive-complexity, 7 slop/prefer-jsdoc (autofixable), 3 slop/max-comment-length and 1 slop/no-trivial-functions. They are fixed, and this repository now lints itself with antislop on. See issue #76 for the measurements.
Quality Rules
quality: true turns on 12 quality/* rules from anti-slop, vendored through @nkzw/oxlint-config. They flag low-evidence typing and code patterns: a known value widened to unknown and asserted back, chained type assertions, unknown returns and type aliases, unsafe dictionary value types, object parameters, adjacent filter/map passes, reducer accumulator copies, Reflect.get / Reflect.apply, and conditional empty-object spreads. The option is off by default and needs no extra packages.
import pleaseai from '@pleaseai/eslint-config'
export default pleaseai({
quality: true,
rules: {
'quality/no-object-parameters': 'off',
},
})- Every rule is an error on JS and TS files. Code blocks in Markdown are skipped.
no-object-parametersandno-unknown-returnsare the most opinionated. Turn them off inrulesif they do not fit your code.quality/no-chained-type-assertionsreports the same code asslop/no-chained-type-assertionsfromantislop. If both are on, turn one off.- None of the rules has an autofix.
When quality: true was first turned on, this repository reported 29 findings: 13 no-known-value-widening, 10 no-array-filter-map, 3 no-unsafe-dictionary-type, 2 no-conditional-empty-object-spread and 1 no-unknown-returns. A larger private monorepo (2,669 files) reports 4,396 findings in 1,172 files, 61% of them in tests. The most frequent are no-chained-type-assertions (1,282), no-unsafe-dictionary-type (1,240), no-known-value-widening (745) and no-conditional-empty-object-spread (658). That volume is why the option is off by default. The findings in this repository are fixed, and it now lints itself with quality: true. See issue #77.
Strict Rules
strict: true turns on rules adopted from cloudflare/oxlint-config that need no type information. The option is off by default.
import pleaseai from '@pleaseai/eslint-config'
export default pleaseai({
strict: true,
rules: {
'unicorn/prefer-set-has': 'off',
},
})no-promise-executor-returnreports a value returned from a Promise executor function.eqeqeqis set to'always'instead of antfu’s'smart', sovalue == nullis reported too.unicorn/prefer-set-hasreports an array that you only use for membership checks and could be aSet.ts/no-confusing-non-null-assertionreports a non-null assertion that reads like part of an equality or assignment operator, such asa! == b. WithcanonicalPluginNamesit is@typescript-eslint/no-confusing-non-null-assertion.import/no-self-importreports a module that imports itself.- Every rule is an error on JS and TS files. Code blocks in Markdown are skipped.
- A rule is skipped when its plugin is off:
ts/*whentypescriptisfalse,unicorn/*whenunicornisfalse, andimport/no-self-importwhenimportsisfalse. - In the default mode,
import/no-self-importcomes fromeslint-plugin-import-x. WithcanonicalPluginNames, the rule comes fromeslint-plugin-import. In both modes,eslint-import-resolver-typescriptresolves TypeScript sources.eslint-plugin-import-xandeslint-import-resolver-typescriptare regular dependencies that the config loads only whenstrictis on, whilecanonicalPluginNamesstill needs the optional peereslint-plugin-importinstalled (bun add -D eslint-plugin-import). In either mode the rule catches extensionless specifiers,.jsspecifiers that point at a.tsfile, and tsconfigpathsaliases. The resolver findstsconfig.jsonfrom the directory where you run ESLint. If any of your configs sets a resolver the active import plugin reads (import-x/resolver-next,import-x/resolver,import-x/resolver-legacyorimport-x/resolveby default;import/resolverwithcanonicalPluginNames), the strict resolver is dropped for every file and your resolver decides how imports resolve. - Turn a single rule off in
rules, as in the example above. Yourrulesand your own configs win overstrict. eqeqeqhas no autofix for== null. Rewrite it by hand asx === null || x === undefined, or as a single check when only one of the two can reach it.
When strict: true was first turned on, this repository reported 88 findings in 18 files: 86 eqeqeq (mostly == null and != null) and 2 unicorn/prefer-set-has. The other rules reported nothing, apart from one import/no-self-import on a test fixture that imports itself on purpose, which eslint.config.ts excludes from linting. The findings are fixed, and this repository now lints itself with strict: true. See issue #96.
Plugins Renaming
@pleaseai/eslint-config inherits @antfu/eslint-config’s plugin renaming for a shorter, consistent DX:
| New prefix | Original prefix | Source plugin |
|---|---|---|
import/* |
import-lite/* |
eslint-plugin-import-lite |
node/* |
n/* |
eslint-plugin-n |
yaml/* |
yml/* |
eslint-plugin-yml |
ts/* |
@typescript-eslint/* |
@typescript-eslint/eslint-plugin |
style/* |
@stylistic/* |
@stylistic/eslint-plugin |
test/* |
vitest/* |
@vitest/eslint-plugin |
So when you override a rule, use the new prefix:
import pleaseai from '@pleaseai/eslint-config'
export default pleaseai({
rules: {
'ts/consistent-type-definitions': ['error', 'interface'],
'style/max-statements-per-line': ['error', { max: 2 }],
},
})View Enabled Rules
Use @eslint/config-inspector to visualise the fully-resolved config in a browser — every enabled rule, every plugin, every file glob:
npx @eslint/config-inspectorIt opens a local server showing the flat config graph. Indispensable when you’re debugging “why is this rule firing” or “which preset added this”.
Re-exports
Every export from @antfu/eslint-config is re-exported, so you can import fine-grained configs directly when you want to compose them by hand instead of using the pleaseai() factory:
import { combine, javascript, typescript, vue } from '@pleaseai/eslint-config'
export default combine(
javascript(),
typescript(),
vue(),
)Versioning Policy
@pleaseai/eslint-config follows Semantic Versioning, but because it’s an opinionated style preset with many moving parts, rule changes are not treated as breaking changes.
Breaking (major bump)
- Node.js version requirement changes
- Large refactors that may break downstream configs
- Major plugin upgrades that may break existing rules
- Changes that likely affect most codebases
Non-breaking (minor/patch)
- Enabling or disabling individual rules (even if stricter)
- Changing rule options
- Dependency version bumps
If a rule tightening breaks your build, pin to the previous minor version and open an issue so we can discuss the trade-off.