fix(playground): bad type check
MODIFY
.github/workflows/pull_request_js.yml
.github/workflows/pull_request_js.yml
@@ -28,3 +28,31 @@ jobs:
- name: Run Rome Format
run: rome ci editors website
+ type-check:
+ name: Type-check JS Files
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout PR Branch
+ uses: actions/checkout@v3
+ with:
+ submodules: false
+ - uses: jetli/wasm-pack-action@v0.3.0
+ - name: Cache pnpm modules
+ uses: actions/cache@v3
+ with:
+ path: ~/.pnpm-store
+ key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
+ restore-keys: |
+ ${{ runner.os }}-
+ - uses: pnpm/action-setup@v2.1.0
+ with:
+ version: 7
+ - name: Install libraries
+ working-directory: website/playground
+ run: pnpm i
+ - name: Build Wasm
+ working-directory: website/playground
+ run: pnpm build
+ - name: Type check
+ working-directory: website/playground
+ run: pnpm tsc

MODIFY
website/playground/package.json
website/playground/package.json
"build:wasm": "wasm-pack build --target web --release",
"build:wasm-dev": "wasm-pack build --target web --dev",
"format": "cargo run -p rome_cli --release -- format --write ./src",
- "format:rome": "rome format --write src ."
+ "format:rome": "rome format --write src .",
+ "tsc": "tsc"
},
"dependencies": {
"@uiw/react-textarea-code-editor": "^1.4.16",

MODIFY
website/playground/src/utils.ts
website/playground/src/utils.ts
@@ -18,7 +18,7 @@ export function classNames(
return classes.filter(Boolean).join(" ");
}
// Only save prop of `PlaygroundState` that we interested
-export const OPTIONS_TO_PERSIST: Array<keyof PlaygroundState> = ["treeStyle"];
+export const OPTIONS_TO_PERSIST: Array<keyof RomeConfiguration> = ["treeStyle"];
// Define general type for useWindowSize hook, which includes width and height
interface Size {
width: number | undefined;
@@ -246,8 +246,7 @@ function mergeRomeConfig(
config: Partial<RomeConfiguration>,
defaultConfig: RomeConfiguration,
): RomeConfiguration {
- const interested_keys: Array<keyof RomeConfiguration> = OPTIONS_TO_PERSIST;
- return interested_keys.reduce((acc, key) => {
+ return OPTIONS_TO_PERSIST.reduce((acc, key) => {
if (config[key]) {
acc[key] = config[key as keyof RomeConfiguration];
} else {

fix(playground): bad type check (#2865)