增加一个用于代码测试的typescript项目
This commit is contained in:
		
							
								
								
									
										43
									
								
								code/测试/code_test/.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								code/测试/code_test/.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
  root: true,
 | 
			
		||||
  env: {
 | 
			
		||||
    browser: true,
 | 
			
		||||
    es2021: true,
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  parser: "@typescript-eslint/parser",
 | 
			
		||||
  parserOptions: {
 | 
			
		||||
    ecmaVersion: "latest",
 | 
			
		||||
    sourceType: "module",
 | 
			
		||||
  },
 | 
			
		||||
  Plugin: [
 | 
			
		||||
    "@typescript-eslint", //typescript的语法检查插件
 | 
			
		||||
  ],
 | 
			
		||||
  extends: "standard-with-typescript",
 | 
			
		||||
  rules: { // 单项的语法检查规则
 | 
			
		||||
    "no-console": "warn",
 | 
			
		||||
    "quote-props": ["warn", "as-needed",],
 | 
			
		||||
    quotes: ["warn", "double", { allowTemplateLiterals: true, },],
 | 
			
		||||
    indent: ["warn", 4,],
 | 
			
		||||
    "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, },],
 | 
			
		||||
    "@typescript-eslint/no-extra-semi": "off",
 | 
			
		||||
  },
 | 
			
		||||
  overrides: [
 | 
			
		||||
  ],
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										2395
									
								
								code/测试/code_test/package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										2395
									
								
								code/测试/code_test/package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										21
									
								
								code/测试/code_test/package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								code/测试/code_test/package.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "code_test",
 | 
			
		||||
  "version": "1.0.0",
 | 
			
		||||
  "description": "用于测试前端的typescript代码",
 | 
			
		||||
  "main": "index.ts",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "echo \"Error: no test specified\" && exit 1"
 | 
			
		||||
  },
 | 
			
		||||
  "author": "Kane",
 | 
			
		||||
  "license": "ISC",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@typescript-eslint/eslint-plugin": "^5.54.0",
 | 
			
		||||
    "@typescript-eslint/parser": "^5.54.0",
 | 
			
		||||
    "eslint": "^8.35.0",
 | 
			
		||||
    "eslint-config-standard-with-typescript": "^34.0.0",
 | 
			
		||||
    "eslint-plugin-import": "^2.27.5",
 | 
			
		||||
    "eslint-plugin-n": "^15.6.1",
 | 
			
		||||
    "eslint-plugin-promise": "^6.1.1",
 | 
			
		||||
    "typescript": "^4.9.5"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2
									
								
								code/测试/code_test/src/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								code/测试/code_test/src/index.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
							
								
								
									
										29
									
								
								code/测试/code_test/tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								code/测试/code_test/tsconfig.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-03-03 11:21:43
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /code_test/tsconfig.json
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
{
 | 
			
		||||
    "compilerOptions": {
 | 
			
		||||
        "strict": true,
 | 
			
		||||
        "target": "ES2015",
 | 
			
		||||
        "module": "CommonJS",
 | 
			
		||||
        "esModuleInterop": true,
 | 
			
		||||
        "lib": [
 | 
			
		||||
            "ESNext",
 | 
			
		||||
        ],
 | 
			
		||||
    },
 | 
			
		||||
    "include": [
 | 
			
		||||
        "src/**/*.ts",
 | 
			
		||||
        "src/**/*.tsx",
 | 
			
		||||
        "*.d.ts",
 | 
			
		||||
    ],
 | 
			
		||||
    "exclude": [
 | 
			
		||||
        "./node_modules",
 | 
			
		||||
    ],
 | 
			
		||||
    "compileOnSave": true,
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user