Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 859 Bytes

File metadata and controls

33 lines (23 loc) · 859 Bytes

require-object-type-annotations

Rationale: https://oliverjash.me/2023/prefer-explicit-type-annotations-for-objects

For examples of correct and incorrect code with this lint rule enabled, see the tests.

Installation

npm install --save-dev eslint-plugin-require-object-type-annotations

Usage

{
  "plugins": ["require-object-type-annotations"],
  "rules": {
    "require-object-type-annotations/require-object-type-annotations": "error"
  }
}

Options

ignoreInsideFunctionCalls: a string containing a regular expression of function calls to ignore. This is useful if you want to allow anonymous object types when they are passed as arguments to specific functions.

Examples of correct code with { ignoreInsideFunctionCalls: '^foo$' }:

declare const foo: <T>(t: T) => T;
foo({ prop: 1 });