Skip to content

Commit 3785b0d

Browse files
authored
Move types into repo (#2037)
* prepare new types pacakge * move shared types to controller - build fails now * add dummy nx.json - install types package correctly - try devDep attr * monorepo dep should be enough for types * adjust tsconfig to load local types * fix some types to fix build * automatically extract api * directly export Adapter and AdapterOptions from adapter.ts * add tests for types * fixed export and types * fix ts * fix build * fix tests
1 parent 9868988 commit 3785b0d

File tree

21 files changed

+3791
-221
lines changed

21 files changed

+3791
-221
lines changed

.eslintrc.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,100 @@ module.exports = {
147147
],
148148
'@typescript-eslint/no-this-alias': 'off',
149149

150+
// Prefer simple property access and declaration without quotes
151+
'dot-notation': 'off',
152+
'@typescript-eslint/dot-notation': [
153+
'error',
154+
{
155+
allowPrivateClassPropertyAccess: true,
156+
allowProtectedClassPropertyAccess: true
157+
}
158+
],
159+
'quote-props': ['error', 'as-needed']
160+
}
161+
},
162+
// test-d.ts files
163+
{
164+
parser: '@typescript-eslint/parser',
165+
parserOptions: {
166+
ecmaVersion: 2019,
167+
sourceType: 'module',
168+
project: './tsconfig.json'
169+
},
170+
files: ['**/*.test-d.ts'],
171+
extends: ['plugin:@typescript-eslint/recommended'],
172+
rules: {
173+
'@typescript-eslint/no-empty-function': 'off',
174+
'@typescript-eslint/no-parameter-properties': 'off',
175+
'@typescript-eslint/no-explicit-any': 'off',
176+
'@typescript-eslint/no-use-before-define': [
177+
'error',
178+
{
179+
functions: false,
180+
typedefs: false,
181+
classes: false
182+
}
183+
],
184+
'@typescript-eslint/no-unused-vars': [
185+
'off',
186+
{
187+
ignoreRestSiblings: true,
188+
argsIgnorePattern: '^_'
189+
}
190+
],
191+
'@typescript-eslint/no-object-literal-type-assertion': 'off',
192+
'@typescript-eslint/interface-name-prefix': 'off',
193+
'@typescript-eslint/no-non-null-assertion': 'off', // This is necessary for Map.has()/get()!
194+
'@typescript-eslint/no-inferrable-types': [
195+
'error',
196+
{
197+
ignoreProperties: true,
198+
ignoreParameters: true
199+
}
200+
],
201+
'@typescript-eslint/ban-ts-comment': [
202+
'error',
203+
{
204+
'ts-expect-error': false,
205+
'ts-ignore': true,
206+
'ts-nocheck': true,
207+
'ts-check': false
208+
}
209+
],
210+
'@typescript-eslint/restrict-template-expressions': [
211+
'error',
212+
{
213+
allowNumber: true,
214+
allowBoolean: true,
215+
// This is necessary to log errors
216+
// TODO: Consider switching to false when we may annotate catch clauses
217+
allowAny: true,
218+
allowNullish: true
219+
}
220+
],
221+
'@typescript-eslint/no-misused-promises': [
222+
'error',
223+
{
224+
checksVoidReturn: false
225+
}
226+
],
227+
// We can turn this on from time to time but in general these rules
228+
// make our lives harder instead of easier
229+
'@typescript-eslint/no-unsafe-argument': 'off',
230+
'@typescript-eslint/no-unsafe-assignment': 'off',
231+
'@typescript-eslint/no-unsafe-member-access': 'off',
232+
'@typescript-eslint/no-unsafe-return': 'off',
233+
'@typescript-eslint/no-unsafe-call': 'off',
234+
235+
// Although this rule makes sense, it takes about a second to execute (and we don't need it)
236+
'@typescript-eslint/no-implied-eval': 'off',
237+
238+
'@typescript-eslint/explicit-module-boundary-types': [
239+
'warn',
240+
{ allowArgumentsExplicitlyTypedAsAny: true }
241+
],
242+
'@typescript-eslint/no-this-alias': 'off',
243+
150244
// Prefer simple property access and declaration without quotes
151245
'dot-notation': 'off',
152246
'@typescript-eslint/dot-notation': [

.github/workflows/ci-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ jobs:
8686
- name: Run scripts
8787
run: npm run preinstall && npm run install
8888

89+
- name: Execute Type Tests
90+
run: npm run test-types
91+
8992
- name: Execute Standard Tests
9093
run: npm test
9194

nx.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"tasksRunnerOptions": {
3+
"default": {
4+
"runner": "nx/tasks-runners/default",
5+
"options": {
6+
"cacheableOperations": [],
7+
"parallel": 5
8+
}
9+
}
10+
},
11+
"targetDefaults": {
12+
"build": {
13+
"dependsOn": [
14+
"^build",
15+
"prebuild"
16+
]
17+
},
18+
"test": {
19+
"dependsOn": [
20+
"build"
21+
]
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)