Skip to main content

init-declarations

Require or disallow initialization in variable declarations.

Attributes

  • Included in configs
    • ✅ Recommended
    • 🔒 Strict
  • Fixable
    • 🔧 Automated Fixer
    • 💡 Suggestion Fixer
  • 💭 Requires type information

Rule Details

This rule extends the base eslint/init-declarations rule. It adds support for TypeScript's declare variables.

How to Use

.eslintrc.cjs
module.exports = {
// Note: you must disable the base rule as it can report incorrect errors
"init-declarations": "off",
"@typescript-eslint/init-declarations": "warn"
};

Options

See eslint/init-declarations options.

Taken with ❤️ from ESLint core

Resources