Skip to content

Commit 827ebad

Browse files
committed
Lint, format and type check fixes
1 parent c9074d3 commit 827ebad

File tree

25 files changed

+505
-350
lines changed

25 files changed

+505
-350
lines changed

.eslintrc.js

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

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Setup Node
2626
uses: actions/setup-node@v4
2727
with:
28-
node-version: '20'
28+
node-version: '22'
2929
- name: Install the npm dependencies
3030
run: |
3131
npm install
@@ -45,7 +45,7 @@ jobs:
4545
- name: Setup Node
4646
uses: actions/setup-node@v4
4747
with:
48-
node-version: '20'
48+
node-version: '22'
4949

5050
- name: Install Dependencies
5151
run: npm install

.github/workflows/code-quality.yml

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14-
code-quality:
15-
name: Code Quality Checks
14+
format-check:
15+
name: Format Check (Prettier)
1616
runs-on: ubuntu-latest
1717

1818
steps:
@@ -22,7 +22,30 @@ jobs:
2222
- name: Setup Node.js
2323
uses: actions/setup-node@v4
2424
with:
25-
node-version: '20'
25+
node-version: '22'
26+
27+
- name: Install dependencies
28+
run: npm install
29+
30+
- name: Run Format Checks
31+
run: |
32+
echo "::group::Running Format Checks"
33+
npm run format:check
34+
echo "✓ Prettier passed"
35+
echo "::endgroup::"
36+
37+
lint-check:
38+
name: Lint Check (ESLint)
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
45+
- name: Setup Node.js
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: '22'
2649

2750
- name: Install dependencies
2851
run: npm install
@@ -33,18 +56,27 @@ jobs:
3356
echo "Running ESLint..."
3457
npm run lint
3558
echo "✓ ESLint passed"
36-
echo ""
3759
echo "::endgroup::"
3860
39-
- name: Run Format Checks
40-
run: |
41-
echo "::group::Running Format Checks"
42-
npm run format:check
43-
echo "✓ Prettier passed"
44-
echo ""
45-
echo "::endgroup::"
61+
type-check:
62+
name: Type Check (TypeScript)
63+
runs-on: ubuntu-latest
64+
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v4
68+
69+
- name: Setup Node.js
70+
uses: actions/setup-node@v4
71+
with:
72+
node-version: '22'
73+
74+
- name: Install dependencies
75+
run: npm install
76+
4677
- name: Build project
4778
run: npm run build
79+
4880
- name: Run Type Checks
4981
run: |
5082
echo "::group::Running Type Checks"

.npmrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Use legacy peer deps to avoid conflicts
2+
legacy-peer-deps=true
3+
4+
# Disable progress to reduce CI log noise
5+
progress=false

examples/next-js/next.config.ts renamed to examples/next-js/next.config.mjs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,26 @@
44
* MIT License
55
*/
66

7-
const webpack = require('webpack');
8-
const path = require('path');
7+
import webpack from 'webpack';
8+
import { fileURLToPath } from 'url';
9+
import { dirname, resolve } from 'path';
10+
import { createRequire } from 'module';
11+
12+
const __filename = fileURLToPath(import.meta.url);
13+
const __dirname = dirname(__filename);
14+
const require = createRequire(import.meta.url);
915

