README
eslint-plugin-putout
ESLint
plugin for 🐊Putout
with built-in rules from @putout/eslint-config
.
Installation
npm i putout eslint eslint-plugin-putout -D
Note: If you installed ESLint globally (using the -g
flag) then you must also install putout
and eslint-plugin-putout
globally.
Usage
Add putout
to the plugins section of your .eslintrc.json
configuration file. You can omit the eslint-plugin-
prefix:
{
"extends": [
"plugin:putout/recommended"
],
"plugins": [
"putout"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"putout/add-newlines-between-types-in-union": "error",
"putout/add-newline-before-function-call": "error",
"putout/add-newline-after-function-call": "error",
"putout/putout": "error",
"putout/array-element-newline": "error",
"putout/single-property-destructuring": "error",
"putout/multiple-properties-destructuring": "error",
"putout/long-properties-destructuring": "error",
"putout/destructuring-as-function-argument": "error",
"putout/align-spaces": "error",
"putout/keyword-spacing": "error",
"putout/newline-function-call-arguments": "error",
"putout/function-declaration-paren-newline": "error",
"putout/remove-newline-after-default-import": "error",
"putout/remove-newline-from-empty-object": "error",
"putout/remove-empty-newline-before-first-specifier": "error",
"putout/remove-empty-newline-after-last-specifier": "error",
"putout/remove-empty-newline-after-last-element": "error",
"putout/remove-empty-newline-after-import": "error",
"putout/remove-empty-specifiers": "error",
"putout/objects-braces-inside-array": "error",
"putout/object-init": "error",
"putout/tape-add-newline-between-tests": "error",
"putout/tape-add-newline-before-assertion": "error",
"putout/tape-remove-newline-before-t-end": "error"
}
}
Rules
Putout
🐊Supertape
📼TypeScript
Formatting
- ✅ Add newline before function call
- ✅ Add newline after function call
- ✅ Align spaces
- ✅ Array element newline
- ✅ Single property destructuring
- ✅ Multiple properties destructuring
- ✅ For-of multiple properties destructuring
- ✅ Long properties destructuring
- ✅ Destructuring as function argument
- ✅ Keyword spacing
- ✅ Newline function call arguments
- ✅ Function declaration paren newline
- ✅ Remove newline after default import
- ✅ Remove newline from empty object
- ✅ Remove empty newline before first specifier
- ✅ Remove empty newline after last specifier
- ✅ Remove empty newline after last element
- ✅ Remove empty newline after import
- ✅ Remove empty specifiers
- ✅ Objects braces inside array
- ✅ Object init
- ✅ No unresolved
Safe mode
When using 🐊Putout
in IDE with --fix
on save, or when you want to disable the most dangerous rules, use:
{
"extends": [
"plugin:putout/safe"
],
"plugins": [
"putout"
]
}
Disabled ESLint
rules:
Disabled 🐊Putout
rules:
- 🐲
remove-empty
; - 🐲
nodejs/remove-process-exit
; - 🐲
remove-unused-variables
; - 🐲
typescript/remove-unused-types
; - 🐲
remove-unused-for-of-variables
; - 🐲
remove-unused-expressions
; - 🐲
remove-unreferenced-variables
; - 🐲
remove-useless-arguments
; - 🐲
remove-useless-for-of
; - 🐲
remove-useless-return
; - 🐲
remove-useless-spread
; - 🐲
remove-useless-variables/rename
; - 🐲
remove-skip
; - 🐲
remove-only
; - 🐲
remove-console
; - 🐲
remove-debugger
; - 🐲
remove-unreachable-code
; - 🐲
convert-for-to-for-of
;
safe+align
When you want to enable ability to align spaces on empty lines, while have all benefits of safe
preset: use safe+align
.