Skip to content

Commit ab3385c

Browse files
committed
Convert ESLint config and add Prettier
1 parent eb00e23 commit ab3385c

6 files changed

Lines changed: 62 additions & 98 deletions

File tree

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ charset = utf-8
55
indent_style = space
66
indent_size = 4
77
insert_final_newline = true
8+
trim_trailing_whitespace = true
89

910
[*.{json,yaml,yml,code-workspace}]
1011
indent_size = 2

.eslintrc.json

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

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
modules/
3+
out/

eslint.config.mjs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import eslint from "@eslint/js";
2+
import eslintConfigPrettier from "eslint-config-prettier/flat";
3+
import tseslint from "typescript-eslint";
4+
5+
export default tseslint.config(
6+
eslint.configs.recommended,
7+
tseslint.configs.strictTypeChecked,
8+
eslintConfigPrettier,
9+
{
10+
languageOptions: {
11+
parserOptions: {
12+
projectService: true,
13+
tsconfigRootDir: import.meta.dirname,
14+
},
15+
},
16+
rules: {
17+
"@typescript-eslint/explicit-function-return-type": "error",
18+
"@typescript-eslint/no-empty-object-type": "off",
19+
"@typescript-eslint/no-floating-promises": [
20+
"error",
21+
{
22+
ignoreVoid: true,
23+
},
24+
],
25+
"@typescript-eslint/no-non-null-assertion": "off",
26+
"@typescript-eslint/no-require-imports": "off",
27+
"@typescript-eslint/no-unused-vars": [
28+
"error",
29+
{
30+
argsIgnorePattern: "^_",
31+
},
32+
],
33+
"@typescript-eslint/no-unsafe-argument": "off",
34+
"@typescript-eslint/no-unsafe-assignment": "off",
35+
"@typescript-eslint/no-unsafe-call": "off",
36+
"@typescript-eslint/no-unsafe-member-access": "off",
37+
"@typescript-eslint/no-unsafe-return": "off",
38+
"@typescript-eslint/restrict-template-expressions": "off",
39+
"@typescript-eslint/prefer-nullish-coalescing": [
40+
"error",
41+
{
42+
ignoreConditionalTests: true,
43+
ignoreMixedLogicalExpressions: true,
44+
},
45+
],
46+
},
47+
},
48+
);

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@
109109
"pretest": "npm run compile",
110110
"test": "vscode-test"
111111
},
112+
"prettier": {
113+
"plugins": ["prettier-plugin-organize-imports"]
114+
},
112115
"contributes": {
113116
"breakpoints": [
114117
{

pwsh-extension-dev.code-workspace

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
"settings": {
2626
"window.title": "PowerShell VS Code Extension Development",
2727
"debug.onTaskErrors": "prompt",
28-
"editor.tabSize": 4,
29-
"editor.insertSpaces": true,
30-
"files.trimTrailingWhitespace": true,
31-
"files.insertFinalNewline": true,
3228
"files.associations": {
3329
"**/snippets/*.json": "jsonc", // Use JSONC instead of JSON because that's how VS Code interprets snippet files, and it enables better source documentation.
3430
},
@@ -46,16 +42,12 @@
4642
"powershell.codeFormatting.whitespaceBetweenParameters": true,
4743
"powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline",
4844
"typescript.tsdk": "Client/node_modules/typescript/lib", // Lock the TypeScript SDK path to the version we use
49-
"typescript.format.semicolons": "insert", // Code actions like "organize imports" ignore ESLint, so we need this here
50-
"eslint.format.enable": true, // Enable ESLint as defaut formatter so quick fixes can be applied directly
5145
"[typescript]": {
5246
"editor.defaultFormatter": "esbenp.prettier-vscode",
5347
"editor.formatOnPaste": true,
5448
"editor.formatOnSave": true,
5549
"editor.formatOnSaveMode": "modificationsIfAvailable"
5650
},
57-
"mochaExplorer.configFile": ".mocharc.json",
58-
"mochaExplorer.launcherScript": "test/runTests",
5951
"mochaExplorer.autoload": false, // The test instance pops up every time discovery or run is done, this could be annoying on startup.
6052
"mochaExplorer.debuggerPort": 59229, // Matches the launch config, we dont want to use the default port as we are launching a duplicate instance of vscode and it might conflict.
6153
"mochaExplorer.ipcRole": "server",
@@ -95,7 +87,7 @@
9587
"osx": {
9688
"options": {
9789
"shell": {
98-
"executable": "/usr/local/bin/pwsh",
90+
"executable": "pwsh",
9991
"args": [
10092
"-NoProfile",
10193
"-Command"
@@ -324,15 +316,13 @@
324316
"sourceMaps": true,
325317
// This speeds up source map detection and makes smartStep work correctly
326318
"outFiles": [
327-
"${workspaceFolder:Client}/**/*.js",
328-
"!**/node_modules/**",
329-
"!**/.vscode-test/**"
319+
"${workspaceFolder:Client}/dist/*.js"
330320
],
331321
"skipFiles": [
332322
"<node_internals>/**",
333323
"**/node_modules/**",
334324
"**/.vscode-test/**",
335-
"**/app/out/vs/**" //Skips Extension Host internals
325+
"**/app/out/vs/**" // Skips Extension Host internals
336326
],
337327
"presentation": {
338328
"hidden": true
@@ -356,9 +346,7 @@
356346
"sourceMaps": true,
357347
// This speeds up source map detection and makes smartStep work correctly
358348
"outFiles": [
359-
"${workspaceFolder:Client}/**/*.js",
360-
"!**/node_modules/**",
361-
"!**/.vscode-test/**"
349+
"${workspaceFolder:Client}/dist/*.js"
362350
],
363351
"skipFiles": [
364352
"<node_internals>/**",
@@ -388,15 +376,13 @@
388376
"sourceMaps": true,
389377
// This speeds up source map detection and makes smartStep work correctly
390378
"outFiles": [
391-
"${workspaceFolder:Client}/**/*.js",
392-
"!**/node_modules/**",
393-
"!**/.vscode-test/**",
379+
"${workspaceFolder:Client}/dist/*.js"
394380
],
395381
"skipFiles": [
396382
"<node_internals>/**",
397383
"**/node_modules/**",
398384
"**/.vscode-test/**",
399-
"**/app/out/vs/**" //Skips Extension Host internals
385+
"**/app/out/vs/**" // Skips Extension Host internals
400386
],
401387
"presentation": {
402388
"hidden": true
@@ -460,9 +446,7 @@
460446
"sourceMaps": true,
461447
// This speeds up source map detection and makes smartStep work correctly
462448
"outFiles": [
463-
"${workspaceFolder:Client}/**/*.js",
464-
"!**/node_modules/**",
465-
"!**/.vscode-test/**"
449+
"${workspaceFolder:Client}/dist/*.js"
466450
],
467451
"skipFiles": [
468452
"<node_internals>/**",

0 commit comments

Comments
 (0)