Skip to content

Commit

Permalink
Bump prettier to 3.3.3 and reformat files (#9503)
Browse files Browse the repository at this point in the history
  • Loading branch information
twschiller authored Nov 13, 2024
1 parent aec8d5e commit 4712baa
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 42 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ repos:
rev: v3.1.0
hooks:
- id: prettier
additional_dependencies:
# mirrors-prettier won't receive updates after v3.1.0 because prettier changed their
# plugin system: "prettier made some changes that breaks plugins entirely"
# See: https://github.com/pre-commit/pre-commit/issues/3133
# The additional_dependencies aren't updated with `pre-commit autoupdate`
- [email protected]
# TODO: restore in https://github.com/pixiebrix/pixiebrix-extension/issues/9441
# - repo: local
# hooks:
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ coverage

# ignore libraries
node_modules
public/mockServiceWorker.js
**/public/mockServiceWorker.js

# ignore snapshots
**/*-snapshots/**
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function setVarsFromSchema({
const nodePath = [...parentPath, key];

const existence =
existenceOverride ?? required?.includes(key)
(existenceOverride ?? required?.includes(key))
? VarExistence.DEFINITELY
: VarExistence.MAYBE;

Expand Down Expand Up @@ -254,7 +254,7 @@ function setVarsFromSchema({
});
} else if (propertySchema.type === "array") {
const existence =
existenceOverride ?? required?.includes(key)
(existenceOverride ?? required?.includes(key))
? VarExistence.DEFINITELY
: VarExistence.MAYBE;

Expand Down Expand Up @@ -295,7 +295,7 @@ function setVarsFromSchema({
source,
path: [...parentPath, key],
existence:
existenceOverride ?? required?.includes(key)
(existenceOverride ?? required?.includes(key))
? VarExistence.DEFINITELY
: VarExistence.MAYBE,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export async function launchAuthIntegration({
"Integration did not return an OAuth2 context",
);

const refreshUrl = refreshToken ? oAuth2Context.tokenUrl ?? null : null;
const refreshUrl = refreshToken ? (oAuth2Context.tokenUrl ?? null) : null;

console.info("Setting partner auth for Control Room %s", controlRoomUrl);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const MarketplaceListingIcon: React.FC<{
color={
inheritColor
? "inherit"
: listing?.icon_color ?? DEFAULT_TEXT_ICON_COLOR
: (listing?.icon_color ?? DEFAULT_TEXT_ICON_COLOR)
}
className={faIconClass}
size={size}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ function lookupAuthId(

return dependency == null
? null
: authOptions.find(({ value }) => value === dependency.configId)?.value ??
null;
: (authOptions.find(({ value }) => value === dependency.configId)?.value ??
null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,14 @@ const initialValues: DatabaseConfig = {

function getOrganizationOptions(organizations: Team[]) {
const organizationOptions = (organizations ?? [])
.filter(
(organization) =>
organization.memberships?.some(
(member) =>
// If the current user is an admin of the organization, then all of the members are listed for the organization
// Otherwise, only the current user is listed for the organization
// So if any listed member is an admin, the current user is an admin
member.role === UserRole.admin,
),
.filter((organization) =>
organization.memberships?.some(
(member) =>
// If the current user is an admin of the organization, then all of the members are listed for the organization
// Otherwise, only the current user is listed for the organization
// So if any listed member is an admin, the current user is an admin
member.role === UserRole.admin,
),
)
.map((organization) => ({
label: organization.teamName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ const DatabaseWidget: React.FunctionComponent<SchemaFieldProps> = ({
// eslint-disable-next-line react-hooks/exhaustive-deps -- only run on mount
const initialFieldValue = useMemo(() => fieldValue, []);
const fullDatabaseOptions = useMemo(() => {
const loadedOptions = isLoadingDatabaseOptions ? [] : databaseOptions ?? [];
const loadedOptions = isLoadingDatabaseOptions
? []
: (databaseOptions ?? []);

// If the schema format is 'preview', and the initial field value is a string, use that string
// as the auto-created database name, and add it as an option to the database dropdown at the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ const ObjectFieldRow: React.FunctionComponent<RowProps> = ({
// As of v3, we allow object props of any type, not just string
const defaultSchema: Schema = {};
const rawSchema = defined
? parentSchema.properties?.[property] ?? defaultSchema
: parentSchema.additionalProperties ?? defaultSchema;
? (parentSchema.properties?.[property] ?? defaultSchema)
: (parentSchema.additionalProperties ?? defaultSchema);

return typeof rawSchema === "boolean" ? defaultSchema : rawSchema;
}, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ const SourceLabel: React.FunctionComponent<SourceLabelProps> = ({
}

default: {
const brickConfig = nodes.find((node) => node.path === source)
?.blockConfig;
const brickConfig = nodes.find(
(node) => node.path === source,
)?.blockConfig;
if (brickConfig == null) {
label = source;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ const RemoteMultiSelectWidget = <TOption extends Option<TOption["value"]>>({
} as ChangeEvent<MultiSelectLike<TOption>>);
};

const selectedOptions = options.filter(
(option: Option) => value?.includes(option.value),
const selectedOptions = options.filter((option: Option) =>
value?.includes(option.value),
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ function useSubmitPackage({ create = false }: SubmitOptions): SubmitCallbacks {
const { kind, metadata } = unsavedPackageJson;

try {
const data = await (create
? createPackage({ ...values, kind })
: updatePackage({ ...values, kind })
const data = await (
create
? createPackage({ ...values, kind })
: updatePackage({ ...values, kind })
).unwrap();

// We attach the handler below, and don't want it to block the save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const selectActiveModComponentTraces: EditorSelector<TraceRecord[]> =
(activeModComponentId, modComponentTraces) =>
activeModComponentId
? // eslint-disable-next-line security/detect-object-injection -- UUID
modComponentTraces[activeModComponentId] ?? []
(modComponentTraces[activeModComponentId] ?? [])
: [],
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const sidebarSlice = createSlice({
-- Immer Draft<T> type resolution can't handle JsonObject (recursive) types properly
See: https://github.com/immerjs/immer/issues/839 */
// @ts-ignore-error -- SidebarEntries.panels --> PanelEntry.actions --> PanelButton.detail is JsonObject
initialEventKey ?? defaultEventKey(state, state.closedTabs);
(initialEventKey ?? defaultEventKey(state, state.closedTabs));
},
selectTab(state, action: PayloadAction<string>) {
// We were seeing some automatic calls to selectTab with a stale event key...
Expand Down
10 changes: 4 additions & 6 deletions applications/browser-extension/src/testUtils/permissionsMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,12 @@ browser.permissions = {
remove: jest
.fn()
.mockImplementation(async (toRemove: Permissions.AnyPermissions) => {
remove(
extensionPermissions.permissions,
(permission) => toRemove.permissions?.includes(permission),
remove(extensionPermissions.permissions, (permission) =>
toRemove.permissions?.includes(permission),
);
// XXX: only handles exact matches
remove(
extensionPermissions.origins,
(permission) => toRemove.origins?.includes(permission),
remove(extensionPermissions.origins, (permission) =>
toRemove.origins?.includes(permission),
);

for (const listener of removeListeners) {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"npm": "10.5.0"
},
"devDependencies": {
"knip": "^5.36.7",
"prettier": "3.1.0",
"@sindresorhus/tsconfig": "^6.0.0",
"nx": "20.1.0"
"knip": "^5.36.7",
"nx": "20.1.0",
"prettier": "3.3.3"
}
}

0 comments on commit 4712baa

Please sign in to comment.