prefer-string-starts-ends-with Prefer startsWith and endsWith for string boundary tests Comparing a search index or extracted slice expresses a string boundary test through intermediate values. Instead, you SHOULD use startsWith or endsWith to state the tested boundary directly. - Category: style - Level: warning - Fix: automatic - Scope: module Reported function hasPrefix(text: string, prefix: string): boolean { return text.indexOf(prefix) === 0; } Accepted function hasPrefix(text: string, prefix: string): boolean { return text.startsWith(prefix); } Prior art - typescript-eslint · prefer-string-starts-ends-with - eslint-plugin-unicorn · prefer-string-starts-ends-with language/linter/src/rules/style/preferstringstartsendswith.rs:8