Skip to main content

init-declarations

Require or disallow initialization in variable declarations.

Examples

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

Options

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

See eslint/init-declarations options.

How to Use

Resources

Taken with ❤️ from ESLint core