Skip to content

Commit 0d6a2da

Browse files
pengooseDevhackerwins
authored andcommitted
Fix eslint cleanup SDK (#1023)
* Add ESLint ignore patterns for build and test files Configure ESLint to skip linting build artifacts and test files (*_test.ts, *_spec.ts, *.bench.ts) during the lint step. * Add Linting script(package.json) * Add pnpm >=9.6.0 to sdk engines Add "pnpm": ">=9.6.0" to the engines field of the SDK package. Leverage .npmrc’s engine-strict setting to warn when installing dependencies with an incompatible pnpm version. Ensure all contributors and CI use pnpm version 9.6.0 or higher. * Align ignorePattern with root ignore * Add linting script * Cleanup ESLint(packages/devtools) * Adjust devDependencies depth of eslint plugins * Cleanup ESLint(examples & schema)
1 parent 5f683b1 commit 0d6a2da

File tree

25 files changed

+929
-807
lines changed

25 files changed

+929
-807
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
node-version: [18.x]
17+
node-version: [22.x]
1818
steps:
1919
- uses: actions/checkout@v4
2020

.github/workflows/devtools-publish.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ jobs:
2020
- name: Setup Node 🔧
2121
uses: actions/setup-node@v4
2222
with:
23-
node-version: '18'
23+
node-version: '22'
2424
cache: 'pnpm'
2525

2626
- name: Install and Build 🔧
27+
env:
28+
PARCEL_WORKER_BACKEND: process
2729
run: |
28-
cd packages/devtools
29-
pnpm install
30-
pnpm build
30+
pnpm i
31+
pnpm devtools build
3132
3233
- name: Deploy 🚀
3334
uses: PlasmoHQ/bpp@v3

.github/workflows/github-page-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Node 🔧
2020
uses: actions/setup-node@v4
2121
with:
22-
node-version: '18'
22+
node-version: '22'
2323
cache: 'pnpm'
2424
cache-dependency-path: pnpm-lock.yaml
2525

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Node 🔧
2020
uses: actions/setup-node@v4
2121
with:
22-
node-version: '18'
22+
node-version: '22'
2323
cache: 'pnpm'
2424
cache-dependency-path: pnpm-lock.yaml
2525
registry-url: 'https://registry.npmjs.org'

examples/nextjs-quill/lib/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export const toDeltaOperation = <T extends TextValueType>(textValue: T): Op => {
2323
};
2424

2525
// Convert array of Yorkie OperationInfo to array of Quill Delta Operations
26-
export const getDeltaOperations = (ops: OperationInfo[]): Op[] => {
27-
const operations: Op[] = [];
26+
export const getDeltaOperations = (ops: Array<OperationInfo>): Array<Op> => {
27+
const operations: Array<Op> = [];
2828
let prevTo = 0;
2929

3030
for (const op of ops) {

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
"eslint": "^8.57.1",
3737
"eslint-plugin-jsdoc": "^50.7.1",
3838
"eslint-plugin-prettier": "^5.2.3",
39+
"@typescript-eslint/eslint-plugin": "^6.21.0",
40+
"@typescript-eslint/parser": "^6.21.0",
3941
"husky": "^9.1.7",
4042
"lint-staged": "^15.4.3",
4143
"only-allow": "^1.2.1"

packages/devtools/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
{
22
"name": "@yorkie-js/devtools",
33
"displayName": "Yorkie Devtools",
4-
"version": "0.6.0",
4+
"version": "0.6.21",
55
"description": "A browser extension that helps you debug Yorkie.",
66
"homepage": "https://yorkie.dev/",
77
"scripts": {
88
"dev": "plasmo dev --build-path=dist",
99
"build": "plasmo build --build-path=dist --zip",
10-
"test": "plasmo test"
10+
"test": "plasmo test",
11+
"lint": "eslint . --fix --max-warnings=0 --ext .ts,.tsx"
1112
},
1213
"dependencies": {
1314
"@microlink/react-json-view": "^1.23.0",
15+
"@yorkie-js/sdk": "workspace:*",
1416
"classnames": "^2.3.2",
15-
"plasmo": "0.84.0",
17+
"plasmo": "0.90.5",
1618
"prism-react-renderer": "^2.3.1",
1719
"rc-slider": "^10.5.0",
1820
"react": "18.2.0",
1921
"react-arborist": "^3.4.0",
2022
"react-dom": "18.2.0",
2123
"react-resizable-layout": "^0.7.2",
22-
"use-resize-observer": "^9.1.0",
23-
"@yorkie-js/sdk": "workspace:*"
24+
"use-resize-observer": "^9.1.0"
2425
},
2526
"devDependencies": {
2627
"@types/chrome": "0.0.251",

packages/devtools/src/devtools/components/Code.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ const theme: PrismTheme = {
6262
],
6363
};
6464

65+
/**
66+
* Renders a syntax-highlighted code block using Prism.
67+
*
68+
* @param code - The source code string to be highlighted.
69+
* @param language - The language identifier supported by Prism
70+
* (See https://prismjs.com/index.html#supported-languages for supported languages).
71+
* @param withLineNumbers - Whether to display line numbers before each line.
72+
* Defaults to `false`.
73+
* @returns A React element containing the highlighted code block.
74+
*/
6575
export function Code({
6676
code,
6777
language,

packages/devtools/src/devtools/components/Detail.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ type FlatTreeNodeInfo = Devtools.TreeNodeInfo & {
2828
};
2929

3030
/**
31-
* `nodeIDToString` converts the given CRDTTreeNodeIDStruct to a simple string.
31+
* Convert a CRDTTreeNodeIDStruct into a readable identifier string.
32+
*
33+
* @param id - CRDTTreeNodeIDStruct with creation metadata and offset.
34+
* @returns A string formatted as `${lamport}:${actorID.slice(-2)}:${delimiter}/${offset}`.
3235
*/
3336
const nodeIDToString = (id: CRDTTreeNodeIDStruct) => {
3437
const {
@@ -38,6 +41,11 @@ const nodeIDToString = (id: CRDTTreeNodeIDStruct) => {
3841
return `${lamport}:${actorID.slice(-2)}:${delimiter}/${offset}`;
3942
};
4043

44+
/**
45+
* Render one tree node with depth-based styling and tooltip info.
46+
*
47+
* @param props.node - FlatTreeNodeInfo including type, value, id, depth, childIndex, etc.
48+
*/
4149
function TreeNode({ node }: { node: FlatTreeNodeInfo }) {
4250
// NOTE(chacha912): The 'depth' variable is used for styling purposes.
4351
// For 'text' nodes, when they are not the first child node, 'depth' is
@@ -94,6 +102,11 @@ function TreeNode({ node }: { node: FlatTreeNodeInfo }) {
94102
);
95103
}
96104

105+
/**
106+
* Flatten the tree and render each node via TreeNode.
107+
*
108+
* @param props.tree - Root Devtools.TreeNodeInfo to flatten and display.
109+
*/
97110
function TreeGraph({ tree }: { tree: Devtools.TreeNodeInfo }) {
98111
const flattenTreeWithDepth = useCallback(
99112
(
@@ -119,6 +132,12 @@ function TreeGraph({ tree }: { tree: Devtools.TreeNodeInfo }) {
119132
);
120133
}
121134

135+
/**
136+
* Show selected node details with JSON or graph view toggle.
137+
*
138+
* @param props.node - The currently selected RootTreeNode.
139+
* @param props.tree - The full Devtools.TreeNodeInfo for graph mode.
140+
*/
122141
export function TreeDetail({
123142
node,
124143
tree,
@@ -162,6 +181,11 @@ export function TreeDetail({
162181
);
163182
}
164183

184+
/**
185+
* Display a JSON string in a syntax‑highlighted code block with line numbers.
186+
*
187+
* @param props.json - The JSON text to render.
188+
*/
165189
export function JSONDetail({ json }: { json: string }) {
166190
return <Code code={json ?? ''} language="json" withLineNumbers />;
167191
}

packages/devtools/src/devtools/components/JsonView.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616

1717
import ReactJsonView from '@microlink/react-json-view';
1818

19+
/**
20+
* Render JSON data using ReactJsonView with custom styling and options.
21+
*
22+
* @param props.src - The JSON object or array to display.
23+
* @returns A React element that visualizes the provided JSON.
24+
*/
1925
export function JSONView({ src }) {
2026
return (
2127
<ReactJsonView

0 commit comments

Comments
 (0)