tsdf 7.1.0 → 8.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.eslintrc.cjs +79 -16
  2. package/.vscode/tasks.json +11 -1
  3. package/fetch-orquestrator-scenarios.excalidraw +10115 -0
  4. package/package.json +21 -13
  5. package/src/collectionFetchOrquestrator.ts +23 -0
  6. package/src/collectionStore.ts +608 -0
  7. package/src/documentStore.ts +272 -0
  8. package/src/fetchOrquestrator.ts +335 -0
  9. package/src/listQueryStore.ts +1190 -0
  10. package/src/main.ts +22 -1
  11. package/src/storeShared.ts +5 -0
  12. package/src/useEnsureIsLoaded.ts +50 -0
  13. package/src/utils/filterAndMap.ts +20 -0
  14. package/src/utils/getCacheId.ts +19 -0
  15. package/src/utils/hooks.ts +110 -0
  16. package/src/utils/isObject.ts +3 -0
  17. package/src/utils/math.ts +7 -0
  18. package/src/utils/serializableClone.ts +3 -0
  19. package/src/utils/useLatestValue.ts +16 -0
  20. package/test/__snapshots__/listQueryStore.test.ts.snap +146 -0
  21. package/test/__snapshots__/listQueryStoreHooks.test.ts.snap +9 -0
  22. package/test/collectionStore.test.ts +523 -0
  23. package/test/collectionStoreHooks.test.tsx +651 -0
  24. package/test/documentStore.test.ts +183 -0
  25. package/test/documentStoreHooks.test.tsx +857 -0
  26. package/test/fetchOrquestrator.test.ts +913 -0
  27. package/test/listQueryStore.test.ts +1158 -0
  28. package/test/listQueryStoreHooks.test.tsx +662 -0
  29. package/test/listQueryStoreHooks2.test.tsx +483 -0
  30. package/test/listQueryStoreHooksMutations.test.tsx +764 -0
  31. package/test/mocks/fetchMock.ts +296 -0
  32. package/test/mocks/fetchOrquestratorEnv.ts +370 -0
  33. package/test/setup/setup.ts +95 -1
  34. package/test/testHelpers.test.ts +88 -0
  35. package/test/utils/RenderObjValues.tsx +23 -0
  36. package/test/utils/arrayUtils.ts +13 -0
  37. package/test/utils/createDefaultListQueryStore.ts +275 -0
  38. package/test/utils/createOrVariations.ts +48 -0
  39. package/test/utils/dedent.ts +50 -0
  40. package/test/utils/delayCall.ts +25 -0
  41. package/test/utils/math.ts +3 -0
  42. package/test/utils/objectUtils.ts +18 -0
  43. package/test/utils/range.ts +19 -0
  44. package/test/utils/sleep.ts +3 -0
  45. package/test/utils/storeUtils.ts +460 -0
  46. package/tsconfig.prod.json +1 -1
  47. package/tsup.config.ts +1 -1
  48. package/vitest.config.ts +2 -1
  49. package/test/test.test.ts +0 -5
package/.eslintrc.cjs CHANGED
@@ -1,6 +1,10 @@
1
+ const isCI = process.env.CI === 'true';
2
+
1
3
  const OFF = 0;
2
4
  const WARN = 1;
3
5
  const ERROR = 2;
6
+ const ERROR_IN_CI = isCI ? ERROR : WARN;
7
+ const ERROR_IN_CI_ONLY = isCI ? ERROR : 0;
4
8
 
