Skip to content

Commit 9aea303

Browse files
committed
chore(deps): update all
- replace husky mechanics due to breaking changes between 4 and 7 - replace tslint by eslint due to deprecation of tslint - add tslib to fix "'__spreadArray' is not exported" error - use lint-staged
1 parent 538e51b commit 9aea303

17 files changed

+2621
-2188
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

.eslintrc.js

+250
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
/*
2+
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
3+
https://github.com/typescript-eslint/tslint-to-eslint-config
4+
5+
It represents the closest reasonable ESLint configuration to this
6+
project's original TSLint configuration.
7+
8+
We recommend eventually switching this configuration to extend from
9+
the recommended rulesets in typescript-eslint.
10+
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
11+
12+
Happy linting! 💖
13+
*/
14+
module.exports = {
15+
env: {
16+
browser: true,
17+
node: true,
18+
commonjs: true,
19+
es6: true
20+
},
21+
extends: [
22+
'plugin:@typescript-eslint/recommended',
23+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
24+
'prettier',
25+
'plugin:prettier/recommended'
26+
],
27+
parser: '@typescript-eslint/parser',
28+
parserOptions: {
29+
project: 'tsconfig.json',
30+
sourceType: 'module'
31+
},
32+
plugins: [
33+
'eslint-plugin-import',
34+
'eslint-plugin-jsdoc',
35+
'eslint-plugin-prefer-arrow',
36+
'@typescript-eslint'
37+
],
38+
rules: {
39+
'prettier/prettier': 'error',
40+
'@typescript-eslint/adjacent-overload-signatures': 'error',
41+
'@typescript-eslint/array-type': [
42+
'error',
43+
{
44+
default: 'generic'
45+
}
46+
],
47+
'@typescript-eslint/ban-types': 'off',
48+
'@typescript-eslint/consistent-type-assertions': 'error',
49+
'@typescript-eslint/consistent-type-definitions': 'error',
50+
'@typescript-eslint/dot-notation': 'off',
51+
'@typescript-eslint/explicit-member-accessibility': [
52+
'off',
53+
{
54+
accessibility: 'explicit'
55+
}
56+
],
57+
'@typescript-eslint/indent': 'off',
58+
'@typescript-eslint/member-delimiter-style': [
59+
'error',
60+
{
61+
multiline: {
62+
delimiter: 'semi',
63+
requireLast: true
64+
},
65+
singleline: {
66+
delimiter: 'semi',
67+
requireLast: false
68+
}
69+
}
70+
],
71+
'@typescript-eslint/member-ordering': 'error',
72+
'@typescript-eslint/naming-convention': [
73+
'error',
74+
{
75+
selector: ['property', 'parameterProperty'],
76+
modifiers: ['private'],
77+
leadingUnderscore: 'require',
78+
format: ['camelCase']
79+
},
80+
{
81+
selector: ['property', 'parameterProperty'],
82+
modifiers: ['protected'],
83+
format: ['camelCase']
84+
},
85+
{ selector: 'method', format: ['camelCase'] },
86+
{ selector: 'class', format: ['PascalCase'] }
87+
],
88+
'@typescript-eslint/no-empty-function': 'off',
89+
'@typescript-eslint/no-empty-interface': 'error',
90+
'@typescript-eslint/no-explicit-any': 'off',
91+
'@typescript-eslint/no-inferrable-types': [
92+
'error',
93+
{
94+
ignoreParameters: true
95+
}
96+
],
97+
'@typescript-eslint/no-misused-new': 'error',
98+
'@typescript-eslint/no-namespace': 'error',
99+
'@typescript-eslint/no-non-null-assertion': 'error',
100+
'@typescript-eslint/no-parameter-properties': 'off',
101+
'@typescript-eslint/restrict-template-expressions': 'off',
102+
'@typescript-eslint/no-shadow': [
103+
'error',
104+
{
105+
hoist: 'all'
106+
}
107+
],
108+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
109+
'@typescript-eslint/no-unused-expressions': 'error',
110+
'@typescript-eslint/no-use-before-define': 'off',
111+
'@typescript-eslint/no-var-requires': 'error',
112+
'@typescript-eslint/prefer-for-of': 'error',
113+
'@typescript-eslint/prefer-function-type': 'error',
114+
'@typescript-eslint/prefer-namespace-keyword': 'error',
115+
'@typescript-eslint/prefer-readonly': 'error',
116+
'@typescript-eslint/no-unsafe-member-access': 'off',
117+
'@typescript-eslint/no-unsafe-assignment': 'off',
118+
'@typescript-eslint/no-unsafe-return': 'off',
119+
'@typescript-eslint/no-unsafe-call': 'off',
120+
'@typescript-eslint/explicit-module-boundary-types': 'off',
121+
'@typescript-eslint/semi': ['error', 'always'],
122+
'@typescript-eslint/triple-slash-reference': [
123+
'error',
124+
{
125+
path: 'always',
126+
types: 'prefer-import',
127+
lib: 'always'
128+
}
129+
],
130+
'@typescript-eslint/type-annotation-spacing': 'error',
131+
'@typescript-eslint/unified-signatures': 'error',
132+
'arrow-body-style': 'error',
133+
'arrow-parens': ['off', 'always'],
134+
'brace-style': ['error', '1tbs'],
135+
'comma-dangle': [
136+
'error',
137+
{
138+
objects: 'never',
139+
arrays: 'never',
140+
functions: 'never'
141+
}
142+
],
143+
complexity: 'off',
144+
'constructor-super': 'error',
145+
curly: 'error',
146+
'dot-notation': 'off',
147+
'eol-last': 'error',
148+
eqeqeq: ['error', 'smart'],
149+
'guard-for-in': 'error',
150+
'id-blacklist': 'off',
151+
'id-match': 'off',
152+
'import/no-deprecated': 'warn',
153+
indent: 'off',
154+
'jsdoc/check-alignment': 'error',
155+
'jsdoc/check-indentation': 'error',
156+
'jsdoc/newline-after-description': 'error',
157+
'linebreak-style': 'off',
158+
'max-classes-per-file': ['error', 1],
159+
'max-len': 'off',
160+
'new-parens': 'error',
161+
'newline-per-chained-call': 'off',
162+
'no-bitwise': 'error',
163+
'no-caller': 'error',
164+
'no-cond-assign': 'off',
165+
'no-console': [
166+
'error',
167+
{
168+
allow: [
169+
'log',
170+
'warn',
171+
'dir',
172+
'timeLog',
173+
'assert',
174+
'clear',
175+
'count',
176+
'countReset',
177+
'group',
178+
'groupEnd',
179+
'table',
180+
'dirxml',
181+
'error',
182+
'groupCollapsed',
183+
'Console',
184+
'profile',
185+
'profileEnd',
186+
'timeStamp',
187+
'context'
188+
]
189+
}
190+
],
191+
'no-debugger': 'error',
192+
'no-duplicate-imports': 'error',
193+
'no-empty': 'off',
194+
'no-empty-function': 'off',
195+
'no-eval': 'error',
196+
'no-extra-semi': 'off',
197+
'no-fallthrough': 'error',
198+
'no-invalid-this': 'off',
199+
'no-irregular-whitespace': 'error',
200+
'no-multiple-empty-lines': [
201+
'error',
202+
{
203+
max: 2
204+
}
205+
],
206+
'no-new-wrappers': 'error',
207+
'no-restricted-imports': ['error', 'rxjs', 'rxjs/Rx'],
208+
'no-shadow': 'off',
209+
'no-throw-literal': 'error',
210+
'no-trailing-spaces': 'error',
211+
'no-undef-init': 'error',
212+
'no-underscore-dangle': 'off',
213+
'no-unsafe-finally': 'error',
214+
'no-unused-expressions': 'error',
215+
'no-unused-labels': 'error',
216+
'no-use-before-define': 'off',
217+
'no-var': 'error',
218+
'object-shorthand': 'error',
219+
'one-var': ['error', 'never'],
220+
'padded-blocks': [
221+
'off',
222+
{
223+
blocks: 'never'
224+
},
225+
{
226+
allowSingleLineBlocks: true
227+
}
228+
],
229+
'prefer-arrow/prefer-arrow-functions': 'error',
230+
'prefer-const': 'error',
231+
'quote-props': 'off',
232+
quotes: ['error', 'single', { allowTemplateLiterals: true }],
233+
radix: 'error',
234+
semi: 'error',
235+
'space-before-function-paren': 'off',
236+
'space-in-parens': ['off', 'never'],
237+
'spaced-comment': [
238+
'error',
239+
'always',
240+
{
241+
markers: ['/']
242+
}
243+
],
244+
'use-isnan': 'error',
245+
'valid-typeof': 'off',
246+
'no-else-return': 'error',
247+
'no-unused-expressions': 'error',
248+
'no-unused-vars': 'error'
249+
}
250+
};

