Bump Prettier dependency to 3.9.0
This commit is contained in:
1 parent
05cf896cfc
commit
bb817b1bd0
20 files changed
+168
-255
No files matched your search
@@ -20,15 +20,13 @@ const docProperties = new Set(["builders", "debug", "printer", "utils"]);
|
||||
|
||||
function fix(source, context) {
|
||||
// only fix `import doc from './document/public.js'`
|
||||
if (
|
||||
!(
|
||||
source.parent.type === "ImportDeclaration" &&
|
||||
source.parent.specifiers.length === 1 &&
|
||||
source.parent.specifiers[0].type === "ImportDefaultSpecifier" &&
|
||||
source.parent.specifiers[0].local.type === "Identifier" &&
|
||||
source.parent.specifiers[0].local.name === "doc"
|
||||
)
|
||||
) {
|
||||
if (!(
|
||||
source.parent.type === "ImportDeclaration" &&
|
||||
source.parent.specifiers.length === 1 &&
|
||||
source.parent.specifiers[0].type === "ImportDefaultSpecifier" &&
|
||||
source.parent.specifiers[0].local.type === "Identifier" &&
|
||||
source.parent.specifiers[0].local.name === "doc"
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,24 +43,22 @@ function fix(source, context) {
|
||||
// Only fix `const {builders: {}} = doc`
|
||||
const [{ identifier }] = references;
|
||||
|
||||
if (
|
||||
!(
|
||||
identifier.parent.type === "VariableDeclarator" &&
|
||||
identifier.parent.init === identifier &&
|
||||
identifier.parent.id.type === "ObjectPattern" &&
|
||||
identifier.parent.id.properties.every(
|
||||
(property) =>
|
||||
property.type === "Property" &&
|
||||
!property.computed &&
|
||||
property.key.type === "Identifier" &&
|
||||
docProperties.has(property.key.name),
|
||||
) &&
|
||||
identifier.parent.parent.type === "VariableDeclaration" &&
|
||||
identifier.parent.parent.kind === "const" &&
|
||||
identifier.parent.parent.declarations.length === 1 &&
|
||||
identifier.parent.parent.declarations[0] === identifier.parent
|
||||
)
|
||||
) {
|
||||
if (!(
|
||||
identifier.parent.type === "VariableDeclarator" &&
|
||||
identifier.parent.init === identifier &&
|
||||
identifier.parent.id.type === "ObjectPattern" &&
|
||||
identifier.parent.id.properties.every(
|
||||
(property) =>
|
||||
property.type === "Property" &&
|
||||
!property.computed &&
|
||||
property.key.type === "Identifier" &&
|
||||
docProperties.has(property.key.name),
|
||||
) &&
|
||||
identifier.parent.parent.type === "VariableDeclaration" &&
|
||||
identifier.parent.parent.kind === "const" &&
|
||||
identifier.parent.parent.declarations.length === 1 &&
|
||||
identifier.parent.parent.declarations[0] === identifier.parent
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+17
-21
@@ -111,21 +111,19 @@ export default {
|
||||
CallExpression(callExpression) {
|
||||
const { callee } = callExpression;
|
||||
|
||||
if (
|
||||
!(
|
||||
!callExpression.optional &&
|
||||
callExpression.arguments.length > 0 &&
|
||||
callee.type === "MemberExpression" &&
|
||||
!callee.optional &&
|
||||
!callee.computed &&
|
||||
callee.object.type === "Identifier" &&
|
||||
callee.property.type === "Identifier" &&
|
||||
(callee.property.name === "call" ||
|
||||
callee.property.name === "callParent" ||
|
||||
callee.property.name === "each" ||
|
||||
callee.property.name === "map")
|
||||
)
|
||||
) {
|
||||
if (!(
|
||||
!callExpression.optional &&
|
||||
callExpression.arguments.length > 0 &&
|
||||
callee.type === "MemberExpression" &&
|
||||
!callee.optional &&
|
||||
!callee.computed &&
|
||||
callee.object.type === "Identifier" &&
|
||||
callee.property.type === "Identifier" &&
|
||||
(callee.property.name === "call" ||
|
||||
callee.property.name === "callParent" ||
|
||||
callee.property.name === "each" ||
|
||||
callee.property.name === "map")
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -135,12 +133,10 @@ export default {
|
||||
}
|
||||
|
||||
const [callback] = callExpression.arguments;
|
||||
if (
|
||||
!(
|
||||
callback.type === "FunctionExpression" ||
|
||||
callback.type === "ArrowFunctionExpression"
|
||||
)
|
||||
) {
|
||||
if (!(
|
||||
callback.type === "FunctionExpression" ||
|
||||
callback.type === "ArrowFunctionExpression"
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+19
-23
@@ -292,21 +292,19 @@ export default {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
!(
|
||||
referenceIdentifier.parent.type === "MemberExpression" &&
|
||||
referenceIdentifier.parent.object === referenceIdentifier &&
|
||||
!referenceIdentifier.parent.optional &&
|
||||
!referenceIdentifier.parent.computed &&
|
||||
referenceIdentifier.parent.property.type === "Identifier" &&
|
||||
referenceIdentifier.parent.property.name === "has" &&
|
||||
referenceIdentifier.parent.parent.type === "CallExpression" &&
|
||||
referenceIdentifier.parent.parent.callee ===
|
||||
referenceIdentifier.parent &&
|
||||
!referenceIdentifier.parent.parent.optional &&
|
||||
referenceIdentifier.parent.parent.arguments.length === 1
|
||||
)
|
||||
) {
|
||||
if (!(
|
||||
referenceIdentifier.parent.type === "MemberExpression" &&
|
||||
referenceIdentifier.parent.object === referenceIdentifier &&
|
||||
!referenceIdentifier.parent.optional &&
|
||||
!referenceIdentifier.parent.computed &&
|
||||
referenceIdentifier.parent.property.type === "Identifier" &&
|
||||
referenceIdentifier.parent.property.name === "has" &&
|
||||
referenceIdentifier.parent.parent.type === "CallExpression" &&
|
||||
referenceIdentifier.parent.parent.callee ===
|
||||
referenceIdentifier.parent &&
|
||||
!referenceIdentifier.parent.parent.optional &&
|
||||
referenceIdentifier.parent.parent.arguments.length === 1
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -316,14 +314,12 @@ export default {
|
||||
? typeNode.expression
|
||||
: typeNode;
|
||||
|
||||
if (
|
||||
!(
|
||||
memberExpression.type === "MemberExpression" &&
|
||||
!memberExpression.computed &&
|
||||
memberExpression.property.type === "Identifier" &&
|
||||
memberExpression.property.name === "type"
|
||||
)
|
||||
) {
|
||||
if (!(
|
||||
memberExpression.type === "MemberExpression" &&
|
||||
!memberExpression.computed &&
|
||||
memberExpression.property.type === "Identifier" &&
|
||||
memberExpression.property.name === "type"
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user