eslint-plugin-optional-chain
v0.0.1
Published
This is an ESLint plugin that provides a custom rule to automatically convert dot operators (.) to optional chain operators (?.) in your code.
Downloads
10
Maintainers
Readme
eslint-plugin-optional-chain
This is an ESLint plugin that provides a custom rule to automatically convert dot operators (.) to optional chain operators (?.) in your code.
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-optional-chain
:
npm install eslint-plugin-optional-chain --save-dev
Usage
Add optional-chain
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["optional-chain"]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"optional-chain/auto-optional-chain": 2
}
}
Rules
🔧 Automatically fixable by the --fix
CLI option.
| Name | Description | 🔧 | | :------------------------------------------------------- | :------------------------------------------------------------------------------------- | :- | | auto-optional-chain | Automatically convert dot operators (.) to optional chain operators (?.) in your code. | 🔧 |