.husky/commit-msg

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
. "$(dirname "$0")/common.sh"
4+
5+
yarn commitlint --edit $1

.husky/common.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
command_exists () {
2+
command -v "$1" >/dev/null 2>&1
3+
}
4+
5+
# Workaround for Windows 10, Git Bash and Yarn
6+
if command_exists winpty && test -t 1; then
7+
exec < /dev/tty
8+
fi

.husky/pre-commit

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
. "$(dirname "$0")/common.sh"
4+
5+
yarn lint-staged

.husky/pre-push

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
. "$(dirname "$0")/common.sh"
4+
5+
yarn test && yarn build

.huskyrc.json

-7
This file was deleted.

.lintstagedrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"*.ts": [
3+
"yarn lint"
4+
]
5+
}

.prettierrc

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
{
2+
"endOfLine": "auto",
23
"printWidth": 100,
34
"singleQuote": true,
45
"tabWidth": 4,
56
"trailingComma": "none",
6-
"arrowParens": "avoid",
7-
"overrides": [
8-
{
9-
"files": "*.yml",
10-
"options": {
11-
"tabWidth": 2
12-
}
13-
}
14-
]
7+
"arrowParens": "avoid"
158
}

examples/models/organization.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import { Human } from './human';
33
import { Society } from './society';
44
import { Zoo } from './zoo';
55

