Skip to content

Commit 1a24928

Browse files
Initial release
1 parent 50f779f commit 1a24928

File tree

70 files changed

+16573
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+16573
-0
lines changed

.browserslistrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Chrome 49
2+
Edge 12
3+
Firefox 18
4+
Opera 36
5+
Safari 10

.eslintignore

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

.eslintrc.js

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
/*
2+
ESLint Rule Documentation Sites
3+
https://eslint.org/docs/rules/
4+
https://github.com/benmosher/eslint-plugin-import
5+
https://github.com/jest-community/eslint-plugin-jest
6+
https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
7+
*/
8+
9+
module.exports = {
10+
plugins: ["@typescript-eslint", "jest", "import"],
11+
extends: ["eslint:recommended"],
12+
env: {
13+
es6: true,
14+
node: true,
15+
},
16+
reportUnusedDisableDirectives: true,
17+
parser: "@babel/eslint-parser",
18+
parserOptions: {
19+
sourceType: "module",
20+
requireConfigFile: false,
21+
},
22+
overrides: [
23+
{
24+
extends: [
25+
"plugin:@typescript-eslint/eslint-recommended",
26+
"plugin:@typescript-eslint/recommended",
27+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
28+
],
29+
parser: "@typescript-eslint/parser",
30+
parserOptions: {
31+
sourceType: "module",
32+
project: "./tsconfig.json",
33+
tsconfigRootDir: __dirname,
34+
},
35+
files: ["*.ts"],
36+
rules: {
37+
"default-param-last": "off",
38+
"@typescript-eslint/default-param-last": "error",
39+
"no-array-constructor": "off",
40+
"@typescript-eslint/no-array-constructor": "error",
41+
"no-invalid-this": "off",
42+
"@typescript-eslint/no-invalid-this": "error",
43+
"no-loss-of-precision": "off",
44+
"@typescript-eslint/no-loss-of-precision": "error",
45+
"no-shadow": "off",
46+
"@typescript-eslint/no-shadow": "error",
47+
"no-throw-literal": "off",
48+
"@typescript-eslint/no-throw-literal": "error",
49+
"no-unused-expressions": "off",
50+
"@typescript-eslint/no-unused-expressions": "error",
51+
"@typescript-eslint/unbound-method": "off",
52+
"@typescript-eslint/no-non-null-assertion": "off",
53+
"@typescript-eslint/consistent-type-assertions": [
54+
"warn",
55+
{
56+
assertionStyle: "as",
57+
objectLiteralTypeAssertions: "never",
58+
},
59+
],
60+
"@typescript-eslint/consistent-type-imports": "warn",
61+
"@typescript-eslint/explicit-function-return-type": [
62+
"error",
63+
{
64+
allowTypedFunctionExpressions: true,
65+
},
66+
],
67+
"@typescript-eslint/explicit-member-accessibility": "warn",
68+
"@typescript-eslint/no-base-to-string": "error",
69+
"@typescript-eslint/no-confusing-non-null-assertion": "error",
70+
"@typescript-eslint/no-confusing-void-expression": "error",
71+
"@typescript-eslint/no-implicit-any-catch": [
72+
"error",
73+
{
74+
allowExplicitAny: false,
75+
},
76+
],
77+
"@typescript-eslint/no-invalid-void-type": "error",
78+
"@typescript-eslint/no-require-imports": "error",
79+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
80+
"@typescript-eslint/no-unnecessary-condition": "warn",
81+
"@typescript-eslint/no-unnecessary-qualifier": "warn",
82+
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
83+
"@typescript-eslint/non-nullable-type-assertion-style": "warn",
84+
"@typescript-eslint/prefer-for-of": "warn",
85+
"@typescript-eslint/prefer-optional-chain": "warn",
86+
"@typescript-eslint/prefer-readonly": "warn",
87+
"@typescript-eslint/prefer-ts-expect-error": "warn",
88+
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
89+
"@typescript-eslint/require-array-sort-compare": "error",
90+
"@typescript-eslint/unified-signatures": "warn",
91+
"@typescript-eslint/array-type": "warn",
92+
"@typescript-eslint/consistent-type-definitions": ["warn", "type"],
93+
"@typescript-eslint/member-delimiter-style": "warn",
94+
"@typescript-eslint/method-signature-style": "warn",
95+
"@typescript-eslint/naming-convention": [
96+
"warn",
97+
{
98+
selector: "default",
99+
format: ["camelCase"],
100+
},
101+
{
102+
selector: ["function", "enumMember", "property"],
103+
format: ["camelCase", "PascalCase"],
104+
},
105+
{
106+
selector: "variable",
107+
modifiers: ["const"],
108+
format: ["camelCase", "PascalCase", "UPPER_CASE"],
109+
},
110+
{
111+
selector: "typeLike",
112+
format: ["PascalCase"],
113+
},
114+
{
115+
selector: "typeProperty",
116+
format: ["camelCase", "PascalCase", "UPPER_CASE"],
117+
},
118+
],
119+
"@typescript-eslint/no-extraneous-class": "error",
120+
"@typescript-eslint/no-parameter-properties": "error",
121+
"@typescript-eslint/strict-boolean-expressions": [
122+
"error",
123+
{
124+
allowString: false,
125+
allowNumber: false,
126+
allowNullableObject: false,
127+
},
128+
],
129+
},
130+
},
131+
{
132+
extends: ["plugin:jest/recommended", "plugin:jest/style"],
133+
files: ["*.test.js", "*.test.ts", "test/**"],
134+
rules: {
135+
"jest/no-if": "error",
136+
"jest/no-test-return-statement": "error",
137+
"jest/prefer-strict-equal": "error",
138+
"jest/require-top-level-describe": "error",
139+
"jest/consistent-test-it": [
140+
"warn",
141+
{
142+
withinDescribe: "test",
143+
},
144+
],
145+
"jest/prefer-spy-on": "warn",
146+
"jest/lowercase-name": ["warn", { ignoreTopLevelDescribe: true }],
147+
"@typescript-eslint/naming-convention": "off",
148+
},
149+
},
150+
],
151+
rules: {
152+
"no-loss-of-precision": "error",
153+
"no-template-curly-in-string": "error",
154+
"no-unsafe-optional-chaining": "error",
155+
"array-callback-return": "error",
156+
"consistent-return": "error",
157+
curly: "warn",
158+
"default-param-last": "error",
159+
eqeqeq: "error",
160+
"no-constructor-return": "error",
161+
"no-empty-function": "warn",
162+
"no-eval": "error",
163+
"no-extend-native": "error",
164+
"no-extra-bind": "error",
165+
"no-floating-decimal": "error",
166+
"no-implicit-coercion": "error",
167+
"no-implicit-globals": "error",
168+
"no-implied-eval": "error",
169+
"no-invalid-this": "error",
170+
"no-labels": "error",
171+
"no-lone-blocks": "error",
172+
"no-new": "error",
173+
"no-new-func": "error",
174+
"no-new-wrappers": "error",
175+
"no-octal-escape": "error",
176+
"no-proto": "error",
177+
"no-return-assign": "warn",
178+
"no-script-url": "error",
179+
"no-self-compare": "warn",
180+
"no-sequences": "warn",
181+
"no-throw-literal": "error",
182+
"no-unmodified-loop-condition": "error",
183+
"no-unused-expressions": "warn",
184+
"no-useless-call": "error",
185+
"no-useless-concat": "error",
186+
"no-useless-return": "warn",
187+
"prefer-promise-reject-errors": "error",
188+
radix: "error",
189+
"require-await": "error",
190+
"wrap-iife": ["warn", "inside"],
191+
"no-shadow": "error",
192+
"no-array-constructor": "error",
193+
"no-bitwise": "error",
194+
"no-multi-assign": "warn",
195+
"no-new-object": "error",
196+
"no-useless-computed-key": "warn",
197+
"no-useless-rename": "warn",
198+
"no-var": "error",
199+
"prefer-const": "warn",
200+
"prefer-numeric-literals": "warn",
201+
"prefer-object-spread": "warn",
202+
"prefer-rest-params": "warn",
203+
"prefer-spread": "warn",
204+
"prefer-template": "warn",
205+
"import/no-duplicates": "warn",
206+
"import/order": [
207+
"warn",
208+
{
209+
groups: ["builtin", "external", ["parent", "sibling", "internal", "index"]],
210+
pathGroups: [
211+
{
212+
pattern: "~/**",
213+
group: "internal",
214+
},
215+
{
216+
pattern: "test/**",
217+
group: "internal",
218+
},
219+
],
220+
alphabetize: {
221+
order: "asc",
222+
caseInsensitive: true,
223+
},
224+
"newlines-between": "never",
225+
},
226+
],
227+
"no-else-return": "warn",
228+
"func-names": ["warn", "never"],
229+
"func-style": ["warn", "declaration"],
230+
"one-var": ["warn", "never"],
231+
"operator-assignment": "warn",
232+
"prefer-arrow-callback": "warn",
233+
"no-restricted-syntax": [
234+
"warn",
235+
{
236+
selector: "CallExpression[callee.name='String']",
237+
message: "Don't use the String function. Use .toString() instead.",
238+
},
239+
{
240+
selector: "CallExpression[callee.name='Number']",
241+
message: "Don't use the Number function. Use parseInt or parseFloat instead.",
242+
},
243+
{
244+
selector: "CallExpression[callee.name='Boolean']",
245+
message: "Don't use the Boolean function. Use a strict comparison instead.",
246+
},
247+
],
248+
},
249+
};

.gitignore

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

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install lint-staged
5+
npm run ts-check

.prettierignore

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

0 commit comments

Comments
 (0)