Skip to content

Commit

Permalink
Update formatters and run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Rikthepixel committed Sep 12, 2024
1 parent f48cf94 commit c351a10
Show file tree
Hide file tree
Showing 102 changed files with 742 additions and 526 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Crowdin

on:
push:
branches: [ main ]
branches: [main]
paths:
- "src/pages/**"
- "src/assets/**"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy

on:
push:
branches: [ main ]
branches: [main]
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -46,4 +46,4 @@ jobs:
HOST: ${{ secrets.VPS_HOST }}
KEY: ${{ secrets.VPS_SSH_PRIVATE_KEY }}
TARGET: "/home/website/thenewoil/"
ARGS: '-z -r -v -l -t --delete-after --exclude node_modules/ .git/'
ARGS: "-z -r -v -l -t --delete-after --exclude node_modules/ .git/"
4 changes: 2 additions & 2 deletions .github/workflows/validate-caddy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Validate Caddyfile
on:
push:
paths:
- 'caddy/**'
- "caddy/**"
pull_request:
paths:
- 'caddy/**'
- "caddy/**"

jobs:
validate:
Expand Down
2 changes: 0 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@
"options": {
"parser": "astro",
"singleQuote": false,
"editorconfig": true,
"trailingComma": "none",
"printWidth": 120,
"semi": true
}
}
],
"pluginSearchDirs": false,
"singleQuote": false
}
2 changes: 1 addition & 1 deletion FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ github: tnonate
open_collective: thenewoil
liberapay: thenewoil
patreon: TheNewOil413
custom: https://thenewoil.org/en/support/
custom: https://thenewoil.org/en/support/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ Readers who speak foreign languages can help us translate the site on [Crowdin](
- [**2023 Transparency Report**](https://blog.thenewoil.org/transparency-report-2023)
- [**2022 Transparency Report**](https://blog.thenewoil.org/transparency-report-2022-and-goals-for-2023)
- [**2021 Transparency Report**](https://blog.thenewoil.org/transparency-report-2021-and-goals-for-2022)
- [**2020 Transparency Report**](https://blog.thenewoil.org/2020-recap-2021-plans)
- [**2020 Transparency Report**](https://blog.thenewoil.org/2020-recap-2021-plans)
6 changes: 1 addition & 5 deletions crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ files:
source: "/pages/en/**/*.mdx",
translation: "/pages/%two_letters_code%/**/%file_name%.mdx",
ignore:
[
"/pages/en/blog-index.mdx",
"/pages/en/pgp.mdx",
"/pages/en/xmr2.mdx",
],
["/pages/en/blog-index.mdx", "/pages/en/pgp.mdx", "/pages/en/xmr2.mdx"],
},
{
source: "/pages/404.mdx",
Expand Down
37 changes: 17 additions & 20 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 @@ -21,9 +21,9 @@
"astro-robots-txt": "^1.0.0",
"linkedom": "^0.18.4",
"node-fetch": "^3.3.0",
"prettier": "^3.1.1",
"prettier-plugin-astro": "^0.12.3",
"prettier-plugin-tailwindcss": "^0.5.6",
"prettier": "^3.3.3",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-tailwindcss": "^0.6.6",
"sass": "^1.57.1",
"string-strip-html": "^13.0.4",
"svgo": "2.8",
Expand Down
12 changes: 6 additions & 6 deletions plugins/astro-alias/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ const plugin = (options: Options): AstroIntegration => {
aliases = JSON.parse(aliasFileContent);
} catch (error) {
throw Error(
`${CONSOLE_TAG} Invalid JSOn in file "${options.aliasFile}"`
`${CONSOLE_TAG} Invalid JSOn in file "${options.aliasFile}"`,
);
}

if (!Array.isArray(aliases))
throw Error(
`${CONSOLE_TAG} Root element of "${options.aliasFile}" has to be a JSON array`
`${CONSOLE_TAG} Root element of "${options.aliasFile}" has to be a JSON array`,
);

Promise.all(
aliases.map(async (possibleAlias, i) => {
if (!possibleAlias.target || !possibleAlias.source)
return console.warn(
`${CONSOLE_TAG} Alias index: ${i} does not have a "target" or a "source"`
`${CONSOLE_TAG} Alias index: ${i} does not have a "target" or a "source"`,
);
const alias: Alias = possibleAlias;

Expand All @@ -53,15 +53,15 @@ const plugin = (options: Options): AstroIntegration => {

if (!fileExists(sourceFilepath))
return console.warn(
`${CONSOLE_TAG} File: "${sourceFilepath}" does not exist. To create an alias point to a file that exists`
`${CONSOLE_TAG} File: "${sourceFilepath}" does not exist. To create an alias point to a file that exists`,
);
if (fileExists(targetFilepath))
return console.warn(
`${CONSOLE_TAG} File: ${targetFilepath} already exists. Cannot overwrite existing file, so I will skip it`
`${CONSOLE_TAG} File: ${targetFilepath} already exists. Cannot overwrite existing file, so I will skip it`,
);

await fs.link(sourceFilepath, targetFilepath);
})
}),
);
},
},
Expand Down
12 changes: 6 additions & 6 deletions plugins/astro-language/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ const plugin = (options: Options): AstroIntegration => {
hooks: {
"astro:config:setup": async ({ injectScript, command }) => {
const supportedLanguageCodes = await runResolver(
options.supportedLanguageCodes
options.supportedLanguageCodes,
);
if (supportedLanguageCodes.length < 0)
throw Error(
"Language plugin requires at least 1 language code to be supported"
"Language plugin requires at least 1 language code to be supported",
);

config = {
Expand All @@ -69,7 +69,7 @@ const plugin = (options: Options): AstroIntegration => {
const nodeModulePath = path.join(
process.cwd(),
config.pathToNodeModules,
NODE_MODULE_NAME
NODE_MODULE_NAME,
);

try {
Expand Down Expand Up @@ -107,7 +107,7 @@ const plugin = (options: Options): AstroIntegration => {
localPathPrefixes: LOCAL_PATH_PREFIXES,
protocolIdentifier: PROTOCOL_IDENTIFIER,
publicPrefix: PUBLIC_PREFIX,
})}).then().catch();`
})}).then().catch();`,
);
}
},
Expand Down Expand Up @@ -137,7 +137,7 @@ const plugin = (options: Options): AstroIntegration => {
});

const anchorElements: HTMLAnchorElement[] = Array.from(
document.querySelectorAll("a")
document.querySelectorAll("a"),
) as any[];

const transformAnchorTasks = anchorElements.map(anchorTransformer);
Expand All @@ -163,7 +163,7 @@ const plugin = (options: Options): AstroIntegration => {

console.log(
CONSOLE_TAG +
`Done! A total of ${transformedAnchorsTotal} A-tags were changed, in a total of ${transformedFilesTotal} files`
`Done! A total of ${transformedAnchorsTotal} A-tags were changed, in a total of ${transformedFilesTotal} files`,
);
console.log("");
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/astro-language/module/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const transformAllAnchors = async (config) => {

const transformAnchorTasks = anchorElements.map(anchorTransformer);
const changedAnchorsHrefs = (await Promise.all(transformAnchorTasks)).filter(
(href) => Boolean(href)
(href) => Boolean(href),
);

if (config.logChanges)
Expand Down
4 changes: 2 additions & 2 deletions plugins/astro-language/module/transform-anchor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export interface TransformerConfig {
}

export type AnchorTransformer = (
anchor: HTMLAnchorElement
anchor: HTMLAnchorElement,
) => Promise<string | undefined>;

export type CreateAnchorTransformer = (
config: TransformerConfig
config: TransformerConfig,
) => AnchorTransformer;

declare const createAnchorTransformer: CreateAnchorTransformer;
8 changes: 4 additions & 4 deletions plugins/astro-language/module/transform-anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ export const createAnchorTransformer = (config) => {
const shoudNotChangeHref =
originalHref.includes(config.protocolIdentifier) || // Link contains a protocol, only local links should be changed
config.excludeStartWithPatterns.some((pattern) =>
originalHref.startsWith(pattern)
originalHref.startsWith(pattern),
); // If link starts with something like `mailto:`
if (shoudNotChangeHref) return;

// Contains the public prefix, links with this prefix will not be changed
if (originalHref.startsWith(config.publicPrefix)) {
anchor.setAttribute(
"href",
`${originalHref.substring(config.publicPrefix.length)}`
`${originalHref.substring(config.publicPrefix.length)}`,
);
return originalHref;
}

const pathPrefix =
config.localPathPrefixes.find((prefix) =>
originalHref.startsWith(prefix)
originalHref.startsWith(prefix),
) ?? "";
if (pathPrefix === "") return;

Expand All @@ -40,7 +40,7 @@ export const createAnchorTransformer = (config) => {

anchor.setAttribute(
"href",
`${pathPrefix}${config.language}/${hrefWithoutPrefix}`
`${pathPrefix}${config.language}/${hrefWithoutPrefix}`,
);
anchor.setAttribute("hreflang", config.language);
return originalHref;
Expand Down
6 changes: 3 additions & 3 deletions plugins/astro-language/utils/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export const copyDir = async (packageDir: string, targetDir: string) => {
filesToCopy.map((filename) => {
fs.copyFile(
path.join(packageDir, filename),
path.join(targetDir, filename)
path.join(targetDir, filename),
);
return filename;
})
}),
);
};

Expand Down Expand Up @@ -69,7 +69,7 @@ export const packageDir = async (options: PackageDirOptions) => {
main: packageOptions.entryMain,
types: packageOptions.entryTypes,
exports: packageOptions.exports,
})
}),
);

await copyDir(packageDir, targetDir);
Expand Down
4 changes: 2 additions & 2 deletions plugins/tw-gradient/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = plugin(({ matchUtilities, theme }) => {
"background-image": value,
}),
},
{ values: addDefaultValues(theme("gradients")) }
{ values: addDefaultValues(theme("gradients")) },
);

matchUtilities(
Expand All @@ -37,6 +37,6 @@ module.exports = plugin(({ matchUtilities, theme }) => {
"--tw-border-gradient-background": value,
}),
},
{ values: addDefaultValues(flattenColorPalette(theme("colors"))) }
{ values: addDefaultValues(flattenColorPalette(theme("colors"))) },
);
});
4 changes: 2 additions & 2 deletions plugins/tw-gradient/utils/flattenColorPalette.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const flattenColorPalette = (colors) =>
? Object.entries(flattenColorPalette(values)).map(([number, hex]) => ({
[color + (number === "DEFAULT" ? "" : `-${number}`)]: hex,
}))
: [{ [`${color}`]: values }]
)
: [{ [`${color}`]: values }],
),
);

module.exports = flattenColorPalette;
Loading

0 comments on commit c351a10

Please sign in to comment.