Skip to content

Commit df8ab2e

Browse files
authored
chore(lint): migrate rslint to flat config (#1101)
1 parent bc58899 commit df8ab2e

File tree

9 files changed

+29
-47
lines changed

9 files changed

+29
-47
lines changed

.vscode/extensions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"recommendations": [
3+
"rstack.rslint",
34
"biomejs.biome",
45
"esbenp.prettier-vscode",
56
"unifiedjs.vscode-mdx"

e2e/test-api/fixtures/moduleNotFound.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const expectNotFound = async () => {
55
// @ts-expect-error
66
const res = await import('404');
77
return res;
8-
} catch (_err) {
8+
} catch {
99
return null;
1010
}
1111
};

packages/browser/src/hostController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,10 +1573,10 @@ const createBrowserRuntime = async ({
15731573
dispatchHandlers,
15741574
wss,
15751575
};
1576-
} catch (_error) {
1576+
} catch (error) {
15771577
wss.close();
15781578
await devServer.close();
1579-
throw _error;
1579+
throw error;
15801580
}
15811581
};
15821582

packages/browser/src/watchCliShortcuts.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ export async function setupBrowserWatchCliShortcuts({
7070
try {
7171
process.stdin.setRawMode(false);
7272
process.stdin.pause();
73-
} catch {}
73+
} catch {
74+
// do nothing
75+
}
7476

7577
process.stdin.off('keypress', handleKeypress);
7678
};

packages/core/src/core/rsbuild.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function parseInlineSourceMapStr(code: string) {
4747
const base64Data = match[1];
4848
const decodedStr = Buffer.from(base64Data, 'base64').toString('utf-8');
4949
return decodedStr;
50-
} catch (_error) {
50+
} catch {
5151
return null;
5252
}
5353
}

packages/core/src/runtime/runner/runner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export class TestRunner {
142142
},
143143
],
144144
};
145-
} catch (_err) {
145+
} catch {
146146
result = {
147147
testId: test.testId,
148148
project,

packages/core/src/runtime/worker/loadModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const createRequire = (
1919
try {
2020
// compat with some testPath may not be an available path but the third-party package name
2121
return createNativeRequire(filename);
22-
} catch (_err) {
22+
} catch {
2323
return createNativeRequire(distPath);
2424
}
2525
})();

rslint.config.mts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { defineConfig, ts } from '@rslint/core';
2+
3+
export default defineConfig([
4+
{ ignores: ['**/dist/**', '**/dist-types/**'] },
5+
ts.configs.recommended,
6+
{
7+
languageOptions: {
8+
parserOptions: {
9+
project: ['./packages/*/tsconfig.json'],
10+
},
11+
},
12+
rules: {
13+
'@typescript-eslint/no-unused-vars': 'off',
14+
'@typescript-eslint/ban-ts-comment': 'off',
15+
'@typescript-eslint/no-explicit-any': 'off',
16+
'@typescript-eslint/no-require-imports': 'off',
17+
},
18+
},
19+
]);

rslint.jsonc

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

0 commit comments

Comments
 (0)