Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
eslint-plugin-ts-expect-error-validator
Advanced tools
A rule that enforces proper usage and validation of TypeScript's @ts-expect-error comments for easier error management
A rule that enforces proper usage and validation of TypeScript's "@ts-expect-error" comments for easier error management
yarn add -D eslint-plugin-ts-expect-error-validator
Add it to your ESLint configuration:
{
"plugins": [
"ts-expect-error-validator"
],
"rules": {
"ts-expect-error-validator/no-empty-expect-error": "error"
}
}
Configure the rule to use strict or default validation mode:
{
"plugins": [
"ts-expect-error-validator"
],
"rules": {
"ts-expect-error-validator/no-empty-expect-error": [
"error",
{
"validationMode": "strict"
}
]
}
}
Option | Description |
---|---|
validationMode | Specifies the validation mode to use. Can be either default or strict . In default mode , only the expected error codes are validated. In strict mode, the error code and error message are validated. Default is default . |
This rule enforces the following rules for @ts-expect-error
comments:
@ts-expect-error
comment should contain at least one TypeScript error code, enclosed in square brackets (
e.g. [TS123]
).strict
validation mode, each error code should be followed by an error description, separated by a
hyphen (e.g. [TS2532 - Object is possibly 'undefined']
).TS
.// @ts-expect-error [TS6133] - ignore the 'myNumber' is declared but its value is never read message
let myNumber: string | undefined;
// You can also ignore more then one error for a line:
// @ts-expect-error [TS2322, TS6133]
const object: { a: number } = { b: 5 };
This library is released under the MIT License.
FAQs
A rule that enforces proper usage and validation of TypeScript's @ts-expect-error comments for easier error management
The npm package eslint-plugin-ts-expect-error-validator receives a total of 64 weekly downloads. As such, eslint-plugin-ts-expect-error-validator popularity was classified as not popular.
We found that eslint-plugin-ts-expect-error-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.