1016
/** @type {import('next').NextConfig} */
1117
const nextConfig = {
1218
reactStrictMode: false,
1319
transpilePackages: ['@jupyterlab/settingregistry', '@jupyterlite/settings'],
14-
webpack: (config: any, options: any) => {
20+
// Skip Next.js built-in ESLint during build (monorepo has its own ESLint setup)
21+
// This avoids ESLint 9 compatibility warnings from Next.js 14's ESLint config
22+
eslint: {
23+
ignoreDuringBuilds: true,
24+
},
25+
webpack: (config, options) => {
26+
1527
config.resolve.fallback = {
1628
...config.resolve.fallback,
1729
buffer: require.resolve('buffer/'),
@@ -25,14 +37,14 @@ const nextConfig = {
2537
config.resolve.alias = {
2638
...config.resolve.alias,
2739
json5: require.resolve('json5/lib/index.js'),
28-
'~': path.resolve(__dirname, 'node_modules'),
2940
};
30-
// Add a plugin to strip `~` from import paths
31-
config.plugins.push(
32-
new webpack.NormalModuleReplacementPlugin(/^~(.*)/, (resource: any) => {
33-
resource.request = resource.request.replace(/^~/, '');
34-
}),
35-
);
41+
42+
// Add resolve modules to look in monorepo node_modules
43+
config.resolve.modules = [
44+
...(config.resolve.modules || []),
45+
resolve(__dirname, '../../node_modules'),
46+
'node_modules',
47+
];
3648
config.module.rules.push(
3749
{ test: /\.js.map$/, type: 'asset/resource' },
3850
{
@@ -87,4 +99,4 @@ const nextConfig = {
8799
},
88100
};
89101

90-
module.exports = nextConfig;
102+
export default nextConfig;

examples/next-js/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@datalayer/icons-react": "^1.0.0",
1313
"@datalayer/jupyter-react": "^1.0.7",
1414
"@datalayer/primer-addons": "^1.0.4",
15-
"next": "^15.4.1",
15+
"next": "14.2.18",
1616
"next-themes": "^0.4.6",
1717
"react": "^19.0.0",
1818
"react-dom": "^19.0.0",
@@ -24,6 +24,7 @@
2424
"@types/react": "^18",
2525
"@types/react-dom": "^18",
2626
"buffer": "^6.0.3",
27+
"eslint-config-next": "^15.5.5",
2728
"tailwindcss": "^4",
2829
"typescript": "^5"
2930
}

examples/next-js/src/app/error.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2021-2023 Datalayer, Inc.
3+
*
4+
* MIT License
5+
*/
6+
7+
'use client';
8+
9+
// Disable static generation for error pages
10+
export const dynamic = 'force-dynamic';
11+
12+
export default function Error({
13+
error,
14+
reset,
15+
}: {
16+
error: Error & { digest?: string };
17+
reset: () => void;
18+
}) {
19+
return (
20+
<div style={{ padding: '2rem', textAlign: 'center' }}>
21+
<h2>Something went wrong!</h2>
22+
<p>Please refresh the page or try again.</p>
23+
<button
24+
onClick={reset}
25+
style={{
26+
marginTop: '1rem',
27+
padding: '0.5rem 1rem',
28+
backgroundColor: '#0070f3',
29+
color: 'white',
30+
border: 'none',
31+
borderRadius: '5px',
32+
cursor: 'pointer',
33+
}}
34+
>
35+
Try again
36+
</button>
37+
</div>
38+
);
39+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2021-2023 Datalayer, Inc.
3+
*
4+
* MIT License
5+
*/
6+
7+
'use client';
8+
9+
export default function GlobalError({
10+
error,
11+
reset,
12+
}: {
13+
error: Error & { digest?: string };
14+
reset: () => void;
15+
}) {
16+
return (
17+
<html lang="en">
18+
<body>
19+
<div style={{ padding: '2rem', textAlign: 'center' }}>
20+
<h2>Something went wrong!</h2>
21+
<p>Please refresh the page or try again.</p>
22+
<button
23+
onClick={reset}
24+
style={{
25+
marginTop: '1rem',
26+
padding: '0.5rem 1rem',
27+
backgroundColor: '#0070f3',
28+
color: 'white',
29+
border: 'none',
30+
borderRadius: '5px',
31+
cursor: 'pointer',
32+
}}
33+
>
34+
Try again
35+
</button>
36+
</div>
37+
</body>
38+
</html>
39+
);
40+
}

0 commit comments

Comments
 (0)