Skip to content

Commit 105ccb4

Browse files
authored
Merge pull request #2062 from microsoft/connor4312/dprint
chore: move prettier->dprint
2 parents ab03c68 + 9374f0f commit 105ccb4

File tree

255 files changed

+3672
-2823
lines changed

Some content is hidden

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

255 files changed

+3672
-2823
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ about: Create a report to help us improve
44
title: ''
55
labels: bug
66
assignees: connor4312
7-
87
---
98

109
**Describe the bug**
1110
A clear and concise description of what the bug is.
1211

1312
**To Reproduce**
1413
Steps to reproduce the behavior:
14+
1515
1. Go to '...'
1616
2. Click on '....'
1717
3. Scroll down to '....'

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ about: Suggest an idea for this project
44
title: ''
55
labels: feature-request
66
assignees: connor4312
7-
87
---
98

109
**Is your feature request related to a problem? Please describe.**

.github/ISSUE_TEMPLATE/other.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,4 @@ about: Something else
44
title: ''
55
labels: ''
66
assignees: ''
7-
87
---
9-
10-

.vscode/launch.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@
7171
],
7272
"args": [
7373
"--enable-proposed-api=ms-vscode.js-debug",
74-
"--extensionDevelopmentPath=${workspaceFolder}/dist",
74+
"--extensionDevelopmentPath=${workspaceFolder}/dist"
7575
],
7676
"outFiles": [
77-
"${workspaceFolder}/dist/**/*.js",
77+
"${workspaceFolder}/dist/**/*.js"
7878
]
7979
// "preLaunchTask": "npm: watch"
8080
},
@@ -87,13 +87,13 @@
8787
],
8888
"args": [
8989
"--enable-proposed-api=ms-vscode.js-debug",
90-
"--extensionDevelopmentPath=${workspaceFolder}/dist",
90+
"--extensionDevelopmentPath=${workspaceFolder}/dist"
9191
],
9292
"env": {
9393
"JS_DEBUG_USE_LOCAL_DAP_PORT": "8123"
9494
},
9595
"outFiles": [
96-
"${workspaceFolder}/dist/**/*.js",
96+
"${workspaceFolder}/dist/**/*.js"
9797
]
9898
// "preLaunchTask": "npm: watch"
9999
},

.vscode/settings.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,11 @@
2323
"**/.vscode-test": true,
2424
"**/demos": true
2525
},
26-
"[typescript]": {
27-
"editor.defaultFormatter": "esbenp.prettier-vscode"
28-
},
29-
"editor.codeActionsOnSave": {
30-
"source.organizeImports": "explicit"
31-
},
26+
"editor.defaultFormatter": "dprint.dprint",
27+
"dprint.verbose": true,
3228
"editor.formatOnSave": true,
3329
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
34-
"[go]": {
35-
"editor.codeActionsOnSave": {
36-
"source.organizeImports": "explicit"
37-
}
30+
"[typescript]": {
31+
"editor.defaultFormatter": "dprint.dprint"
3832
}
3933
}

.vscode/tasks.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
2-
"version": "2.0.0",
3-
"tasks": [
4-
{
5-
"type": "npm",
6-
"script": "watch",
7-
"problemMatcher": {
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "npm",
6+
"script": "watch",
7+
"problemMatcher": {
88
"base": "$gulp-tsc",
9-
"applyTo": "closedDocuments",
10-
"background": {
11-
"beginsPattern": "Starting",
12-
"endsPattern": "Finished"
13-
}
14-
},
9+
"applyTo": "closedDocuments",
10+
"background": {
11+
"beginsPattern": "Starting",
12+
"endsPattern": "Finished"
13+
}
14+
},
1515
"isBackground": true,
1616
// https://github.com/microsoft/vscode/issues/83016
17-
// "presentation": {
18-
// "reveal": "never"
19-
// },
20-
"group": {
21-
"kind": "build",
22-
"isDefault": true
23-
}
24-
}
25-
]
17+
// "presentation": {
18+
// "reveal": "never"
19+
// },
20+
"group": {
21+
"kind": "build",
22+
"isDefault": true
23+
}
24+
}
25+
]
2626
}

dprint.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://dprint.dev/schemas/v0.json",
3+
"lineWidth": 100,
4+
"indentWidth": 2,
5+
"newLineKind": "lf",
6+
"typescript": {
7+
"useTabs": false,
8+
"quoteStyle": "preferSingle",
9+
"trailingCommas": "onlyMultiLine",
10+
"arrowFunction.useParentheses": "preferNone"
11+
},
12+
"excludes": [
13+
"**/node_modules",
14+
"**/testWorkspace",
15+
"**/*-lock.json",
16+
"**/*.d.ts"
17+
],
18+
"plugins": [
19+
"https://plugins.dprint.dev/typescript-0.91.6.wasm",
20+
"https://plugins.dprint.dev/json-0.19.3.wasm",
21+
"https://plugins.dprint.dev/markdown-0.17.8.wasm"
22+
]
23+
}

gulpfile.js

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const util = require('util');
1515
const esbuild = require('esbuild');
1616
const esbuildPlugins = require('./src/build/esbuildPlugins');
1717
const got = require('got').default;
18-
const { HttpsProxyAgent } = require("https-proxy-agent");
18+
const { HttpsProxyAgent } = require('https-proxy-agent');
1919
const jszip = require('jszip');
2020
const stream = require('stream');
2121

@@ -62,7 +62,7 @@ async function runBuildScript(name) {
6262
resolve(outstr);
6363
}
6464
},
65-
),
65+
)
6666
);
6767
}
6868

