Skip to content
This repository was archived by the owner on Mar 26, 2023. It is now read-only.

Commit d7b94ae

Browse files
committed
Typescript Setup
1 parent 8c4ade6 commit d7b94ae

File tree

6 files changed

+1295
-0
lines changed

6 files changed

+1295
-0
lines changed

.eslintrc.js

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
module.exports = {
2+
env: {
3+
es6: true,
4+
node: true,
5+
},
6+
extends: [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
10+
"plugin:import/errors",
11+
"plugin:import/warnings",
12+
"plugin:import/typescript",
13+
],
14+
parser: "@typescript-eslint/parser",
15+
parserOptions: {
16+
project: "tsconfig.json",
17+
sourceType: "module",
18+
},
19+
plugins: [
20+
"@typescript-eslint",
21+
"prefer-arrow",
22+
],
23+
rules: {
24+
"@typescript-eslint/array-type": "error",
25+
"@typescript-eslint/ban-types": "off",
26+
"@typescript-eslint/consistent-type-assertions": "error",
27+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
28+
"@typescript-eslint/dot-notation": "error",
29+
"@typescript-eslint/explicit-member-accessibility": "error",
30+
"@typescript-eslint/explicit-module-boundary-types": "off",
31+
"@typescript-eslint/member-delimiter-style": "error",
32+
"@typescript-eslint/no-explicit-any": "off",
33+
"@typescript-eslint/no-floating-promises": "error",
34+
"@typescript-eslint/no-inferrable-types": "off",
35+
"@typescript-eslint/no-namespace": "off",
36+
"@typescript-eslint/no-non-null-assertion": "off",
37+
"@typescript-eslint/no-shadow": ["error"],
38+
"@typescript-eslint/no-unsafe-assignment": "off",
39+
"@typescript-eslint/no-unsafe-call": "off",
40+
"@typescript-eslint/no-unsafe-member-access": "off",
41+
"@typescript-eslint/no-unsafe-return": "off",
42+
"@typescript-eslint/no-unused-expressions": "error",
43+
"no-unused-vars": "off",
44+
"@typescript-eslint/no-unused-vars": ["error", {
45+
vars: "all",
46+
args: "none",
47+
ignoreRestSiblings: false,
48+
}],
49+
"@typescript-eslint/prefer-for-of": "error",
50+
"@typescript-eslint/prefer-function-type": "error",
51+
"@typescript-eslint/prefer-regexp-exec": "off",
52+
"@typescript-eslint/quotes": ["error", "double", {
53+
avoidEscape: true,
54+
allowTemplateLiterals: true,
55+
}],
56+
"@typescript-eslint/require-await": "off",
57+
"@typescript-eslint/restrict-template-expressions": "off",
58+
"@typescript-eslint/semi": ["error", "always", {
59+
omitLastInOneLineBlock: false,
60+
}],
61+
"@typescript-eslint/type-annotation-spacing": "error",
62+
"@typescript-eslint/unified-signatures": "error",
63+
"arrow-body-style": "error",
64+
"arrow-parens": ["error", "as-needed"],
65+
"brace-style": "error",
66+
"comma-dangle": ["error", "always-multiline"],
67+
"curly": "error",
68+
"eol-last": "error",
69+
"eqeqeq": "error",
70+
"guard-for-in": "error",
71+
"import/order": "error",
72+
"max-len": ["error", {
73+
code: 140,
74+
}],
75+
"new-parens": "error",
76+
"no-caller": "error",
77+
// "no-console": "error",
78+
"no-constant-condition": "off",
79+
"no-eval": "error",
80+
"no-multiple-empty-lines": "error",
81+
"no-new-wrappers": "error",
82+
"no-throw-literal": "error",
83+
"no-trailing-spaces": "error",
84+
"no-undef-init": "error",
85+
"no-useless-rename": "error",
86+
"object-curly-spacing": ["error", "always"],
87+
"object-shorthand": "error",
88+
"one-var": ["error", "never"],
89+
"prefer-arrow/prefer-arrow-functions": "error",
90+
"prefer-arrow-callback": "error",
91+
"prefer-const": ["error", {
92+
destructuring: "all",
93+
}],
94+
"quote-props": ["error", "consistent-as-needed"],
95+
"radix": "error",
96+
"space-before-function-paren": ["error", {
97+
anonymous: "never",
98+
asyncArrow: "always",
99+
named: "never",
100+
}],
101+
"spaced-comment": ["error", "always", {
102+
markers: ["/"],
103+
block: {
104+
balanced: true,
105+
},
106+
}],
107+
},
108+
};

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/dist/
2+
/node_modules/
3+
config.json

package.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "violet",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"repository": "[email protected]:AyuAi/violet.git",
6+
"author": "Ayu <[email protected]>",
7+
"license": "MIT",
8+
"private": true,
9+
"dependencies": {
10+
"@types/chai": "^4.2.22",
11+
"chai": "^4.3.4",
12+
"chai-as-promised": "^7.1.1",
13+
"mocha": "^9.1.3",
14+
"ts-node": "^10.4.0",
15+
"typescript": "^4.4.4"
16+
},
17+
"scripts": {
18+
"start": "ts-node src/index.ts",
19+
"start:dev": "ts-node-dev --watch src/**/*.{ts,js} src/index.ts",
20+
"build": "yarn tsc",
21+
"newstart": "yarn build && yarn start",
22+
"test": "mocha --require ts-node/register --timeout 10000 test/**/*.spec.ts"
23+
},
24+
"devDependencies": {
25+
"@types/node": "^16.11.7",
26+
"eslint-plugin-import": "^2.25.3",
27+
"eslint-plugin-prefer-arrow": "^1.2.3"
28+
}
29+
}

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("Hello world");

tsconfig.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"rootDir": "src",
5+
"outDir": "dist",
6+
"module": "commonjs",
7+
"target": "es2020",
8+
"lib": ["es2020"],
9+
"moduleResolution": "node",
10+
"sourceMap": true,
11+
"strict": true,
12+
"alwaysStrict": true,
13+
"noImplicitReturns": true,
14+
"preserveConstEnums": true,
15+
"esModuleInterop": true,
16+
"resolveJsonModule": true
17+
},
18+
"include": [
19+
"./src/**/*",
20+
"./test/**/*",
21+
"./.eslintrc.js",
22+
],
23+
}

0 commit comments

Comments
 (0)