Enable unicorn/no-negated-array-predicate rule (#19369)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
996340794f
commit
bd3fd72f44
6 files changed
+13
-12
No files matched your search
@@ -324,7 +324,6 @@ const configs = [
|
|||||||
"unicorn/no-unreadable-object-destructuring": "off",
|
"unicorn/no-unreadable-object-destructuring": "off",
|
||||||
"unicorn/no-unreadable-new-expression": "off",
|
"unicorn/no-unreadable-new-expression": "off",
|
||||||
"unicorn/prefer-unicode-code-point-escapes": "off",
|
"unicorn/prefer-unicode-code-point-escapes": "off",
|
||||||
"unicorn/no-negated-array-predicate": "off",
|
|
||||||
"unicorn/no-break-in-nested-loop": "off",
|
"unicorn/no-break-in-nested-loop": "off",
|
||||||
"unicorn/prefer-early-return": "off",
|
"unicorn/prefer-early-return": "off",
|
||||||
"unicorn/no-undeclared-class-members": "off",
|
"unicorn/no-undeclared-class-members": "off",
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ async function* checkDirectory(directory) {
|
|||||||
ok:
|
ok:
|
||||||
directory === FORMAT_TEST_DIRECTORY ||
|
directory === FORMAT_TEST_DIRECTORY ||
|
||||||
files.some((file) => file.name === ".not-test-directory") ||
|
files.some((file) => file.name === ".not-test-directory") ||
|
||||||
!files.some(
|
files.every(
|
||||||
(file) => file.isFile() && file.name !== TEST_SCRIPT_FILE_NAME,
|
(file) => !(file.isFile() && file.name !== TEST_SCRIPT_FILE_NAME),
|
||||||
) ||
|
) ||
|
||||||
files.some(
|
files.some(
|
||||||
(file) => file.isFile() && file.name === TEST_SCRIPT_FILE_NAME,
|
(file) => file.isFile() && file.name === TEST_SCRIPT_FILE_NAME,
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ function isValidHookCallbackAndDepsFormat(args, baseIndex) {
|
|||||||
getFunctionParameters(maybeArrowFunction).length === 0 &&
|
getFunctionParameters(maybeArrowFunction).length === 0 &&
|
||||||
maybeArrowFunction.body.type === "BlockStatement" &&
|
maybeArrowFunction.body.type === "BlockStatement" &&
|
||||||
maybeDepsArray.type === "ArrayExpression" &&
|
maybeDepsArray.type === "ArrayExpression" &&
|
||||||
!args.some((arg) => hasComment(arg))
|
args.every((arg) => !hasComment(arg))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ function printMemberChain(path, options, print) {
|
|||||||
if (
|
if (
|
||||||
groups.length <= cutoff &&
|
groups.length <= cutoff &&
|
||||||
!nodeHasComment &&
|
!nodeHasComment &&
|
||||||
!groups.some((g) => g.at(-1).hasTrailingEmptyLine)
|
groups.every((g) => !g.at(-1).hasTrailingEmptyLine)
|
||||||
) {
|
) {
|
||||||
if (isLongCurriedCallExpression(path)) {
|
if (isLongCurriedCallExpression(path)) {
|
||||||
return oneLine;
|
return oneLine;
|
||||||
@@ -396,8 +396,8 @@ function printMemberChain(path, options, print) {
|
|||||||
if (
|
if (
|
||||||
nodeHasComment ||
|
nodeHasComment ||
|
||||||
(callExpressions.length > 2 &&
|
(callExpressions.length > 2 &&
|
||||||
callExpressions.some(
|
callExpressions.some((expr) =>
|
||||||
(expr) => !expr.arguments.every((arg) => isSimpleCallArgument(arg)),
|
expr.arguments.some((arg) => !isSimpleCallArgument(arg)),
|
||||||
)) ||
|
)) ||
|
||||||
printedGroups.slice(0, -1).some(willBreak) ||
|
printedGroups.slice(0, -1).some(willBreak) ||
|
||||||
lastGroupWillBreakAndOtherCallsHaveFunctionArguments()
|
lastGroupWillBreakAndOtherCallsHaveFunctionArguments()
|
||||||
|
|||||||
@@ -91,11 +91,13 @@ function validateImportExport(ast, type) {
|
|||||||
|
|
||||||
// https://github.com/mdx-js/mdx/blob/3430138958c9c0344ecad9d59e0d6b5d72bedae3/packages/remark-mdx/extract-imports-and-exports.js#L16
|
// https://github.com/mdx-js/mdx/blob/3430138958c9c0344ecad9d59e0d6b5d72bedae3/packages/remark-mdx/extract-imports-and-exports.js#L16
|
||||||
if (
|
if (
|
||||||
!body.every(
|
body.some(
|
||||||
(node) =>
|
(node) =>
|
||||||
node.type === "ImportDeclaration" ||
|
!(
|
||||||
node.type === "ExportDefaultDeclaration" ||
|
node.type === "ImportDeclaration" ||
|
||||||
node.type === "ExportNamedDeclaration",
|
node.type === "ExportDefaultDeclaration" ||
|
||||||
|
node.type === "ExportNamedDeclaration"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
throw new Error(`Unexpected '${type}' in MDX.`);
|
throw new Error(`Unexpected '${type}' in MDX.`);
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ function splitText(text) {
|
|||||||
lastNode?.type === "word" &&
|
lastNode?.type === "word" &&
|
||||||
!isBetween(KIND_NON_CJK, KIND_CJK_PUNCTUATION) &&
|
!isBetween(KIND_NON_CJK, KIND_CJK_PUNCTUATION) &&
|
||||||
// disallow leading/trailing full-width whitespace
|
// disallow leading/trailing full-width whitespace
|
||||||
![lastNode.value, node.value].some((value) => /\u3000/.test(value))
|
[lastNode.value, node.value].every((value) => !/\u3000/.test(value))
|
||||||
) {
|
) {
|
||||||
nodes.push({ type: "whitespace", value: "" });
|
nodes.push({ type: "whitespace", value: "" });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user