prefer-string-slice Prefer String.slice over the legacy String.substring operation String.substring swaps reversed bounds and clamps negative bounds, which differs from collection slicing. Instead, you SHOULD use String.slice for the same start-inclusive, end-exclusive convention as arrays. Review negative or dynamically ordered bounds because slice preserves their direction and interprets negative values from the end. - Category: style - Level: warning - Fix: suggestion - Scope: module Reported function prefix(text: string, end: isize): string { return text.substring(0, end); } Accepted function prefix(text: string, end: isize): string { return text.slice(0, end); } Prior art - eslint-plugin-unicorn ยท prefer-string-slice language/linter/src/rules/style/preferstringslice.rs:8