complete/no-string-length-0
💼 This rule is enabled in the ✅ recommended config.
📝 Disallows checking for empty strings via the length method in favor of direct comparison to an empty string.
💭 This rule requires type information.
This is helpful since the latter is shorter and easier to read.
Rule Details
Section titled “Rule Details”// Baddeclare const foo: string;if (foo.length === 0) {}
// Gooddeclare const foo: string;if (foo === "") {}Options
Section titled “Options”This rule is not configurable.
