Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jinliming2 committed Jan 12, 2021
1 parent 5142d6d commit 01e2dc6
Show file tree
Hide file tree
Showing 27 changed files with 3,042 additions and 269 deletions.
41 changes: 41 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
env: {
es6: true,
es2017: true,
es2020: true,
es2021: true,
node: true,
},
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2021,
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
'extends': ['eslint:recommended', 'plugin:prettier/recommended', 'prettier/standard', 'prettier/unicorn'],
rules: {
'@typescript-eslint/naming-convention': 'warn',
'@typescript-eslint/semi': 'warn',
curly: 'warn',
eqeqeq: 'warn',
'no-throw-literal': 'warn',
semi: 'off',
'comma-dangle': ['error', 'always-multiline'],
'linebreak-style': ['error', 'unix'],
'no-constant-condition': ['error', { checkLoops: false }],
'no-empty': ['error', { allowEmptyCatch: true }],
quotes: ['error', 'single', { avoidEscape: true }],
'quote-props': ['error', 'as-needed', { keywords: true, unnecessary: true, numbers: true }],
'sort-imports': [
'warn',
{
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
allowSeparatedGroups: true,
},
],
},
overrides: [{ files: ['**/*.test.ts'], env: { mocha: true } }],
};
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
out
dist
node_modules
.vscode-test/
*.vsix

/coverage
/.nyc_output

yarn-error.log
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package.json
14 changes: 14 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
printWidth: 120,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
quoteProps: 'preserve',
jsxSingleQuote: false,
trailingComma: 'all',
bracketSpacing: true,
jsxBracketSameLine: false,
arrowParens: 'avoid',
endOfLine: 'lf',
};
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
42 changes: 29 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
// A launch configuration that launches the extension inside a new window
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
26 changes: 26 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"search.exclude": {
"out": true,
"yarn.lock": true
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.wrappingIndent": "indent",
"diffEditor.ignoreTrimWhitespace": false,
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"eslint.packageManager": "yarn",
"npm.packageManager": "yarn",
"tslint.packageManager": "yarn",
"javascript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single",
"editor.formatOnSave": true,
"eslint.alwaysShowStatus": true,
"eslint.format.enable": true,
"eslint.validate": ["javascript", "typescript"],
"typescript.tsdk": "node_modules/typescript/lib"
}
20 changes: 20 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
9 changes: 9 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
.vscode/**
.vscode-test/**
out/test/**
src/**
.gitignore
.yarnrc
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts

assets/logo.xcf
assets/screenshots
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--ignore-engines true
23 changes: 23 additions & 0 deletions @types/nyc.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
declare module 'nyc' {
export default class NYC {
constructor(config): void;
instrumenter(): void;
addFile(filename): void;
async addAllFiles(): Promise<void>;
async instrumentAllFiles(input, output): Promise<void>;
maybePurgeSourceMapCache(): void;
async createTempDirectory(): Promise<void>;
async reset(): Promise<void>;
wrap(bin?): void;
writeCoverageFile(): void;
async getCoverageMapFromAllCoverageFiles(baseDirectory): Promise<unknown>;
async report(): Promise<void>;
async writeProcessIndex(): Promise<void>;
async showProcessTree(): Promise<void>;
async checkCoverage(thresholds, perFile): Promise<void>;
coverageFiles(baseDirectory = this.tempDirectory()): Promise<unknown>;
async coverageFileLoad(filename, baseDirectory = this.tempDirectory()): Promise<unknown>;
tempDirectory(): string;
reportDirectory(): string;
}
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Liming Jin
Copyright (c) 2021 Liming Jin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
44 changes: 21 additions & 23 deletions language-configuration.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
{
"comments": {
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": [ "/*", "*/" ]
},
// symbols used as brackets
"brackets": [
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
{ "open": "{{", "close": "}}" },
{ "open": "(", "close": ")", "notIn": ["string"] },
{ "open": "\"", "close": "\"", "notIn": ["string"] },
{ "open": "`", "close": "`", "notIn": ["string"] },
{ "open": "/*", "close": " */", "notIn": ["string"] }
],
"autoCloseBefore": "-.}) \n\t",
// symbols that can be used to surround a selection
"surroundingPairs": [
["(", ")"],
["\"", "\""],
["`", "`"]
]
"comments": {
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": ["/*", "*/"]
},
// symbols used as brackets
"brackets": [["(", ")"]],
// symbols that are auto closed when typing
"autoClosingPairs": [
{ "open": "{{", "close": "}}" },
{ "open": "(", "close": ")", "notIn": ["string"] },
{ "open": "\"", "close": "\"", "notIn": ["string"] },
{ "open": "`", "close": "`", "notIn": ["string"] },
{ "open": "/*", "close": " */", "notIn": ["string"] }
],
"autoCloseBefore": "-.}) \n\t",
// symbols that can be used to surround a selection
"surroundingPairs": [
["(", ")"],
["\"", "\""],
["`", "`"]
]
}
Loading

0 comments on commit 01e2dc6

Please sign in to comment.