Skip to content

Commit

Permalink
Merge pull request #184 from Techatrix/dev
Browse files Browse the repository at this point in the history
code formatting, strict typechecking, linting, code cleanup and bugfixes
  • Loading branch information
Vexu authored Apr 1, 2024
2 parents e218542 + 3a78297 commit c1a293d
Show file tree
Hide file tree
Showing 20 changed files with 1,590 additions and 1,305 deletions.
41 changes: 0 additions & 41 deletions .eslintrc.json

This file was deleted.

13 changes: 9 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: build
- uses: actions/checkout@v4

- run: npm install
- run: npm run build
- run: npm run typecheck
- run: npm run lint
- run: npm run format -- --check

- name: package extension
run: |
npm install
npm run compile
npx vsce package
ls -lt *.vsix
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
out
*.md
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 120,
"tabWidth": 4,
"overrides": [
{
"files": ["*.yml", "*.yaml", "package-lock.json", "package.json", "syntaxes/*.json"],
"options": {
"tabWidth": 2
}
}
]
}
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
14 changes: 5 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
{
"version": "0.1.0",
"version": "0.2.0",
"configurations": [
{
"type": "extensionHost",
"request": "launch",
"name": "Launch Extension",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: compile"
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "Build Extension"
}
]
}
}
8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
}
}
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
"eslint.experimental.useFlatConfig": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
22 changes: 14 additions & 8 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@
"version": "2.0.0",
"tasks": [
{
"label": "Build Extension in Background",
"group": "build",
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
"problemMatcher": {
"base": "$tsc-watch"
},
"group": {
"kind": "build",
"isDefault": true
"isBackground": true
},
{
"label": "Build Extension",
"group": "build",
"type": "npm",
"script": "build",
"problemMatcher": {
"base": "$tsc"
}
}
]
}
}
27 changes: 27 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// @ts-check

import prettierConfig from "eslint-config-prettier";
import tseslint from "typescript-eslint";

export default tseslint.config({
files: ["**/*.ts"],
extends: [...tseslint.configs.stylisticTypeChecked, ...tseslint.configs.strictTypeChecked],
rules: {
...prettierConfig.rules,
"@typescript-eslint/naming-convention": "error",
"@typescript-eslint/switch-exhaustiveness-check": "error",
eqeqeq: "error",
"no-throw-literal": "off",
"@typescript-eslint/only-throw-error": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"no-duplicate-imports": "error",
"sort-imports": ["error", { allowSeparatedGroups: true }],
},
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: "__dirname",
},
},
});
6 changes: 3 additions & 3 deletions language-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@
{
"beforeText": "^\\s*//!.*$",
"action": {
"indent": "none",
"indent": "none",
"appendText": "//! "
}
},
{
"beforeText": "^\\s*///.*$",
"action": {
"indent": "none",
"indent": "none",
"appendText": "/// "
}
},
{
"beforeText": "^\\s*\\\\\\\\.*$",
"action": {
"indent": "none",
"indent": "none",
"appendText": "\\\\"
}
}
Expand Down
Loading

0 comments on commit c1a293d

Please sign in to comment.