Loading eslint.config.js +2 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ export default [ files: [ 'astro.config.mjs', 'eslint.config.js', 'scripts/run.js', 'src/**/*.{js,jsx,ts,tsx}', ], rules: { Loading Loading @@ -56,5 +57,5 @@ export default [ 'sort-imports': ['error'], yoda: ['error', 'never'], }, }, } ]; scripts/run.js +4 −3 Original line number Diff line number Diff line #!/usr/bin/env node /* eslint-disable sort-imports */ import { spawn } from 'child_process'; import { platform } from 'os'; import { fileURLToPath } from 'url'; Loading @@ -17,14 +18,14 @@ const binaryPath = join(__dirname, '..', 'bin', binaryName); const args = process.argv.slice(2); const acorn = spawn(binaryPath, args, { stdio: 'inherit', shell: isWindows shell: isWindows, }); acorn.on('exit', (code) => { acorn.on('exit', code => { process.exit(code); }); acorn.on('error', (err) => { acorn.on('error', err => { console.error(`Failed to start acorn: ${err.message}`); console.error(`Looking for binary at: ${binaryPath}`); process.exit(1); Loading src/components/Viewer.jsx +13 −11 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ const insight = { chart: 'treemap', columns: { x: 'Age', z: 'Cost', y: 'Cost', z: 'Count' }, // See https://vega.github.io/vega/docs/schemes/#reference Loading @@ -18,18 +18,20 @@ const Viewer = ({ data }) => { }; const [loaded, setLoaded] = useState(false); useEffect(() => { console.log("Viewer loaded"); console.log('Viewer loaded'); const viewer = document.getElementById('viewer'); viewer.contentWindow.postMessage({ action: 'load', data, insight }, '*'); }, [loaded]); return <main> return ( <main> <div> <button>Data A</button> <button>Data B</button> <button>Data C</button> </div> <iframe id="viewer" src="embed.html" width="100%" height="900px" onLoad={handleLoad} loading="lazy"></iframe> </main>; } </main> ); }; export default Viewer; Loading
eslint.config.js +2 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ export default [ files: [ 'astro.config.mjs', 'eslint.config.js', 'scripts/run.js', 'src/**/*.{js,jsx,ts,tsx}', ], rules: { Loading Loading @@ -56,5 +57,5 @@ export default [ 'sort-imports': ['error'], yoda: ['error', 'never'], }, }, } ];
scripts/run.js +4 −3 Original line number Diff line number Diff line #!/usr/bin/env node /* eslint-disable sort-imports */ import { spawn } from 'child_process'; import { platform } from 'os'; import { fileURLToPath } from 'url'; Loading @@ -17,14 +18,14 @@ const binaryPath = join(__dirname, '..', 'bin', binaryName); const args = process.argv.slice(2); const acorn = spawn(binaryPath, args, { stdio: 'inherit', shell: isWindows shell: isWindows, }); acorn.on('exit', (code) => { acorn.on('exit', code => { process.exit(code); }); acorn.on('error', (err) => { acorn.on('error', err => { console.error(`Failed to start acorn: ${err.message}`); console.error(`Looking for binary at: ${binaryPath}`); process.exit(1); Loading
src/components/Viewer.jsx +13 −11 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ const insight = { chart: 'treemap', columns: { x: 'Age', z: 'Cost', y: 'Cost', z: 'Count' }, // See https://vega.github.io/vega/docs/schemes/#reference Loading @@ -18,18 +18,20 @@ const Viewer = ({ data }) => { }; const [loaded, setLoaded] = useState(false); useEffect(() => { console.log("Viewer loaded"); console.log('Viewer loaded'); const viewer = document.getElementById('viewer'); viewer.contentWindow.postMessage({ action: 'load', data, insight }, '*'); }, [loaded]); return <main> return ( <main> <div> <button>Data A</button> <button>Data B</button> <button>Data C</button> </div> <iframe id="viewer" src="embed.html" width="100%" height="900px" onLoad={handleLoad} loading="lazy"></iframe> </main>; } </main> ); }; export default Viewer;