chore: replace deprecated String.prototype.substr() (#6333)
* chore: replace deprecated String.prototype.substr() .substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com> * refactor: add prefer slice lint rule and fix errors Co-authored-by: erezrokah <erezrokah@users.noreply.github.com>
This commit is contained in:
@ -177,7 +177,9 @@ export default function slateToRemark(raw, { voidCodeBlock }) {
|
||||
const index = node.text.search(exp);
|
||||
if (index > -1) {
|
||||
const substringIndex = trailing ? index : index + 1;
|
||||
// eslint-disable-next-line unicorn/prefer-string-slice
|
||||
const firstSplit = node.text.substring(0, substringIndex);
|
||||
// eslint-disable-next-line unicorn/prefer-string-slice
|
||||
const secondSplit = node.text.substring(substringIndex);
|
||||
const whitespace = trailing ? secondSplit : firstSplit;
|
||||
const text = trailing ? firstSplit : secondSplit;
|
||||
|
Reference in New Issue
Block a user