01
Konfiguration
Flat Config
ESLint 9+ verwendet das Flat-Config-Format.
eslint
// eslint.config.js
export default [
{ rules: { "no-unused-vars": "error" } },
{ ignores: ["dist/**"] },
];Regeln
Regelstufen: off, warn, error.
eslint
{
"semi": ["error", "always"],
"quotes": ["error", "double"],
"no-console": "warn",
"eqeqeq": "error"
}extends
Empfohlene Konfigurationen erweitern.
eslint
export default [
...js.configs.recommended,
...ts.configs.recommended,
];02
Verwendung
CLI
Linten und Auto-Fix über die CLI.
eslint
# npx eslint .
# npx eslint --fix
# npx eslint src/**/*.tsInline
Regeln inline deaktivieren.
eslint
// eslint-disable-next-line no-console
console.log("debug");
/* eslint-disable no-console */Was this helpful?