eslint-plugin-member-safe
v0.2.0
Published
Prevent the risk that the object is null or undefined when accessing object properties
Downloads
156
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-dev
Next, install eslint-plugin-member-safe
:
npm install eslint-plugin-member-safe --save-dev
Usage
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. | ✅ |