Skip to content

Commit

Permalink
chore: use prettier to format code (RSSNext#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
Innei authored Sep 9, 2024
1 parent 501e2f4 commit 26d01fd
Show file tree
Hide file tree
Showing 336 changed files with 16,123 additions and 13,667 deletions.
3 changes: 1 addition & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Before submitting the PR, please make sure you do the following:

### Linked Issues


### Additional context

<!-- e.g. is there anything you'd like reviewers to focus on? -->
<!-- e.g. is there anything you'd like reviewers to focus on? -->
8 changes: 4 additions & 4 deletions .github/actions/setup-version/action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Setup Version
description: 'Setup Version'
description: "Setup Version"
outputs:
APP_VERSION:
description: 'App Version'
description: "App Version"
value: ${{ steps.version.outputs.APP_VERSION }}
runs:
using: 'composite'
using: "composite"
steps:
- name: 'Write Version'
- name: "Write Version"
id: version
shell: bash
run: |
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/hono.ts
7 changes: 7 additions & 0 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
semi: false,
singleQuote: false,
printWidth: 100,
tabWidth: 2,
trailingComma: "all",
}
5 changes: 1 addition & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// ["tw\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]

["tw`([^`]*)`", "([^`]*)"]

],

// If you do not want to autofix some rules on save
Expand All @@ -37,9 +36,7 @@
{ "rule": "prefer-const", "severity": "off" },
{ "rule": "unused-imports/no-unused-imports", "severity": "off" }
],
"cSpell.words": [
"rsshub"
],
"cSpell.words": ["rsshub"],
"editor.foldingImportsByDefault": true,
"commentTranslate.hover.enabled": false,
"typescript.tsdk": "node_modules/typescript/lib"
Expand Down
2,085 changes: 1,034 additions & 1,051 deletions CHANGELOG.md

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ If you have access, you are welcome to use the following methods to download and
- You can get the installation packages for each platform from the [Release page](https://github.com/RSSNext/Follow/releases).
- If you are using Arch linux, you can install package [follow-appimage](https://aur.archlinux.org/packages/follow-appimage) that maintained by [timochan](https://github.com/ttimochan)


## Contributing

If you are eligible to use Follow, you are welcome to join the open source community to build together.
Expand Down
4 changes: 1 addition & 3 deletions electron.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ export default defineConfig({
DEBUG: process.env.DEBUG === "true",
ELECTRON: "true",

RELEASE_CHANNEL: JSON.stringify(
(prerelease(pkg.version)?.[0] as string) || "stable",
),
RELEASE_CHANNEL: JSON.stringify((prerelease(pkg.version)?.[0] as string) || "stable"),
},
},
})
15 changes: 5 additions & 10 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,15 @@ import { defineConfig } from "eslint-config-hyoban"

export default defineConfig(
{
formatting: {
quotes: "double",
arrowParens: true,
braceStyle: "1tbs",
lineBreak: "after",
},
formatting: false,
lessOpinionated: true,
ignores: ["src/renderer/src/hono.ts", "src/hono.ts", "resources/**"],
preferESM: false,
},
{
settings: {
tailwindcss: {
whitelist: [
"center",
],
whitelist: ["center"],
},
},
rules: {
Expand All @@ -30,7 +23,9 @@ export default defineConfig(
"error",
{
name: "location",
message: "Since you don't use the same router instance in electron and browser, you can't use the global location to get the route info. \n\n" + "You can use `useLocaltion` or `getReadonlyRoute` to get the route info.",
message:
"Since you don't use the same router instance in electron and browser, you can't use the global location to get the route info. \n\n" +
"You can use `useLocaltion` or `getReadonlyRoute` to get the route info.",
},
],
},
Expand Down
52 changes: 17 additions & 35 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,9 @@ const ymlMapsMap = {
const keepModules = new Set(["font-list", "vscode-languagedetection"])
const keepLanguages = new Set(["en", "en_GB", "zh_CN", "zh-CN", "en-GB"])
// remove folders & files not to be included in the app
async function cleanSources(
buildPath,
electronVersion,
platform,
arch,
callback,
) {
async function cleanSources(buildPath, electronVersion, platform, arch, callback) {
// folders & files to be included in the app
const appItems = new Set([
"dist",
"node_modules",
"package.json",
"resources",
])
const appItems = new Set(["dist", "node_modules", "package.json", "resources"])

if (platform === "darwin") {
const frameworkResourcePath = resolve(
Expand All @@ -60,9 +49,7 @@ async function cleanSources(

await Promise.all([
...(await readdir(buildPath).then((items) =>
items
.filter((item) => !appItems.has(item))
.map((item) => rimraf(path.join(buildPath, item))),
items.filter((item) => !appItems.has(item)).map((item) => rimraf(path.join(buildPath, item))),
)),
...(await readdir(path.join(buildPath, "node_modules")).then((items) =>
items
Expand All @@ -74,9 +61,7 @@ async function cleanSources(
callback()
}

const ignorePattern = new RegExp(
`^/node_modules/(?!${[...keepModules].join("|")})`,
)
const ignorePattern = new RegExp(`^/node_modules/(?!${[...keepModules].join("|")})`)

const config: ForgeConfig = {
packagerConfig: {
Expand All @@ -98,18 +83,18 @@ const config: ForgeConfig = {
...(process.env.APPLE_ID &&
process.env.APPLE_PASSWORD &&
process.env.APPLE_TEAM_ID && {
osxSign: {
optionsForFile: () => ({
entitlements: "build/entitlements.mac.plist",
}),
keychain: process.env.KEYCHAIN_PATH,
},
osxNotarize: {
appleId: process.env.APPLE_ID!,
appleIdPassword: process.env.APPLE_PASSWORD!,
teamId: process.env.APPLE_TEAM_ID!,
},
}),
osxSign: {
optionsForFile: () => ({
entitlements: "build/entitlements.mac.plist",
}),
keychain: process.env.KEYCHAIN_PATH,
},
osxNotarize: {
appleId: process.env.APPLE_ID!,
appleIdPassword: process.env.APPLE_PASSWORD!,
teamId: process.env.APPLE_TEAM_ID!,
},
}),
},
rebuildConfig: {},
makers: [
Expand Down Expand Up @@ -204,10 +189,7 @@ const config: ForgeConfig = {

try {
const fileData = fs.readFileSync(newArtifact)
const hash = crypto
.createHash("sha512")
.update(fileData)
.digest("base64")
const hash = crypto.createHash("sha512").update(fileData).digest("base64")
const { size } = fs.statSync(newArtifact)

yml.files.push({
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"dev": "electron-vite dev --outDir=dist",
"dev:debug": "export DEBUG=true && vite --debug",
"dev:web": "vite",
"format": "prettier --write .",
"lint": "eslint",
"lint:fix": "eslint --fix",
"polyfill-optimize": "pnpx nolyfill install",
Expand Down Expand Up @@ -177,6 +178,7 @@
"nbump": "2.0.4",
"postcss": "8.4.41",
"postcss-js": "4.0.1",
"prettier": "3.3.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rimraf": "6.0.1",
Expand Down Expand Up @@ -208,7 +210,10 @@
"pre-commit": "pnpm exec lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
"*": "eslint --fix",
"*.{js,jsx,ts,tsx,json}": [
"prettier --ignore-path ./.gitignore --write "
]
},
"bump": {
"before": [
Expand Down
Loading

0 comments on commit 26d01fd

Please sign in to comment.