eslint-plugin-no-array-any
What is this?
This is a rule that disallows declaring arrays and objects that do not have a type. For example:
const myArray = [];
const myArray: string[] = [];
const myMap = new Map();
const myMap = new Map<string, string>();
This is useful because the noImplicitAny
TypeScript compiler flag does not catch this pattern. Declaring objects without the type can make code harder to read, especially if the array/object is instantiated far away from where it is mutated.
How do I use it?
npm install --save-dev eslint-plugin-no-array-any
- Add
"plugin:no-array-any/recommended"
to the extends
section of your .eslintrc.js
file.
What rules does this plugin provide?
It only provides one rule: "no-array-any/no-array-any"