@@ -76,7 +76,9 @@ async function readJson(file) {
7676

7777
const del = async patterns => {
7878
const files = glob.sync(patterns, { cwd: __dirname });
79-
await Promise.all(files.map(f => fs.promises.rm(path.join(__dirname, f), { force: true, recursive: true })));
79+
await Promise.all(
80+
files.map(f => fs.promises.rm(path.join(__dirname, f), { force: true, recursive: true })),
81+
);
8082
};
8183

8284
gulp.task('clean-assertions', () => del(['src/test/**/*.txt.actual']));
@@ -104,7 +106,7 @@ const getVersionNumber = () => {
104106
date.getFullYear(),
105107
// MM,
106108
date.getMonth() + 1,
107-
//DDHH
109+
// DDHH
108110
`${date.getDate()}${String(date.getHours()).padStart(2, '0')}`,
109111
].join('.');
110112
};
@@ -140,8 +142,7 @@ gulp.task('compile:build-scripts', async () =>
140142
define: await getConstantDefines(),
141143
bundle: true,
142144
platform: 'node',
143-
}),
144-
);
145+
}));
145146

146147
gulp.task('compile:dynamic', async () => {
147148
const [contributions] = await Promise.all([
@@ -180,8 +181,7 @@ gulp.task('compile:static', () =>
180181
},
181182
),
182183
gulp.src(['node_modules/@c4312/chromehash/pkg/*.wasm']).pipe(rename({ dirname: 'src' })),
183-
).pipe(gulp.dest(buildDir)),
184-
);
184+
).pipe(gulp.dest(buildDir)));
185185

186186
const resolveDefaultExts = ['.tsx', '.ts', '.jsx', '.js', '.css', '.json'];
187187

@@ -255,14 +255,16 @@ async function compileTs({
255255
const define = await getConstantDefines();
256256

257257
let todo = [];
258-
for (const {
259-
entry,
260-
platform = 'node',
261-
library,
262-
isInVsCode,
263-
nodePackages,
264-
target = 'node18',
265-
} of packages) {
258+
for (
259+
const {
260+
entry,
261+
platform = 'node',
262+
library,
263+
isInVsCode,
264+
nodePackages,
265+
target = 'node18',
266+
} of packages
267+
) {
266268
todo.push(
267269
incrementalEsbuild({
268270
entryPoints: [entry],
@@ -348,16 +350,16 @@ gulp.task('package:createVSIX', () =>
348350
cwd: buildDir,
349351
dependencies: false,
350352
packagePath: path.join(buildDir, `${extensionName}.vsix`),
351-
}),
352-
);
353+
}));
353354

354355
gulp.task('l10n:bundle-download', async () => {
355356
const opts = {};
356357
const proxy = process.env.https_proxy || process.env.HTTPS_PROXY || null;
357-
if (proxy)
358+
if (proxy) {
358359
opts.agent = {
359-
https: new HttpsProxyAgent(proxy)
360+
https: new HttpsProxyAgent(proxy),
360361
};
362+
}
361363

362364
const res = await got('https://github.com/microsoft/vscode-loc/archive/main.zip', opts).buffer();
363365
const content = await jszip.loadAsync(res);
@@ -431,8 +433,7 @@ gulp.task('publish:vsce', () =>
431433
pat: process.env.MARKETPLACE_TOKEN,
432434
dependencies: false,
433435
cwd: buildDir,
434-
}),
435-
);
436+
}));
436437

437438
gulp.task('publish', gulp.series('package', 'publish:vsce'));
438439
gulp.task('default', gulp.series('compile'));
@@ -445,14 +446,12 @@ gulp.task(
445446
}),
446447
);
447448

448-
const runPrettier = (onlyStaged, fix, callback) => {
449-
const child = cp.fork(
450-
'./node_modules/@mixer/parallel-prettier/dist/index.js',
451-
[fix ? '--write' : '--list-different', 'src/**/*.{ts,tsx}', '!src/**/*.d.ts', '*.md'],
452-
{ stdio: 'inherit' },
453-
);
449+
const runFormatting = (onlyStaged, fix, callback) => {
450+
const child = cp.fork('./node_modules/dprint/bin.js', [fix ? 'fmt' : 'check'], {
451+
stdio: 'inherit',
452+
});
454453

455-
child.on('exit', code => (code ? callback(`Prettier exited with code ${code}`) : callback()));
454+
child.on('exit', code => (code ? callback(`Formatter exited with code ${code}`) : callback()));
456455
};
457456

458457
const runEslint = (fix, callback) => {
@@ -465,13 +464,13 @@ const runEslint = (fix, callback) => {
465464
child.on('exit', code => (code ? callback(`Eslint exited with code ${code}`) : callback()));
466465
};
467466

468-
gulp.task('format:prettier', callback => runPrettier(false, true, callback));
467+
gulp.task('format:code', callback => runFormatting(false, true, callback));
469468
gulp.task('format:eslint', callback => runEslint(true, callback));
470-
gulp.task('format', gulp.series('format:prettier', 'format:eslint'));
469+
gulp.task('format', gulp.series('format:code', 'format:eslint'));
471470

472-
gulp.task('lint:prettier', callback => runPrettier(false, false, callback));
471+
gulp.task('lint:code', callback => runFormatting(false, false, callback));
473472
gulp.task('lint:eslint', callback => runEslint(false, callback));
474-
gulp.task('lint', gulp.parallel('lint:prettier', 'lint:eslint'));
473+
gulp.task('lint', gulp.parallel('lint:code', 'lint:eslint'));
475474

476475
/**
477476
* Run a command in the terminal using exec, and wrap it in a promise

0 commit comments

Comments
 (0)