5
9
  module.exports = {
6
10
  parser: '@typescript-eslint/parser',
@@ -17,19 +21,56 @@ module.exports = {
17
21
  env: {
18
22
  browser: true,
19
23
  },
20
- plugins: ['@typescript-eslint'],
24
+ plugins: ['@typescript-eslint', '@lucasols/extended-lint', 'vitest'],
21
25
 
22
26
  rules: {
23
- 'no-warning-comments': [WARN, { terms: ['FIX:'] }],
24
- 'no-constant-binary-expression': ERROR,
25
- 'object-shorthand': ERROR,
26
- 'no-useless-rename': ERROR,
27
- 'no-param-reassign': ERROR,
27
+ 'no-warning-comments': [ERROR_IN_CI, { terms: ['FIX:'] }],
28
+ '@lucasols/extended-lint/no-warning-comments': [
29
+ ERROR_IN_CI_ONLY,
30
+ { terms: ['FIX-LATER:', 'FIXLATER:'] },
31
+ ],
32
+ 'no-constant-binary-expression': ERROR_IN_CI,
33
+ 'object-shorthand': ERROR_IN_CI,
34
+ 'no-useless-rename': ERROR_IN_CI,
35
+ 'no-param-reassign': ERROR_IN_CI,
36
+ 'prefer-template': ERROR_IN_CI,
37
+ 'prefer-const': [ERROR_IN_CI, { destructuring: 'all' }],
28
38
 
29
39
  'no-prototype-builtins': OFF,
40
+ 'no-inner-declarations': OFF,
41
+ 'no-undef': OFF,
42
+ 'no-console': [ERROR_IN_CI, { allow: ['warn', 'error', 'info'] }],
43
+ 'no-restricted-imports': [
44
+ ERROR_IN_CI,
45
+ {
46
+ patterns: [
47
+ {
48
+ group: ['*.test'],
49
+ message: 'Do not import test files',
50
+ },
51
+ ],
52
+ },
53
+ ],
54
+ 'no-restricted-syntax': [
55
+ ERROR_IN_CI_ONLY,
56
+ {
57
+ selector:
58
+ 'CallExpression[callee.property.name="only"]',
59
+ message: 'No test.only',
60
+ },
61
+ {
62
+ selector:
63
+ 'CallExpression[callee.property.name="todo"]',
64
+ message: 'No test.todo',
65
+ },
66
+ ],
67
+ 'no-implicit-coercion': [
68
+ ERROR_IN_CI,
69
+ { disallowTemplateShorthand: true, allow: ['!!'] },
70
+ ],
30
71
 
31
72
  /* typescript */
32
- '@typescript-eslint/no-explicit-any': OFF,
73
+ '@typescript-eslint/no-unnecessary-condition': ERROR_IN_CI,
33
74
  '@typescript-eslint/naming-convention': [
34
75
  'error',
35
76
  {
@@ -37,20 +78,42 @@ module.exports = {
37
78
  format: ['PascalCase'],
38
79
  },
39
80
  ],
40
- '@typescript-eslint/no-throw-literal': ERROR,
41
- '@typescript-eslint/no-unused-expressions': ERROR,
42
- '@typescript-eslint/no-unused-vars': [ERROR, { argsIgnorePattern: '^_' }],
43
- '@typescript-eslint/no-shadow': [ERROR, { ignoreOnInitialization: true }],
81
+ '@typescript-eslint/no-throw-literal': ERROR_IN_CI,
82
+ '@typescript-eslint/no-unused-expressions': ERROR_IN_CI,
83
+ '@typescript-eslint/no-unused-vars': [
84
+ ERROR_IN_CI,
85
+ { argsIgnorePattern: '^_', ignoreRestSiblings: true },
86
+ ],
87
+ '@typescript-eslint/no-shadow': [
88
+ ERROR_IN_CI,
89
+ { ignoreOnInitialization: true, allow: ['expect'] },
90
+ ],
91
+ '@typescript-eslint/ban-types': [
92
+ ERROR_IN_CI,
93
+ {
94
+ types: {
95
+ Error: 'Dont use error type',
96
+ },
97
+ },
98
+ ],
99
+
44
100
  '@typescript-eslint/no-non-null-assertion': OFF,
101
+ '@typescript-eslint/no-empty-function': OFF,
102
+ '@typescript-eslint/no-explicit-any': OFF,
103
+ '@typescript-eslint/no-floating-promises': OFF,
104
+ '@typescript-eslint/no-unsafe-assignment': OFF,
105
+ '@typescript-eslint/no-misused-promises': OFF,
106
+ '@typescript-eslint/restrict-template-expressions': OFF,
107
+ '@typescript-eslint/unbound-method': OFF,
45
108
 
46
- /* jest */
47
- 'jest/expect-expect': [ERROR, { assertFunctionNames: ['expect*'] }],
48
- 'jest/no-deprecated-functions': OFF,
109
+ /* vitest */
110
+ 'vitest/expect-expect': ERROR_IN_CI_ONLY,
111
+ 'vitest/no-identical-title': ERROR_IN_CI,
49
112
  },
50
113
  extends: [
51
114
  'eslint:recommended',
52
115
  'plugin:@typescript-eslint/recommended',
53
- 'plugin:jest/recommended',
54
- 'plugin:jest/style',
116
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
117
+ 'plugin:react-hooks/recommended',
55
118
  ],
56
119
  };
@@ -10,7 +10,7 @@
10
10
  "problemMatcher": [],
11
11
  "presentation": {
12
12
  "clear": true
13
- },
13
+ }
14
14
  },
15
15
  {
16
16
  "type": "npm",
@@ -20,6 +20,16 @@
20
20
  "presentation": {
21
21
  "clear": true
22
22
  }
23
+ },
24
+ {
25
+ "type": "npm",
26
+ "script": "eslint",
27
+ "problemMatcher": ["$eslint-stylish"],
28
+ "label": "eslint",
29
+ "detail": "CI=true eslint --ext .jsx,.js,.ts,.tsx src/ test/",
30
+ "presentation": {
31
+ "clear": true
32
+ }
23
33
  }
24
34
  ]
25
35
  }