Skip to content

Commit b1929c2

Browse files
committed
update esling config with svelte support and unused-vars warning, fix linter warnings
1 parent 8ece23a commit b1929c2

17 files changed

+253
-77
lines changed

.eslintrc.json

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

eslint.config.mjs

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
11
import { defineConfig, globalIgnores } from 'eslint/config'
22
import typescriptEslint from '@typescript-eslint/eslint-plugin'
33
import tsParser from '@typescript-eslint/parser'
4+
import svelteEslintParser from 'svelte-eslint-parser'
5+
import eslintConfigPrettier from 'eslint-config-prettier/flat'
46

57
export default defineConfig([
68
globalIgnores(['**/out', '**/dist', '**/*.d.ts']),
79
{
10+
rules: {
11+
'@/semi': ['warn', 'never'],
12+
curly: 'warn',
13+
'no-unused-vars': [
14+
'warn',
15+
{
16+
vars: 'all',
17+
argsIgnorePattern: '^_',
18+
varsIgnorePattern: '^_',
19+
caughtErrorsIgnorePattern: '^_',
20+
},
21+
],
22+
eqeqeq: 'warn',
23+
'no-throw-literal': 'warn',
24+
semi: ['warn', 'never'],
25+
quotes: ['warn', 'single'],
26+
},
27+
},
28+
{
29+
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx,json}'],
830
plugins: {
931
'@typescript-eslint': typescriptEslint,
1032
},
@@ -23,13 +45,16 @@ export default defineConfig([
2345
format: ['camelCase', 'PascalCase'],
2446
},
2547
],
26-
27-
'@/semi': ['warn', 'never'],
28-
curly: 'warn',
29-
eqeqeq: 'warn',
30-
'no-throw-literal': 'warn',
31-
semi: ['warn', 'never'],
32-
quotes: ['warn', 'single'],
3348
},
3449
},
50+
{
51+
files: ['**/*.svelte'],
52+
languageOptions: {
53+
parser: svelteEslintParser,
54+
parserOptions: {
55+
parser: tsParser,
56+
},
57+
},
58+
},
59+
eslintConfigPrettier,
3560
])

package-lock.json

Lines changed: 182 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@
252252
"svelte-watch": "rollup -c -w --bundleConfigAsCjs",
253253
"svelte-compile": "rollup -c --bundleConfigAsCjs",
254254
"pretest": "npm run compile && npm run lint",
255-
"lint": "eslint src --ext ts",
255+
"lint": "eslint src webviews --ext ts,svelte",
256+
"lint-fix": "npm run lint -- --fix",
256257
"format-all": "prettier --write \"./**/*.{js,jsx,mjs,cjs,ts,tsx,json,svelte}\"",
257258
"test": "vscode-test",
258259
"test:svelte": "npm run svelte-compile && vitest --config vitest.config.mjs --environment jsdom --run"
@@ -275,7 +276,11 @@
275276
"@vscode/test-cli": "^0.0.10",
276277
"@vscode/test-electron": "^2.5.2",
277278
"eslint": "^9.25.1",
279+
"eslint-config-prettier": "^10.1.8",
280+
"eslint-plugin-svelte": "^3.11.0",
278281
"jsdom": "^26.1.0",
282+
"prettier": "^3.6.2",
283+
"prettier-plugin-svelte": "^3.4.0",
279284
"rollup": "^4.40.1",
280285
"rollup-plugin-postcss": "^4.0.2",
281286
"rollup-plugin-svelte": "^7.2.2",
@@ -284,8 +289,6 @@
284289
"svelte-preprocess": "^6.0.3",
285290
"tslib": "^2.8.1",
286291
"typescript": "^5.8.3",
287-
"vitest": "^3.1.3",
288-
"prettier": "^3.6.2",
289-
"prettier-plugin-svelte": "^3.4.0"
292+
"vitest": "^3.1.3"
290293
}
291294
}

src/api/ExtensionStateManager.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ export default class ExtensionStateManager {
320320
Formatting.normalizeSeparator(parsedTaskDir + path.sep + taskFile.file_name),
321321
)
322322
} else {
323-
const fileNameToOsPath = Formatting.normalizePath(taskFile.file_name)
324323
const pathParts = timData.path.split('/')
325324
const demo = pathParts.at(-1)
326325
if (demo) {

src/api/tide.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ import {
1414
Course,
1515
LoginData,
1616
Task,
17-
TaskCreationFeedback,
1817
TaskPoints,
1918
TimData,
2019
UserData,
2120
} from '../common/types'
22-
import Formatting from '../common/formatting'
2321
import { parseCoursesFromJson } from '../utilities/parsers'
2422
import ExtensionStateManager from './ExtensionStateManager'
2523
import path from 'path'
@@ -266,7 +264,7 @@ export default class Tide {
266264
* @param ideTaskId ide_task_id of the task that the points are fetched for
267265
* @param callback unused at the moment. TODO: Remove?
268266
*/
269-
public static async getTaskPoints(taskSetPath: string, ideTaskId: string, callback: any) {
267+
public static async getTaskPoints(taskSetPath: string, ideTaskId: string, _callback: any) {
270268
try {
271269
vscode.commands.executeCommand('tide.setPointsUpdating')
272270
await this.runAndHandle(

src/init/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export function registerCommands(ctx: vscode.ExtensionContext) {
134134
return
135135
}
136136
Tide.submitTask(taskPath, callback)
137-
} catch (error) {
137+
} catch (_error) {
138138
vscode.window.showErrorMessage('Error occurred during the submit: ${error}')
139139
}
140140
}

src/init/eventListeners.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import * as vscode from 'vscode'
1111
import Logger from '../utilities/logger'
1212

13-
export function registerEventListeners(ctx: vscode.ExtensionContext) {
13+
export function registerEventListeners(_ctx: vscode.ExtensionContext) {
1414
/**
1515
* Listens to changes in configuration.
1616
*/

src/ui/AnswerLimitStatusBarItem.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as vscode from 'vscode'
2-
import { Course, TimData } from '../common/types'
3-
import path from 'path'
2+
import { TimData } from '../common/types'
43
import ExtensionStateManager from '../api/ExtensionStateManager'
5-
import Formatting from '../common/formatting'
64

75
/**
86
* Class for Status Bar item displaying answer limit related information

0 commit comments

Comments
 (0)