eslint-plugin-member-safe
v0.2.0
Published
Prevent the risk that the object is null or undefined when accessing object properties
Maintainers
Readme
eslint-plugin-member-safe
Prevent the risk that the type error of Cannot read properties of undefined when object accessed or function called.
Installation
You'll first need to install ESLint:
npm i eslint --save-devNext, install eslint-plugin-member-safe:
npm install eslint-plugin-member-safe --save-devUsage
Add member-safe to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": [
"member-safe"
]
}Then configure the rules you want to use under the rules section.
{
"rules": {
"member-safe/optional-chaining-check": "error"
}
}Rules
🔧 Automatically fixable by the
--fix CLI option.
| Name | Description | 🔧 | | :------------------------------------------------------------------- | :----------------------------------------------------------------------------------------- | :-- | | optional-chaining-check | Check if the object accessed or function called using optional chaining operator. | ✅ |
