eslint-plugin-no-type-assertion
Advanced tools
Comparing version 1.1.1 to 1.2.0
# Changelog | ||
## 1.2.0 - 2022-03-26 | ||
- Ban non-null assertion operator | ||
## 1.1.1 - 2021-11-28 | ||
@@ -4,0 +8,0 @@ |
@@ -10,2 +10,3 @@ module.exports = { | ||
asAssertion: "Do not use as operator for type assertion", | ||
nonNullAssertion: "Do not use non-null assertion operator", | ||
}, | ||
@@ -39,4 +40,8 @@ schema: [], | ||
}, | ||
TSNonNullExpression(node) { | ||
context.report({ node, messageId: "nonNullAssertion" }); | ||
}, | ||
}; | ||
}, | ||
}; |
{ | ||
"name": "eslint-plugin-no-type-assertion", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Disallow type assertions in TypeScript code", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -10,4 +10,8 @@ # eslint-plugin-no-type-assertion | ||
const bar = <number>foo; | ||
const baz = foo as number; | ||
const notAString = <string>foo; // can't perform angle-bracketed type assertion | ||
const alsoNotAString = foo as string; // can't use `as` operator for type assertion | ||
const objectWithOptionalProperty: { a?: number } = {}; | ||
const notANumber = objectWithOptionalProperty.a! / 2; // can't use non-null assertion operator | ||
``` | ||
@@ -14,0 +18,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4909
44
62