Skip to content

Commit

Permalink
Lint the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnuttandrew committed Jul 13, 2023
1 parent 1cf53a0 commit fbe90a2
Show file tree
Hide file tree
Showing 12 changed files with 524 additions and 634 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Test and lint
on: [push]
jobs:
test-and-lint:
test-and-lint-package:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -18,3 +18,16 @@ jobs:
- name: Lint 🧵
run: yarn lint
working-directory: ./packages/prong-editor
lint-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/[email protected]

- name: Install 🔧
run: yarn
working-directory: ./sites/docs

- name: Lint 🧵
run: yarn lint
working-directory: ./sites/docs
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"pickr",
"retarget",
"Retargeted",
"seedrandom",
"simonwep",
"tabindex"
]
Expand Down
3 changes: 2 additions & 1 deletion sites/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@types/react": "^17.0.38",
"@types/react-dom": "^17.0.11",
"@types/react-syntax-highlighter": "^15.5.7",
"@types/seedrandom": "^3.0.5",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"@vitejs/plugin-react-swc": "^3.3.2",
Expand All @@ -58,4 +59,4 @@
"vega-datasets": "^2.7.0",
"vite": "^4.4.0"
}
}
}
5 changes: 3 additions & 2 deletions sites/docs/src/examples/TraceryExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function generateRoots(currentCode: string, randomKey: string) {

function getAllNodes(root: TraceryNode) {
const allNodes = [];
let queue = [root];
const queue = [root];
while (queue.length) {
const current = queue.shift()!;
allNodes.push(current);
Expand Down Expand Up @@ -282,6 +282,7 @@ const Editable = (props: {
setTxt(evt.currentTarget.innerHTML);
setContent(evt.currentTarget.innerHTML);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
Expand Down Expand Up @@ -477,7 +478,7 @@ function TraceryExample() {

function clickNode(node: TraceryNode) {
const nodeId = node.id;
setSelectedNodes(selectedNodes.includes(nodeId) ? [] : [nodeId as string]);
setSelectedNodes(selectedNodes.includes(nodeId) ? [] : [nodeId]);
}

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion sites/docs/src/examples/VegaLiteStyler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ function VegaLiteExampleApp() {
})
}
>
{!!state.suggestions.length ? (
{state.suggestions.length ? (
<div>
<button
onClick={() =>
Expand Down
12 changes: 6 additions & 6 deletions sites/docs/src/examples/VegaLiteUseCase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const UploadDataset: FC<{
name="file"
onChange={(event) => {
const file = event.target.files![0];
var reader = new FileReader();
const reader = new FileReader();
reader.onload = function (event) {
const result = event.target!.result;
const inlinedData = utils.simpleParse(result, []);
Expand Down Expand Up @@ -248,11 +248,11 @@ function VegaLiteExampleApp() {
return (
<button
key={file}
onClick={() =>
buildFileGet(file, currentCode).then((x) =>
setCurrentCode(x)
)
}
onClick={() => {
buildFileGet(file, currentCode)
.then((x) => setCurrentCode(x))
.catch((e) => console.error(e));
}}
>
{file}
</button>
Expand Down
1 change: 1 addition & 0 deletions sites/docs/src/examples/example-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ export const produceSchema: any = {
veggie: {
type: "object",
required: ["veggieName", "veggieLike"],
additionalproperties: false,
properties: {
veggieName: {
type: "string",
Expand Down
8 changes: 6 additions & 2 deletions sites/docs/src/examples/example-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export const usePersistedState = (name: string, defaultValue: any) => {
useEffect(() => {
try {
localStorage.setItem(nameRef.current, value);
} catch {}
} catch (e) {
console.error(e);
}
}, [value]);

useEffect(() => {
Expand All @@ -45,7 +47,9 @@ export const usePersistedState = (name: string, defaultValue: any) => {
localStorage.setItem(name, value);
nameRef.current = name;
localStorage.removeItem(lastName);
} catch {}
} catch (e) {
console.error(e);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [name]);
Expand Down
2 changes: 1 addition & 1 deletion sites/docs/src/examples/histograms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function buildHistogramProjection(
pointerEvents: "none",
x:
xScale.bandwidth() / 2 +
(!!selectedBin ? xScale(selectedBin.x0 as any) || 0 : 0),
(selectedBin ? xScale(selectedBin.x0 as any) || 0 : 0),
};
const chartProps = {
histogram,
Expand Down
Loading

0 comments on commit fbe90a2

Please sign in to comment.