@jterrazz/typescript 10.1.3 → 10.1.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jterrazz/typescript",
3
- "version": "10.1.3",
3
+ "version": "10.1.5",
4
4
  "license": "MIT",
5
5
  "author": "Jean-Baptiste Terrazzoni <contact@jterrazz.com>",
6
6
  "repository": {
@@ -126,7 +126,6 @@ export default fragment({
126
126
  'prefer-regexp-exec',
127
127
  'prefer-return-this-type',
128
128
  'prefer-string-starts-ends-with',
129
- 'promise-function-async',
130
129
  'related-getter-setter-pairs',
131
130
  'require-array-sort-compare',
132
131
  'require-await',
@@ -163,6 +162,10 @@ export default fragment({
163
162
  typeAware(),
164
163
  'wraps a returned promise, after which nothing awaits it',
165
164
  ),
165
+ 'typescript/promise-function-async': unsafeFix(
166
+ typeAware(),
167
+ 'wraps a function that hands out an existing promise in `async … await`, so the caller receives a fresh promise nobody has claimed',
168
+ ),
166
169
  'typescript/no-unnecessary-type-assertion': unsafeFix(
167
170
  typeAware(),
168
171
  'drops a cast a widened platform type needs',
@@ -69,7 +69,6 @@ export default fragment({
69
69
  'no-useless-error-capture-stack-trace',
70
70
  'no-useless-fallback-in-spread',
71
71
  'no-useless-length-check',
72
- 'no-useless-promise-resolve-reject',
73
72
  'no-useless-spread',
74
73
  'no-useless-switch-case',
75
74
  'no-zero-fractions',
@@ -168,6 +167,10 @@ export default fragment({
168
167
  on(),
169
168
  "rewrites `fileURLToPath(new URL('.', import.meta.url))` into `import.meta.dirname`, which carries no trailing slash",
170
169
  ),
170
+ 'unicorn/no-useless-promise-resolve-reject': unsafeFix(
171
+ on(),
172
+ 'unwraps `Promise.resolve({ … })` in an arrow body into a bare object literal, which is a block',
173
+ ),
171
174
 
172
175
  // -- Off, each with its one reason -------------------------------------
173
176
  'unicorn/explicit-length-check': off({
package/rules/vitest.js CHANGED
@@ -49,7 +49,6 @@ const ON_IN_TESTS = [
49
49
  'padding-around-test-blocks',
50
50
  'prefer-called-exactly-once-with',
51
51
  'prefer-called-once',
52
- 'prefer-called-with',
53
52
  'prefer-comparison-matcher',
54
53
  'prefer-each',
55
54
  'prefer-equality-matcher',
@@ -63,7 +62,6 @@ const ON_IN_TESTS = [
63
62
  'prefer-mock-return-shorthand',
64
63
  'prefer-snapshot-hint',
65
64
  'prefer-spy-on',
66
- 'prefer-strict-boolean-matchers',
67
65
  'prefer-strict-equal',
68
66
  'prefer-to-be',
69
67
  'prefer-to-be-object',
@@ -104,6 +102,14 @@ const REQUIRE_MOCK_TYPE_PARAMETERS = unsafeFix(
104
102
  on(),
105
103
  "rewrites `vi.mock('x', f)` into `vi.mock(import('x'), f)`, after which the factory owes the module's full type",
106
104
  );
105
+ const PREFER_STRICT_BOOLEAN_MATCHERS = unsafeFix(
106
+ on(),
107
+ 'rewrites `toBeTruthy()` into `toBe(true)` whatever the subject is — an element, a string — which is never `true`',
108
+ );
109
+ const PREFER_CALLED_WITH = unsafeFix(
110
+ on(),
111
+ 'rewrites `toHaveBeenCalled()` into `toHaveBeenCalledWith()`, an assertion of NO arguments',
112
+ );
107
113
 
108
114
  export default fragment({
109
115
  id: 'vitest',
@@ -117,6 +123,8 @@ export default fragment({
117
123
  'vitest/consistent-test-it': CONSISTENT_TEST_IT,
118
124
  'vitest/prefer-lowercase-title': PREFER_LOWERCASE_TITLE,
119
125
  'vitest/require-mock-type-parameters': REQUIRE_MOCK_TYPE_PARAMETERS,
126
+ 'vitest/prefer-strict-boolean-matchers': PREFER_STRICT_BOOLEAN_MATCHERS,
127
+ 'vitest/prefer-called-with': PREFER_CALLED_WITH,
120
128
 
121
129
  'vitest/no-conditional-in-test': off({
122
130
  by: "vitest/no-conditional-expect — the defect is an assertion that may not run, and that rule names it; this one also refuses a golden suite's TEST_UPDATE branch and every comparator",