Skip to content

Commit 2ca3f0f

Browse files
committed
chore: update tsslint.config.ts and add dprint
1 parent 762323e commit 2ca3f0f

File tree

73 files changed

+1240
-428
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1240
-428
lines changed

.github/workflows/auto-fix.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
- name: Auto-fix
2525
run: npm run lint:fix
2626

27+
# format
28+
- name: Format
29+
run: npm run format
30+
2731
# commit
2832
- name: Commit
2933
uses: EndBug/add-and-commit@v9

.vscode/settings.json

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
{
2-
"typescript.format.semicolons": "insert",
3-
"editor.insertSpaces": false,
4-
"editor.detectIndentation": false,
5-
"files.insertFinalNewline": true,
6-
"json.format.keepLines": true,
7-
"typescript.tsdk": "node_modules/typescript/lib",
8-
"[typescript]": {
9-
"editor.defaultFormatter": "vscode.typescript-language-features"
10-
},
2+
"dprint.path": "node_modules/dprint/dprint",
113
"[javascript]": {
12-
"editor.defaultFormatter": "vscode.typescript-language-features"
4+
"editor.defaultFormatter": "dprint.dprint"
5+
},
6+
"[typescript]": {
7+
"editor.defaultFormatter": "dprint.dprint"
138
},
149
"[json]": {
15-
"editor.defaultFormatter": "vscode.json-language-features"
10+
"editor.defaultFormatter": "dprint.dprint"
1611
},
1712
"[jsonc]": {
18-
"editor.defaultFormatter": "vscode.json-language-features"
13+
"editor.defaultFormatter": "dprint.dprint"
1914
},
15+
"editor.formatOnSave": true,
16+
"typescript.tsdk": "node_modules/typescript/lib",
2017
"files.exclude": {
2118
"packages/*/*.d.ts": true,
2219
"packages/*/*.js": true,

dprint.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"useTabs": true,
3+
"typescript": {
4+
"quoteStyle": "preferSingle",
5+
"arrowFunction.useParentheses": "preferNone",
6+
"nextControlFlowPosition": "nextLine"
7+
},
8+
"json": {
9+
},
10+
"excludes": [
11+
"**/node_modules",
12+
"**/*-lock.json",
13+
"packages/language-service/data"
14+
],
15+
"plugins": [
16+
"https://plugins.dprint.dev/typescript-0.95.7.wasm",
17+
"https://plugins.dprint.dev/json-0.20.0.wasm"
18+
]
19+
}

extensions/labs/src/common/showVirtualFile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { CodeInformation, HoverParams, SelectionRangeParams } from '@volar/language-server';
22
import { SourceMap } from '@volar/source-map';
3-
import { DocumentDiagnosticParams, LabsInfo, TextDocument } from '@volar/vscode';
3+
import { type DocumentDiagnosticParams, type LabsInfo, TextDocument } from '@volar/vscode';
44
import * as vscode from 'vscode';
55
import { VOLAR_VIRTUAL_CODE_SCHEME } from '../views/virtualCodesView';
66

@@ -24,7 +24,7 @@ export const sourceDocUriToVirtualDocUris = new Map<string, Set<string>>();
2424

2525
export const virtualDocUriToSourceDocUri = new Map<string, { fileUri: string, virtualCodeId: string; }>();
2626

27-
export async function activate(extensions: vscode.Extension<LabsInfo>[]) {
27+
export function activate(extensions: vscode.Extension<LabsInfo>[]) {
2828

2929
const subscriptions: vscode.Disposable[] = [];
3030
const docChangeEvent = new vscode.EventEmitter<vscode.Uri>();

extensions/labs/src/views/virtualCodesView.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface VirtualFileItem {
1717

1818
export const uriToVirtualCode = new Map<string, { fileUri: string; virtualCodeId: string; }>();
1919

20-
export async function activate(context: vscode.ExtensionContext) {
20+
export function activate(context: vscode.ExtensionContext) {
2121

2222
let currentDocument: vscode.TextDocument | undefined;
2323

@@ -153,7 +153,7 @@ export async function activate(context: vscode.ExtensionContext) {
153153
);
154154
}
155155
}),
156-
await activateShowVirtualFiles(extensions)
156+
activateShowVirtualFiles(extensions)
157157
);
158158

159159
useVolarExtensions(

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@
99
"release": "lerna publish --exact --force-publish --yes --sync-workspace-lock",
1010
"release:next": "npm run release -- --dist-tag next --no-push",
1111
"test": "vitest run",
12-
"lint": "tsslint --project '**/tsconfig.json'",
13-
"lint:fix": "npm run lint -- --fix --vscode-settings .vscode/settings.json"
12+
"format": "dprint fmt",
13+
"lint": "tsslint --project */*/tsconfig.json",
14+
"lint:fix": "npm run lint -- --fix"
1415
},
1516
"devDependencies": {
1617
"@lerna-lite/cli": "latest",
1718
"@lerna-lite/publish": "latest",
18-
"@tsslint/cli": "latest",
19+
"@tsslint/cli": "^2.0.4",
20+
"@tsslint/config": "^2.0.4",
21+
"@tsslint/eslint": "^2.0.4",
22+
"@typescript-eslint/eslint-plugin": "^8.19.0",
23+
"dprint": "^0.50.0",
1924
"typescript": "latest",
20-
"vite": "latest",
2125
"vitest": "latest"
2226
}
2327
}

packages/eslint/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FileMap, LanguagePlugin, SourceScript, VirtualCode, createLanguage, forEachEmbeddedCode, isDiagnosticsEnabled } from '@volar/language-core';
1+
import { FileMap, type LanguagePlugin, type SourceScript, type VirtualCode, createLanguage, forEachEmbeddedCode, isDiagnosticsEnabled } from '@volar/language-core';
22
import type { Linter } from 'eslint';
33
import { TextDocument } from 'vscode-languageserver-textdocument';
44

