diff --git a/code/ts/后端辅助工具/.eslintrc.js b/code/ts/后端辅助工具/.eslintrc.js new file mode 100644 index 0000000..b92950b --- /dev/null +++ b/code/ts/后端辅助工具/.eslintrc.js @@ -0,0 +1,52 @@ +/* + * @Author: Kane + * @Date: 2023-02-09 15:26:18 + * @LastEditors: Kane + * @LastEditTime: 2023-02-09 18:36:33 + * @FilePath: /后端辅助工具/.eslintrc.js + * @Description: + * + * Copyright (c) ${2022} by Kane, All Rights Reserved. + */ +module.exports = { + env: { + browser: true, + es2021: true, + }, + extends: [ + "standard-with-typescript", + ], + overrides: [ + ], + parserOptions: { + ecmaVersion: "latest", + sourceType: "module", + }, + plugins: [ + "vue", + ], + rules: { + "quote-props": ["warn", "as-needed",], + quotes: ["warn", "double", { allowTemplateLiterals: true, },], + indent: ["warn", 4,], + "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", + "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", + "no-unused-vars": "warn", + semi: ["error", "always",], // 控制行尾部分号 + "comma-dangle": ["error", { + arrays: "always", + objects: "always", + imports: "never", + exports: "never", + functions: "never", + },], // 数组和对象键值对最后一个逗号 + "comma-style": ["error", "last",], // 逗号在行位 + "array-bracket-spacing": ["error", "never",], + "no-undef-init": "error", + "no-invalid-this": "error", + "no-use-before-define": "error", + "no-shadow-restricted-names": "error", // 禁止对一些关键字或者保留字进行赋值操作,比如NaN、Infinity、undefined、eval、arguments等 + // "comma-spacing": ["error", { "before": false, "after": true, },], + "brace-style": ["error", "allman", { allowSingleLine: true, },], + }, +}; diff --git a/code/ts/后端辅助工具/.vscode/launch.json b/code/ts/后端辅助工具/.vscode/launch.json new file mode 100644 index 0000000..cd5a59e --- /dev/null +++ b/code/ts/后端辅助工具/.vscode/launch.json @@ -0,0 +1,20 @@ +{ + // 使用 IntelliSense 了解相关属性。 + // 悬停以查看现有属性的描述。 + // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-node", + "request": "launch", + "name": "Launch Program", + "skipFiles": [ + "/**" + ], + "program": "${file}", + "outFiles": [ + "${workspaceFolder}/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/code/ts/后端辅助工具/.vscode/tasks.json b/code/ts/后端辅助工具/.vscode/tasks.json new file mode 100644 index 0000000..0e125ab --- /dev/null +++ b/code/ts/后端辅助工具/.vscode/tasks.json @@ -0,0 +1,14 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "typescript", + "tsconfig": "tsconfig.json", + "problemMatcher": [ + "$tsc" + ], + "group": "build", + "label": "tsc: build - tsconfig.json" + } + ] +} \ No newline at end of file diff --git a/code/ts/后端辅助工具/src/main.ts b/code/ts/后端辅助工具/src/main.ts new file mode 100644 index 0000000..8f9cc84 --- /dev/null +++ b/code/ts/后端辅助工具/src/main.ts @@ -0,0 +1,16 @@ + +const greetings: string = "Hello, World!"; + +console.log( greetings ); + +enum Season { + spring = 1, + summer, + autumn, + winter, +}; + +let today: Season = Season.spring; + +console.log( today ); + diff --git a/code/ts/后端辅助工具/target/main.js b/code/ts/后端辅助工具/target/main.js new file mode 100644 index 0000000..4f0cc17 --- /dev/null +++ b/code/ts/后端辅助工具/target/main.js @@ -0,0 +1,12 @@ +var greetings = "Hello, World!"; +console.log(greetings); +var Season; +(function (Season) { + Season[Season["spring"] = 1] = "spring"; + Season[Season["summer"] = 2] = "summer"; + Season[Season["autumn"] = 3] = "autumn"; + Season[Season["winter"] = 4] = "winter"; +})(Season || (Season = {})); +; +var today = Season.spring; +console.log(today); diff --git a/code/ts/后端辅助工具/tsconfig.json b/code/ts/后端辅助工具/tsconfig.json new file mode 100644 index 0000000..f1bc1d0 --- /dev/null +++ b/code/ts/后端辅助工具/tsconfig.json @@ -0,0 +1,26 @@ +/* + * @Author: Kane + * @Date: 2023-02-09 15:24:20 + * @LastEditors: Kane + * @LastEditTime: 2023-02-09 15:29:03 + * @FilePath: /后端辅助工具/tsconfig.json + * @Description: + * + * Copyright (c) ${2022} by Kane, All Rights Reserved. + */ +{ + "compilerOptions": { + "outDir": "./target", + "strict": false, + "strictNullChecks": true, + }, + // "files": [ + // "./src/**/*" + // ], + "include": [ + "./src/**/*" + ], + "exclude": [ + "./target" + ], +} \ No newline at end of file