6-
const prefixWithUnderscore = (propertyName: string) => {
7-
return `_${propertyName}`;
8-
};
6+
const prefixWithUnderscore = (propertyName: string) => `_${propertyName}`;
97

108
@Serializable({ formatPropertyNames: prefixWithUnderscore })
119
export class Organization extends Society {

examples/models/zoo.ts

+9-13
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,17 @@ import { Snake } from './snake';
77
import { UnknownAnimal } from './unknown-animal';
88
import { PhoneNumber } from './phone-number';
99

10-
const snakeOrPanther = (animal: any) => {
11-
return animal && animal['isPoisonous'] !== undefined ? Snake : Panther;
12-
};
10+
const snakeOrPanther = (animal: any) =>
11+
animal && animal['isPoisonous'] !== undefined ? Snake : Panther;
1312

14-
const coordinatesToArray = (coordinates: { x: number; y: number; z: number }) => {
15-
return Object.values(coordinates);
16-
};
13+
const coordinatesToArray = (coordinates: { x: number; y: number; z: number }) =>
14+
Object.values(coordinates);
1715

18-
const arrayToCoordinates = (array: Array<number>) => {
19-
return {
20-
x: array[0],
21-
y: array[1],
22-
z: array[2]
23-
};
24-
};
16+
const arrayToCoordinates = (array: Array<number>) => ({
17+
x: array[0],
18+
y: array[1],
19+
z: array[2]
20+
});
2521

2622
@Serializable()
2723
export class Zoo {

0 commit comments

Comments
 (0)