Skip to content

Commit eaf8ca9

Browse files
authored
[add] Language Selector controller (#54)
1 parent e750c70 commit eaf8ca9

28 files changed

+8606
-294
lines changed

.eslintrc.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/pr-badge.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- icon: visualstudio
2+
label: 'GitHub.dev'
3+
message: 'PR-$prNumber'
4+
color: 'blue'
5+
url: 'https://github.dev/$owner/$repo/pull/$prNumber'
6+
7+
- icon: github
8+
label: 'GitHub codespaces'
9+
message: 'PR-$prNumber'
10+
color: 'black'
11+
url: 'https://codespaces.new/$owner/$repo/pull/$prNumber'
12+
13+
- icon: git
14+
label: 'GitPod.io'
15+
message: 'PR-$prNumber'
16+
color: 'orange'
17+
url: 'https://gitpod.io/?autostart=true#https://github.com/$owner/$repo/pull/$prNumber'

.github/settings.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
2+
3+
repository:
4+
allow_merge_commit: false
5+
6+
delete_branch_on_merge: true
7+
8+
enable_vulnerability_alerts: true
9+
10+
labels:
11+
- name: bug
12+
color: '#d73a4a'
13+
description: Something isn't working
14+
15+
- name: documentation
16+
color: '#0075ca'
17+
description: Improvements or additions to documentation
18+
19+
- name: duplicate
20+
color: '#cfd3d7'
21+
description: This issue or pull request already exists
22+
23+
- name: enhancement
24+
color: '#a2eeef'
25+
description: Some improvements
26+
27+
- name: feature
28+
color: '#16b33f'
29+
description: New feature or request
30+
31+
- name: good first issue
32+
color: '#7057ff'
33+
description: Good for newcomers
34+
35+
- name: help wanted
36+
color: '#008672'
37+
description: Extra attention is needed
38+
39+
- name: invalid
40+
color: '#e4e669'
41+
description: This doesn't seem right
42+
43+
- name: question
44+
color: '#d876e3'
45+
description: Further information is requested
46+
47+
- name: wontfix
48+
color: '#ffffff'
49+
description: This will not be worked on
50+
51+
branches:
52+
- name: master
53+
# https://docs.github.com/en/rest/reference/repos#update-branch-protection
54+
protection:
55+
# Required. Require at least one approving review on a pull request, before merging. Set to null to disable.
56+
required_pull_request_reviews:
57+
# The number of approvals required. (1-6)
58+
required_approving_review_count: 1
59+
# Dismiss approved reviews automatically when a new commit is pushed.
60+
dismiss_stale_reviews: true
61+
# Blocks merge until code owners have reviewed.
62+
require_code_owner_reviews: true
63+
# Specify which users and teams can dismiss pull request reviews.
64+
# Pass an empty dismissal_restrictions object to disable.
65+
# User and team dismissal_restrictions are only available for organization-owned repositories.
66+
# Omit this parameter for personal repositories.
67+
dismissal_restrictions:
68+
# users: []
69+
# teams: []
70+
# Required. Require status checks to pass before merging. Set to null to disable
71+
required_status_checks:
72+
# Required. Require branches to be up to date before merging.
73+
strict: true
74+
# Required. The list of status checks to require in order to merge into this branch
75+
contexts: []
76+
# Required. Enforce all configured restrictions for administrators.
77+
# Set to true to enforce required status checks for repository administrators.
78+
# Set to null to disable.
79+
enforce_admins: true
80+
# Prevent merge commits from being pushed to matching branches
81+
required_linear_history: true
82+
# Required. Restrict who can push to this branch.
83+
# Team and user restrictions are only available for organization-owned repositories.
84+
# Set to null to disable.
85+
restrictions: null

.github/workflows/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ jobs:
1111
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515

16-
- uses: pnpm/action-setup@v2
16+
- uses: pnpm/action-setup@v4
1717
with:
1818
version: 9
19-
- uses: actions/setup-node@v3
19+
- uses: actions/setup-node@v4
2020
with:
21-
node-version: 18
21+
node-version: 20
2222
cache: pnpm
2323
- name: Install & Build
2424
run: |
2525
pnpm i --frozen-lockfile
2626
pnpm build
2727
2828
- name: Deploy to GitHub pages
29-
uses: peaceiris/actions-gh-pages@v3
29+
uses: peaceiris/actions-gh-pages@v4
3030
with:
3131
publish_dir: ./dist
3232
cname: web-conf.dev

.github/workflows/push.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ jobs:
1111
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515

16-
- uses: pnpm/action-setup@v2
16+
- uses: pnpm/action-setup@v4
1717
with:
1818
version: 9
19-
- uses: actions/setup-node@v3
19+
- uses: actions/setup-node@v4
2020
with:
21-
node-version: 18
21+
node-version: 20
2222
cache: pnpm
2323
- name: Install & Build
2424
run: |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ npm start
3939
### 导入素材
4040

4141
```shell
42-
node toolkit/import-assets path/to/media/folder
42+
npx tsx toolkit/import-assets path/to/media/folder
4343
```
4444

4545
[2]: https://github.com/FreeCodeCamp-Chengdu/Web-Conf/actions/workflows/main.yml

eslint.config.mjs

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { fixupPluginRules } from '@eslint/compat';
2+
import eslint from '@eslint/js';
3+
import eslintConfigPrettier from 'eslint-config-prettier';
4+
import reactPlugin from 'eslint-plugin-react';
5+
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
6+
import globals from 'globals';
7+
import tsEslint from 'typescript-eslint';
8+
import { fileURLToPath } from 'url';
9+
10+
const tsconfigRootDir = fileURLToPath(new URL('.', import.meta.url));
11+
12+
export default tsEslint.config(
13+
// register all of the plugins up-front
14+
{
15+
plugins: {
16+
'@typescript-eslint': tsEslint.plugin,
17+
// @ts-expect-error https://github.com/jsx-eslint/eslint-plugin-react/issues/3699
18+
react: fixupPluginRules(reactPlugin),
19+
'simple-import-sort': simpleImportSortPlugin
20+
}
21+
},
22+
// config with just ignores is the replacement for `.eslintignore`
23+
{ ignores: ['**/node_modules/**', '**/dist/**', '**/.parcel-cache/**'] },
24+
25+
// extends ...
26+
eslint.configs.recommended,
27+
...tsEslint.configs.recommended,
28+
29+
// base config
30+
{
31+
languageOptions: {
32+
globals: { ...globals.es2022, ...globals.browser, ...globals.node },
33+
parserOptions: {
34+
projectService: true,
35+
tsconfigRootDir,
36+
warnOnUnsupportedTypeScriptVersion: false
37+
}
38+
},
39+
rules: {
40+
'simple-import-sort/exports': 'error',
41+
'simple-import-sort/imports': 'error',
42+
'@typescript-eslint/no-unused-vars': 'warn',
43+
'@typescript-eslint/no-explicit-any': 'warn',
44+
'@typescript-eslint/no-empty-object-type': 'off',
45+
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
46+
'react/jsx-no-target-blank': 'warn',
47+
'react/jsx-sort-props': [
48+
'error',
49+
{
50+
reservedFirst: true,
51+
callbacksLast: true,
52+
noSortAlphabetically: true
53+
}
54+
]
55+
}
56+
},
57+
{
58+
files: ['**/*.js'],
59+
extends: [tsEslint.configs.disableTypeChecked],
60+
rules: {
61+
// turn off other type-aware rules
62+
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off',
63+
64+
// turn off rules that don't apply to JS code
65+
'@typescript-eslint/explicit-function-return-type': 'off'
66+
}
67+
},
68+
eslintConfigPrettier
69+
);

package.json

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,50 +28,62 @@
2828
"build": "npm run clean && parcel build source/index.html --public-url . && npm run pack-sw"
2929
},
3030
"lint-staged": {
31-
"*.{ts,tsx}": "eslint --fix",
32-
"*.{html,md,css,less,js,ts,tsx,json}": "prettier --write"
31+
"*.{js,mjs,ts,tsx}": "eslint --fix",
32+
"*.{html,md,css,less,js,mjs,ts,tsx,json}": "prettier --write"
3333
},
3434
"dependencies": {
3535
"boot-cell": "^2.0.0-beta.29",
3636
"browser-unhandled-rejection": "^1.0.2",
3737
"cell-router": "^3.0.0-rc.8",
3838
"classnames": "^2.5.1",
39-
"dom-renderer": "^2.1.8",
39+
"dom-renderer": "^2.4.4",
4040
"html-to-image": "^1.11.11",
41-
"koajax": "^1.1.2",
41+
"iterable-observer": "^1.1.0",
42+
"koajax": "^3.0.3",
4243
"lodash.groupby": "^4.6.0",
43-
"marked": "^13.0.0",
44-
"mobx": "^6.12.4",
45-
"mobx-i18n": "^0.5.0",
46-
"mobx-restful": "1.0.0-rc.5",
47-
"web-cell": "^3.0.0-rc.16",
48-
"web-utility": "^4.4.0"
44+
"marked": "^14.1.4",
45+
"mobx": "^6.13.5",
46+
"mobx-i18n": "^0.6.0",
47+
"mobx-restful": "2.0.0",
48+
"web-cell": "^3.0.1",
49+
"web-utility": "^4.4.2"
4950
},
5051
"devDependencies": {
52+
"@eslint/compat": "^1.2.2",
53+
"@eslint/js": "^9.14.0",
5154
"@parcel/config-default": "~2.12.0",
5255
"@parcel/packager-raw-url": "~2.12.0",
5356
"@parcel/transformer-less": "~2.12.0",
5457
"@parcel/transformer-typescript-tsc": "~2.12.0",
5558
"@parcel/transformer-webmanifest": "~2.12.0",
59+
"@softonus/prettier-plugin-duplicate-remover": "^1.0.1",
60+
"@types/eslint-config-prettier": "^6.11.3",
5661
"@types/lodash.groupby": "^4.6.9",
57-
"@types/node": "^18.19.36",
58-
"@typescript-eslint/eslint-plugin": "^7.13.1",
59-
"@typescript-eslint/parser": "^7.13.1",
60-
"eslint": "^8.57.0",
62+
"@types/node": "^20.17.6",
63+
"eslint": "^9.14.0",
6164
"eslint-config-prettier": "^9.1.0",
62-
"husky": "^9.0.11",
63-
"lint-staged": "^15.2.7",
65+
"eslint-plugin-react": "^7.37.2",
66+
"eslint-plugin-simple-import-sort": "^12.1.1",
67+
"globals": "^15.12.0",
68+
"husky": "^9.1.6",
69+
"lint-staged": "^15.2.10",
6470
"parcel": "~2.12.0",
65-
"postcss": "^8.4.38",
71+
"postcss": "^8.4.47",
6672
"postcss-modules": "^4.3.1",
67-
"prettier": "^3.3.2",
73+
"prettier": "^3.3.3",
74+
"prettier-plugin-css-order": "^2.1.2",
6875
"process": "^0.11.10",
69-
"typescript": "~5.4.5",
70-
"workbox-cli": "^7.1.0"
76+
"typescript": "~5.6.3",
77+
"typescript-eslint": "^8.13.0",
78+
"workbox-cli": "^7.3.0"
7179
},
7280
"prettier": {
7381
"singleQuote": true,
7482
"trailingComma": "none",
75-
"arrowParens": "avoid"
83+
"arrowParens": "avoid",
84+
"plugins": [
85+
"prettier-plugin-css-order",
86+
"@softonus/prettier-plugin-duplicate-remover"
87+
]
7688
}
7789
}

0 commit comments

Comments
 (0)