Skip to content

Commit e5f667e

Browse files
committed
fix(unicorn): Disable autofix for prefer-string-slice rule
Works too carefully impairing readability
1 parent 48c9139 commit e5f667e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

languages/js/plugins/unicorn.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ module.exports = {
361361

362362
// Prefer `String#slice()` over `String#substr()` and `String#substring()` (partly autofixable)
363363
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-slice.md
364-
'+unicorn/prefer-string-slice': 'error',
364+
// Note: Autofix works strange replacing `s.substring(0, start)` to `s.slice(0, Math.max(0, start))` that impairs readability
365+
'!unicorn/prefer-string-slice': 'error',
365366

366367
// Prefer `String#startsWith()` && `String#endsWith()` over `RegExp#test()` (partly autofixable)
367368
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-starts-ends-with.md

0 commit comments

Comments
 (0)