feat: consistently format all HTML, XML, JSON, CSS, JS, TS, SQL, TOML, YAML, and Markdown files as far as possible (#4193)

* feat: consistently format all HTML, XML, JSON, CSS, JS, TS, SQL, TOML, YAML, and Markdown files

* chore: deal with VS Code not being able to parse valid editorconfig syntax

Sometimes I'm surprised that computers even work.

* chore: get rid of IntelliJ IDE config files that should not be there

These were already added to the `.gitignore` a long time ago, and now
are being ignored by Prettier.

* fix: rename `tooling-config` `format` script to `fix` for it to run with Turbo
This commit is contained in:
Alejandro González
2025-08-16 19:40:31 +02:00
committed by GitHub
parent 6f59f4c110
commit 1454e3351e
130 changed files with 7959 additions and 7618 deletions

View File

@@ -0,0 +1,119 @@
**/*.rs
**/*.svg
.sqlx
# Migrations existing before Prettier formatted them shall always be ignored,
# as any changes to them will break existing deployments
migrations/20200716160921_init.sql
migrations/20200717192808_Make_categories_non-null.sql
migrations/20200722031742_initial-release-channels.sql
migrations/20200722033157_rename-release-channels.sql
migrations/20200722153930_version-filename.sql
migrations/20200730223151_more-not-null.sql
migrations/20200812183213_unique-loaders.sql
migrations/20200928020509_states.sql
migrations/20200928033759_edit-states.sql
migrations/20200928053955_make-url-not-null.sql
migrations/20200928170310_create-users.sql
migrations/20200928195220_add-roles-to-users.sql
migrations/20200929034101_add-author-to-versions.sql
migrations/20201001015631_not-null-github-avatar.sql
migrations/20201003211651_make-name-null.sql
migrations/20201014165954_create-statuses.sql
migrations/20201021214908_extend-game-version.sql
migrations/20201029190804_add-game-version-datetime.sql
migrations/20201109200208_edit-teams.sql
migrations/20201112052516_moderation.sql
migrations/20201122043349_more-mod-data.sql
migrations/20201213013358_remove-member-name.sql
migrations/20210113202021_add-descriptions.sql
migrations/20210118161307_remove-version-access.sql
migrations/20210129224854_dependency-types.sql
migrations/20210201001429_reports.sql
migrations/20210224174945_notifications.sql
migrations/20210301041252_follows.sql
migrations/20210509010206_project_types.sql
migrations/20210611024943_archived-status-notifications-icon-rejection-reasons.sql
migrations/20210718223710_gallery.sql
migrations/20210727160151_gallery_featuring_rejection_rename.sql
migrations/20210805044459_more_gallery_info.sql
migrations/20210820053031_version-optimization.sql
migrations/20220210032959_remove-categories-unique.sql
migrations/20220220035037_remove_downloads_table.sql
migrations/20220329182356_file-sizes.sql
migrations/20220526040434_dep-file-names.sql
migrations/20220725204351_more-project-data.sql
migrations/20220801184215_banned-users.sql
migrations/20220902025606_initial-payouts.sql
migrations/20220928044123_payouts-scheduling.sql
migrations/20221107171016_payouts-overhaul.sql
migrations/20221111163753_fix-precision.sql
migrations/20221111202802_fix-precision-again.sql
migrations/20221116200727_flame-anvil-integration.sql
migrations/20221126222222_spdx-licenses.sql
migrations/20221129161609_status-types-changes.sql
migrations/20221206221021_webhook-sent.sql
migrations/20221217041358_ordering-galore.sql
migrations/20221217215337_drop-body_url-changelog_url.sql
migrations/20221223192812_file-labels.sql
migrations/20221227010515_project-colors.sql
migrations/20230104214503_random-projects.sql
migrations/20230127233123_loader-gv-mod.sql
migrations/20230221212958_queue-date.sql
migrations/20230324202117_messaging.sql
migrations/20230414203933_threads-fix.sql
migrations/20230416033024_deps-project-mandatory.sql
migrations/20230421174120_remove-threads-ref.sql
migrations/20230502141522_minos-support.sql
migrations/20230628180115_kill-ory.sql
migrations/20230710034250_flows.sql
migrations/20230711004131_2fa.sql
migrations/20230714235551_fix-2fa-type.sql
migrations/20230808043323_threads-index.sql
migrations/20230808162652_gv-loader-fixes.sql
migrations/20230816085700_collections_and_more.sql
migrations/20230913024611_organizations.sql
migrations/20231005230721_dynamic-fields.sql
migrations/20231016190056_oauth_provider.sql
migrations/20231027195838_version_ordering.sql
migrations/20231110010322_adds_game_version_minmax.sql
migrations/20231113104902_games_metadata.sql
migrations/20231114175920_new-payment-methods.sql
migrations/20231115105022_plugins_datapacks_v3.sql
migrations/20231116112800_side_types_overhaul.sql
migrations/20231117073600_links_overhaul.sql
migrations/20231122230639_oauth_client_metadata.sql
migrations/20231124070100_renaming_consistency.sql
migrations/20231125080100_drops_mods_dp_plugins.sql
migrations/20231130153100_loader_fields_loaders.sql
migrations/20231205095400_remaining_loader_field_loaders.sql
migrations/20231211184922_collections_description_nullable.sql
migrations/20231213103100_enforces-owner-unique.sql
migrations/20240104203711_orgs-names.sql
migrations/20240115052708_base62-helper-functions.sql
migrations/20240131224610_moderation_packs.sql
migrations/20240221215354_moderation_pack_fixes.sql
migrations/20240319195753_threads-updates.sql
migrations/20240701213559_remove-user-names.sql
migrations/20240702213250_subscriptions.sql
migrations/20240907192840_raw-images.sql
migrations/20240911044738_payouts-updates.sql
migrations/20240923163452_charges-fix.sql
migrations/20241121232522_friends.sql
migrations/20241204190127_revenue_updates.sql
migrations/20241224001114_teams-precision-fix.sql
migrations/20250117013050_missing-primary-keys.sql
migrations/20250519184051_shared-instances.sql
migrations/20250523174544_project-versions-environments.sql
migrations/20250608183828_random-project-index.sql
migrations/20250609134334_spatial-random-project-index.sql
migrations/20250611164523_lowercase-user-email-index.sql
migrations/20250628213541_payout-sources-recording.sql
migrations/20250725230041_reports-closed-status-index.sql
migrations/20250727184120_user-newsletter-subscription-column.sql
migrations/20250804221014_users-redeemals.sql
migrations/20250805001654_product-prices-public.sql
# Prettier reformats some of the PostgreSQL-specific COPY syntax here,
# which is very likely to break things
fixtures/labrinth-seed-data-202508052143.sql

View File

@@ -76,19 +76,16 @@ thiserror.workspace = true
either.workspace = true
sqlx = { workspace = true, features = [
"runtime-tokio",
"tls-rustls-ring",
"postgres",
"chrono",
"macros",
"migrate",
"rust_decimal",
"json",
] }
rust_decimal = { workspace = true, features = [
"serde-with-float",
"serde-with-str",
"runtime-tokio",
"tls-rustls-ring",
"postgres",
"chrono",
"macros",
"migrate",
"rust_decimal",
"json",
] }
rust_decimal = { workspace = true, features = ["serde-with-float", "serde-with-str"] }
redis = { workspace = true, features = ["tokio-comp", "ahash", "r2d2"] }
deadpool-redis.workspace = true
clickhouse = { workspace = true, features = ["uuid", "time"] }
@@ -101,7 +98,23 @@ tar.workspace = true
sentry.workspace = true
sentry-actix.workspace = true
image = { workspace = true, features = ["avif", "bmp", "dds", "exr", "ff", "gif", "hdr", "ico", "jpeg", "png", "pnm", "qoi", "tga", "tiff", "webp"] }
image = { workspace = true, features = [
"avif",
"bmp",
"dds",
"exr",
"ff",
"gif",
"hdr",
"ico",
"jpeg",
"png",
"pnm",
"qoi",
"tga",
"tiff",
"webp",
] }
color-thief.workspace = true
webp.workspace = true
@@ -120,7 +133,10 @@ ariadne.workspace = true
clap = { workspace = true, features = ["derive"] }
[target.'cfg(target_os = "linux")'.dependencies]
tikv-jemallocator = { workspace = true, features = ["profiling", "unprefixed_malloc_on_supported_platforms"] }
tikv-jemallocator = { workspace = true, features = [
"profiling",
"unprefixed_malloc_on_supported_platforms",
] }
tikv-jemalloc-ctl = { workspace = true, features = ["stats"] }
jemalloc_pprof = { workspace = true, features = ["flamegraph"] }

View File

@@ -1,78 +1,78 @@
:root {
--color-bg: #16181c;
--color-fg: #b0bac5;
--color-section-bg: #26292f;
--color-bg: #16181c;
--color-fg: #b0bac5;
--color-section-bg: #26292f;
--content-width: 30%;
--content-max-width: 300px;
--content-padding: 1.5rem;
--edge-rounding: 1rem;
--content-width: 30%;
--content-max-width: 300px;
--content-padding: 1.5rem;
--edge-rounding: 1rem;
}
html,
body {
height: 100%;
overflow: hidden;
height: 100%;
overflow: hidden;
}
body {
color: var(--color-fg);
background-color: var(--color-bg);
display: flex;
justify-content: center;
align-items: center;
font-family:
Inter,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Helvetica Neue,
Helvetica,
Oxygen,
Ubuntu,
Roboto,
Cantarell,
Fira Sans,
Droid Sans,
'Apple Color Emoji',
'Segoe UI Emoji',
Arial,
sans-serif;
color: var(--color-fg);
background-color: var(--color-bg);
display: flex;
justify-content: center;
align-items: center;
font-family:
Inter,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Helvetica Neue,
Helvetica,
Oxygen,
Ubuntu,
Roboto,
Cantarell,
Fira Sans,
Droid Sans,
'Apple Color Emoji',
'Segoe UI Emoji',
Arial,
sans-serif;
}
.content {
background-color: var(--color-section-bg);
width: var(--content-width);
max-width: var(--content-max-width);
border-radius: var(--edge-rounding);
padding: var(--content-padding);
justify-content: center;
align-items: center;
box-sizing: border-box;
background-color: var(--color-section-bg);
width: var(--content-width);
max-width: var(--content-max-width);
border-radius: var(--edge-rounding);
padding: var(--content-padding);
justify-content: center;
align-items: center;
box-sizing: border-box;
}
.content h2 {
margin-bottom: 0;
margin-bottom: 0;
}
.logo {
display: block;
width: 100%;
margin-left: auto;
margin-right: auto;
margin-bottom: 2rem;
border-radius: 1.5rem;
display: block;
width: 100%;
margin-left: auto;
margin-right: auto;
margin-bottom: 2rem;
border-radius: 1.5rem;
}
a {
color: #4f9cff;
text-decoration: underline;
color: #4f9cff;
text-decoration: underline;
}
a:visited {
color: #4f9cff;
color: #4f9cff;
}
img {
image-rendering: pixelated;
image-rendering: pixelated;
}

View File

@@ -1,14 +1,17 @@
{
"name": "@modrinth/labrinth",
"scripts": {
"build": "cargo build --release",
"lint": "cargo fmt --check && cargo clippy --all-targets",
"fix": "cargo clippy --all-targets --fix --allow-dirty && cargo fmt",
"dev": "cargo run",
"//": "labrinth integration tests require a lot of disk space, so in the standard GitHub Actions",
"//": "runners we must remove useless development tools from the base image, which frees up ~20 GiB.",
"//": "The command commented out below can be used in CI to debug what is taking up space:",
"//": "sudo du -xh --max-depth=4 / | sort -rh | curl -X POST --data-urlencode content@/dev/fd/0 https://api.mclo.gs/1/log",
"test": "if-ci sudo rm -rf /usr/local/lib/android /usr/local/.ghcup /opt/hostedtoolcache/CodeQL /usr/share/swift && cargo nextest run --all-targets --no-fail-fast"
}
"name": "@modrinth/labrinth",
"scripts": {
"build": "cargo build --release",
"lint": "cargo fmt --check && cargo clippy --all-targets",
"lint:ancillary": "prettier --check .",
"fix": "cargo clippy --all-targets --fix --allow-dirty && cargo fmt",
"fix:ancillary": "prettier --write .",
"dev": "cargo run",
"//": "labrinth integration tests require a lot of disk space, so in the standard GitHub Actions",
"//": "runners we must remove useless development tools from the base image, which frees up ~20 GiB.",
"//": "The command commented out below can be used in CI to debug what is taking up space:",
"//": "sudo du -xh --max-depth=4 / | sort -rh | curl -X POST --data-urlencode content@/dev/fd/0 https://api.mclo.gs/1/log",
"test": "if-ci sudo rm -rf /usr/local/lib/android /usr/local/.ghcup /opt/hostedtoolcache/CodeQL /usr/share/swift && cargo nextest run --all-targets --no-fail-fast"
},
"prettier": "@modrinth/tooling-config/labrinth.prettier.config.cjs"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,22 +1,22 @@
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="/auth/style.css" />
<link rel="icon" type="image/png" href="/favicon.ico" />
<title>Error - Modrinth</title>
</head>
<head>
<link rel="stylesheet" href="/auth/style.css" />
<link rel="icon" type="image/png" href="/favicon.ico" />
<title>Error - Modrinth</title>
</head>
<body>
<div class="content">
<img src="/logo.svg" alt="Modrinth Logo" class="logo" />
<h2>{{ code }}</h2>
<p>An error has occurred during the authentication process.</p>
<p>
Try closing this window and signing in again. Join
<a href="https://discord.modrinth.com">our Discord server</a> to get help if this error
persists after three attempts.
</p>
<p><b>Debug information:</b> {{ message }}</p>
</div>
</body>
<body>
<div class="content">
<img src="/logo.svg" alt="Modrinth Logo" class="logo" />
<h2>{{ code }}</h2>
<p>An error has occurred during the authentication process.</p>
<p>
Try closing this window and signing in again. Join
<a href="https://discord.modrinth.com">our Discord server</a> to get help if this error
persists after three attempts.
</p>
<p><b>Debug information:</b> {{ message }}</p>
</div>
</body>
</html>

View File

@@ -1,16 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="/auth/style.css" />
<link rel="icon" type="image/png" href="/favicon.ico" />
<title>Login - Modrinth</title>
</head>
<head>
<link rel="stylesheet" href="/auth/style.css" />
<link rel="icon" type="image/png" href="/favicon.ico" />
<title>Login - Modrinth</title>
</head>
<body>
<div class="content">
<img src="{{ icon }}" alt="{{ name }}" class="logo" />
<h2>Login Successful</h2>
<p>Hey, {{ name }}! You can now safely close this tab.</p>
</div>
</body>
<body>
<div class="content">
<img src="{{ icon }}" alt="{{ name }}" class="logo" />
<h2>Login Successful</h2>
<p>Hey, {{ name }}! You can now safely close this tab.</p>
</div>
</body>
</html>

View File

@@ -5,10 +5,13 @@
-- 'Friend' and 'enemy' function like 'user', but we can use them to simulate 'other' users that may or may not be able to access certain things
-- IDs 1-5, 1-5
INSERT INTO users (id, username, email, role) VALUES (1, 'Admin', 'admin@modrinth.com', 'admin');
INSERT INTO users (id, username, email, role) VALUES (2, 'Moderator', 'moderator@modrinth.com', 'moderator');
INSERT INTO users (id, username, email, role)
VALUES (2, 'Moderator', 'moderator@modrinth.com', 'moderator');
INSERT INTO users (id, username, email, role) VALUES (3, 'User', 'user@modrinth.com', 'developer');
INSERT INTO users (id, username, email, role) VALUES (4, 'Friend', 'friend@modrinth.com', 'developer');
INSERT INTO users (id, username, email, role) VALUES (5, 'Enemy', 'enemy@modrinth.com', 'developer');
INSERT INTO users (id, username, email, role)
VALUES (4, 'Friend', 'friend@modrinth.com', 'developer');
INSERT INTO users (id, username, email, role)
VALUES (5, 'Enemy', 'enemy@modrinth.com', 'developer');
-- Full PATs for each user, with different scopes
-- These are not legal PATs, as they contain all scopes- they mimic permissions of a logged in user
@@ -20,73 +23,88 @@ INSERT INTO pats (id, user_id, name, access_token, scopes, expires) VALUES (53,
INSERT INTO pats (id, user_id, name, access_token, scopes, expires) VALUES (54, 5, 'enemy-pat', 'mrp_patenemy', $1, '2030-08-18 15:48:58.435729+00');
INSERT INTO loaders (id, loader) VALUES (5, 'fabric');
INSERT INTO loaders_project_types (joining_loader_id, joining_project_type_id) VALUES (5,1);
INSERT INTO loaders_project_types (joining_loader_id, joining_project_type_id) VALUES (5, 1);
INSERT INTO loaders (id, loader) VALUES (6, 'forge');
INSERT INTO loaders_project_types (joining_loader_id, joining_project_type_id) VALUES (6,1);
INSERT INTO loaders_project_types (joining_loader_id, joining_project_type_id) VALUES (6, 1);
INSERT INTO loaders (id, loader, metadata) VALUES (7, 'bukkit', '{"platform":false}'::jsonb);
INSERT INTO loaders (id, loader, metadata) VALUES (8, 'waterfall', '{"platform":true}'::jsonb);
INSERT INTO loaders (id, loader, metadata) VALUES (7, 'bukkit', '{"platform":false}'::JSONB);
INSERT INTO loaders (id, loader, metadata) VALUES (8, 'waterfall', '{"platform":true}'::JSONB);
-- Adds dummies to mrpack_loaders
INSERT INTO loader_field_enum_values (enum_id, value) SELECT id, 'fabric' FROM loader_field_enums WHERE enum_name = 'mrpack_loaders';
INSERT INTO loader_field_enum_values (enum_id, value) SELECT id, 'forge' FROM loader_field_enums WHERE enum_name = 'mrpack_loaders';
INSERT INTO loader_field_enum_values (enum_id, value)
SELECT id, 'fabric' FROM loader_field_enums WHERE enum_name = 'mrpack_loaders';
INSERT INTO loader_field_enum_values (enum_id, value)
SELECT id, 'forge' FROM loader_field_enums WHERE enum_name = 'mrpack_loaders';
INSERT INTO loaders_project_types_games (loader_id, project_type_id, game_id) SELECT joining_loader_id, joining_project_type_id, 1 FROM loaders_project_types WHERE joining_loader_id = 5;
INSERT INTO loaders_project_types_games (loader_id, project_type_id, game_id) SELECT joining_loader_id, joining_project_type_id, 1 FROM loaders_project_types WHERE joining_loader_id = 6;
INSERT INTO loaders_project_types_games (loader_id, project_type_id, game_id)
SELECT joining_loader_id, joining_project_type_id, 1
FROM loaders_project_types
WHERE joining_loader_id = 5;
INSERT INTO loaders_project_types_games (loader_id, project_type_id, game_id)
SELECT joining_loader_id, joining_project_type_id, 1
FROM loaders_project_types
WHERE joining_loader_id = 6;
-- Dummy-data only optional field, as we don't have any yet
INSERT INTO loader_fields (
field,
field_type,
optional
) VALUES (
'test_fabric_optional',
'integer',
true
);
INSERT INTO loader_fields_loaders(loader_id, loader_field_id)
SELECT l.id, lf.id FROM loaders l CROSS JOIN loader_fields lf WHERE lf.field = 'test_fabric_optional' AND l.loader = 'fabric' ON CONFLICT DO NOTHING;
INSERT INTO loader_fields
(field, field_type, optional)
VALUES
('test_fabric_optional', 'integer', TRUE);
INSERT INTO loader_fields_loaders (loader_id, loader_field_id)
SELECT l.id, lf.id
FROM
loaders AS l
CROSS JOIN loader_fields AS lf
WHERE lf.field = 'test_fabric_optional' AND l.loader = 'fabric'
ON CONFLICT DO NOTHING;
-- Sample game versions, loaders, categories
-- Game versions is '2'
INSERT INTO loader_field_enum_values(enum_id, value, metadata, created)
INSERT INTO loader_field_enum_values (enum_id, value, metadata, created)
VALUES (2, '1.20.1', '{"type":"release","major":false}', '2021-08-18 15:48:58.435729+00');
INSERT INTO loader_field_enum_values(enum_id, value, metadata, created)
INSERT INTO loader_field_enum_values (enum_id, value, metadata, created)
VALUES (2, '1.20.2', '{"type":"release","major":false}', '2021-08-18 15:48:59.435729+00');
INSERT INTO loader_field_enum_values(enum_id, value, metadata, created)
INSERT INTO loader_field_enum_values (enum_id, value, metadata, created)
VALUES (2, '1.20.3', '{"type":"release","major":false}', '2021-08-18 15:49:00.435729+00');
INSERT INTO loader_field_enum_values(enum_id, value, metadata, created)
INSERT INTO loader_field_enum_values (enum_id, value, metadata, created)
VALUES (2, '1.20.4', '{"type":"beta","major":false}', '2021-08-18 15:49:01.435729+00');
INSERT INTO loader_field_enum_values(enum_id, value, metadata, created)
INSERT INTO loader_field_enum_values (enum_id, value, metadata, created)
VALUES (2, '1.20.5', '{"type":"release","major":true}', '2061-08-18 15:49:02.435729+00');
-- Also add 'Ordering_Negative1' and 'Ordering_Positive100' to game versions (to test ordering override)
INSERT INTO loader_field_enum_values(enum_id, value, metadata, ordering)
INSERT INTO loader_field_enum_values (enum_id, value, metadata, ordering)
VALUES (2, 'Ordering_Negative1', '{"type":"release","major":false}', -1);
INSERT INTO loader_field_enum_values(enum_id, value, metadata, ordering)
INSERT INTO loader_field_enum_values (enum_id, value, metadata, ordering)
VALUES (2, 'Ordering_Positive100', '{"type":"release","major":false}', 100);
INSERT INTO loader_fields_loaders(loader_id, loader_field_id)
SELECT l.id, lf.id FROM loaders l CROSS JOIN loader_fields lf WHERE lf.field IN ('game_versions','environment') ON CONFLICT DO NOTHING;
INSERT INTO loader_fields_loaders (loader_id, loader_field_id)
SELECT l.id, lf.id
FROM
loaders AS l
CROSS JOIN loader_fields AS lf
WHERE lf.field IN ('game_versions', 'environment')
ON CONFLICT DO NOTHING;
INSERT INTO categories (id, category, project_type) VALUES
(51, 'combat', 1),
(52, 'decoration', 1),
(53, 'economy', 1),
(54, 'food', 1),
(55, 'magic', 1),
(56, 'mobs', 1),
(57, 'optimization', 1);
INSERT INTO categories (id, category, project_type)
VALUES
(51, 'combat', 1),
(52, 'decoration', 1),
(53, 'economy', 1),
(54, 'food', 1),
(55, 'magic', 1),
(56, 'mobs', 1),
(57, 'optimization', 1);
INSERT INTO categories (id, category, project_type) VALUES
(101, 'combat', 2),
(102, 'decoration', 2),
(103, 'economy', 2),
(104, 'food', 2),
(105, 'magic', 2),
(106, 'mobs', 2),
(107, 'optimization', 2);
INSERT INTO categories (id, category, project_type)
VALUES
(101, 'combat', 2),
(102, 'decoration', 2),
(103, 'economy', 2),
(104, 'food', 2),
(105, 'magic', 2),
(106, 'mobs', 2),
(107, 'optimization', 2);
-- Create dummy oauth client, secret_hash is SHA512 hash of full lowercase alphabet
INSERT INTO oauth_clients (
@@ -105,9 +123,10 @@ VALUES (
'4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1',
3
);
INSERT INTO oauth_client_redirect_uris (id, client_id, uri) VALUES (1, 1, 'https://modrinth.com/oauth_callback');
INSERT INTO oauth_client_redirect_uris (id, client_id, uri)
VALUES (1, 1, 'https://modrinth.com/oauth_callback');
-- Create dummy data table to mark that this file has been run
CREATE TABLE dummy_data (
update_id bigint PRIMARY KEY
);
update_id BIGINT PRIMARY KEY
);