packages/kit/lib/createChecker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { CodeActionTriggerKind, Diagnostic, DiagnosticSeverity, DidChangeWatchedFilesParams, FileChangeType, Language, LanguagePlugin, LanguageServiceEnvironment, LanguageServicePlugin, NotificationHandler, ProjectContext, createLanguage, createLanguageService, createUriMap, mergeWorkspaceEdits } from '@volar/language-service';
2-
import { TypeScriptProjectHost, createLanguageServiceHost, resolveFileLanguageId } from '@volar/typescript';
1+
import { type CodeActionTriggerKind, type Diagnostic, type DiagnosticSeverity, type DidChangeWatchedFilesParams, type FileChangeType, type Language, type LanguagePlugin, type LanguageServiceEnvironment, type LanguageServicePlugin, type NotificationHandler, type ProjectContext, createLanguage, createLanguageService, createUriMap, mergeWorkspaceEdits } from '@volar/language-service';
2+
import { type TypeScriptProjectHost, createLanguageServiceHost, resolveFileLanguageId } from '@volar/typescript';
33
import * as path from 'typesafe-path/posix';
44
import * as ts from 'typescript';
55
import { TextDocument } from 'vscode-languageserver-textdocument';

packages/kit/lib/createFormatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FormattingOptions, LanguagePlugin, LanguageServicePlugin, createLanguage, createLanguageService, createUriMap } from '@volar/language-service';
1+
import { type FormattingOptions, type LanguagePlugin, type LanguageServicePlugin, createLanguage, createLanguageService, createUriMap } from '@volar/language-service';
22
import * as ts from 'typescript';
33
import { TextDocument } from 'vscode-languageserver-textdocument';
44
import { URI } from 'vscode-uri';

packages/kit/lib/createServiceEnvironment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FileSystem, FileType, LanguageServiceEnvironment } from '@volar/language-service';
1+
import { type FileSystem, FileType, type LanguageServiceEnvironment } from '@volar/language-service';
22
import * as fs from 'fs';
33
import { URI } from 'vscode-uri';
44

0 commit comments

Comments
 (0)