@blumintinc/eslint-plugin-blumint 1.20.75 → 1.20.76

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/lib/index.js CHANGED
@@ -223,7 +223,7 @@ function noFrontendImportsFromFunctionsPatterns(pattern) {
223
223
  module.exports = {
224
224
  meta: {
225
225
  name: '@blumintinc/eslint-plugin-blumint',
226
- version: '1.20.75',
226
+ version: '1.20.76',
227
227
  },
228
228
  parseOptions: {
229
229
  ecmaVersion: 2020,
@@ -156,6 +156,17 @@ exports.noTypeAssertionReturns = (0, createRule_1.createRule)({
156
156
  if (node.parent?.type === utils_1.AST_NODE_TYPES.ReturnStatement) {
157
157
  return true;
158
158
  }
159
+ // An assertion whose parent is another assertion is an inner link of a chain
160
+ // (`x as unknown as T`). The chain expresses ONE violation, and only the
161
+ // outermost link describes the type that actually reaches the caller, so it
162
+ // alone carries the report — otherwise the author is told to fix a cast to
163
+ // "unknown", which is not actionable. Exempting inner links also makes the
164
+ // report count independent of body style: an expression-bodied arrow has no
165
+ // ReturnStatement node, so its chain yields a single report either way.
166
+ if (node.parent?.type === utils_1.AST_NODE_TYPES.TSAsExpression ||
167
+ node.parent?.type === utils_1.AST_NODE_TYPES.TSTypeAssertion) {
168
+ return true;
169
+ }
159
170
  // If the parent is an arrow function, we already handle it in ArrowFunctionExpression
160
171
  if (node.parent?.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression) {
161
172
  return true;
@@ -268,11 +279,9 @@ exports.noTypeAssertionReturns = (0, createRule_1.createRule)({
268
279
  if (mergedOptions.allowAsConst && isAsConstAssertion(node.argument)) {
269
280
  return;
270
281
  }
271
- // For nested type assertions, only report the outermost one
272
- if (node.argument.expression.type === utils_1.AST_NODE_TYPES.TSAsExpression) {
273
- reportTypeAssertion(node.argument);
274
- return;
275
- }
282
+ // The returned expression is the outermost link of any assertion chain, so
283
+ // reporting it here yields one report naming the final asserted type; inner
284
+ // links are exempted in shouldAllowTypeAssertion.
276
285
  reportTypeAssertion(node.argument);
277
286
  }
278
287
  // Check for type assertions using angle bracket syntax
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blumintinc/eslint-plugin-blumint",
3
- "version": "1.20.75",
3
+ "version": "1.20.76",
4
4
  "description": "Custom eslint rules for use within BluMint",
5
5
  "author": {
6
6
  "name": "Brodie McGuire",
@@ -1,4 +1,18 @@
1
1
  [
2
+ {
3
+ "version": "1.20.76",
4
+ "date": "2026-08-02T07:09:34.794Z",
5
+ "rules": [
6
+ {
7
+ "name": "no-type-assertion-returns",
8
+ "changeType": "fix",
9
+ "issues": [
10
+ 1609
11
+ ],
12
+ "summary": "report a chained assertion once, on the outermost link (closes #1609)"
13
+ }
14
+ ]
15
+ },
2
16
  {
3
17
  "version": "1.20.75",
4
18
  "date": "2026-08-02T06:40:23.306Z",