Replace indexOf with includes (#6967)

* Replace `indexOf` with `includes`

* Add `unicorn/prefer-includes`
This commit is contained in:
fisker Cheung authored and Simon Lydell committed 2019-11-17 11:06:14 +01:00
1 parent 93c63fde18
commit 57f0dd56dd
27 files changed
+242 -77

No files matched your search

+2 -2
View File
@@ -118,7 +118,7 @@ function genericPrint(path, options, print) {
const rawText = node.raws.text || node.text;
// Workaround a bug where the location is off.
// https://github.com/postcss/postcss-scss/issues/63
if (text.indexOf(rawText) === -1) {
if (!text.includes(rawText)) {
if (node.raws.inline) {
return concat(["// ", rawText]);
}
@@ -512,7 +512,7 @@ function genericPrint(path, options, print) {
// Ignore escape `\`
if (
iNode.value &&
iNode.value.indexOf("\\") !== -1 &&
iNode.value.includes("\\") &&
iNextNode &&
iNextNode.type !== "value-comment"
) {