Skip to content

Commit 362de6a

Browse files
committed
Fix devserver vite config not being linted
1 parent b4e6444 commit 362de6a

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

devserver/vite.config.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
import fs from 'fs/promises';
44
import pathlib from 'path';
55
import react from '@vitejs/plugin-react';
6-
import { nodePolyfills } from 'vite-plugin-node-polyfills';
7-
import { loadEnv } from 'vite'
86
import { playwright } from '@vitest/browser-playwright';
7+
import { loadEnv } from 'vite';
8+
import { nodePolyfills } from 'vite-plugin-node-polyfills';
99
import { defineProject } from 'vitest/config';
1010
import type { BrowserCommand } from 'vitest/node';
1111

1212
const setLocalStorage: BrowserCommand<[key: string, value: any]> = async (ctx, key, value) => {
1313
if (ctx.provider.name === 'playwright') {
14-
await ctx.page.evaluate(([key, value]) => localStorage.setItem(key, value), [key, value])
14+
await ctx.page.evaluate(([key, value]) => localStorage.setItem(key, value), [key, value]);
1515
}
16-
}
16+
};
1717

1818
export default defineProject(({ mode }) => {
1919
const env = loadEnv(mode, process.cwd());
@@ -61,13 +61,13 @@ export default defineProject(({ mode }) => {
6161
find: /^@sourceacademy\/modules-lib/,
6262
replacement: '.',
6363
async customResolver(source) {
64-
const newSource = pathlib.resolve(import.meta.dirname, '../lib/modules-lib/src', source)
65-
const extensions = ['.tsx', '.ts', '/index.ts']
64+
const newSource = pathlib.resolve(import.meta.dirname, '../lib/modules-lib/src', source);
65+
const extensions = ['.tsx', '.ts', '/index.ts'];
6666

6767
for (const each of extensions) {
6868
try {
69-
await fs.access(`${newSource}${each}`, fs.constants.R_OK)
70-
return `${newSource}${each}`
69+
await fs.access(`${newSource}${each}`, fs.constants.R_OK);
70+
return `${newSource}${each}`;
7171
} catch { }
7272
}
7373

@@ -105,9 +105,9 @@ export default defineProject(({ mode }) => {
105105
'react-ace',
106106
'react-ace/lib/ace',
107107
're-resizable',
108-
"vite-plugin-node-polyfills/shims/buffer",
109-
"vite-plugin-node-polyfills/shims/global",
110-
"vite-plugin-node-polyfills/shims/process",
108+
'vite-plugin-node-polyfills/shims/buffer',
109+
'vite-plugin-node-polyfills/shims/global',
110+
'vite-plugin-node-polyfills/shims/process',
111111
'vitest-browser-react'
112112
],
113113
},
@@ -126,5 +126,5 @@ export default defineProject(({ mode }) => {
126126
}
127127
}
128128
}
129-
}
129+
};
130130
});

eslint.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export default defineConfig(
3232
'.yarn',
3333
'build/**',
3434
'docs/.vitepress/cache',
35-
'devserver/vite.config.ts', // Don't lint this because there's no tsconfig properly configured for it
3635
'**/node_modules',
3736
'lib/buildtools/bin',
3837
'lib/buildtools/src/build/__test_mocks__',
@@ -489,7 +488,7 @@ export default defineConfig(
489488
},
490489
{
491490
name: 'Rules for Vitest configs',
492-
files: ['**/vitest.config.ts'],
491+
files: ['**/vitest.config.ts', './devserver/vite.config.ts'],
493492
languageOptions: {
494493
parserOptions: {
495494
project: './tsconfig.json'

tsconfig.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
// General tsconfig
1+
// tsconfig for Typescript configuration files
2+
// so that ESLint doesn't complain
23
{
34
"include": [
45
"**/vitest.config.ts",
5-
"./.github/actions/vitest.config.ts"
6+
"./.github/actions/vitest.config.ts",
7+
"./devserver/vite.config.ts"
68
],
79
"compilerOptions": {
810
"module": "nodenext",

0 commit comments

Comments
 (0)