1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 06:38:32 +00:00

Merge 3536fad3d92918475c947ecb8ba6dd1f1b10350a into c7e7e1d884d3bb241ea6448f72a989434c2a35ec

This commit is contained in:
nopeless 2024-05-04 19:03:09 -07:00 committed by GitHub
commit 6a42af3d7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

29
thefuck/rules/eslint.py Normal file
View File

@ -0,0 +1,29 @@
import re, os
from thefuck.utils import replace_argument, for_app
def match(command):
return 'ESLint couldn\'t find the plugin' in command.output
ex = os.path.exists
eslint_regex = re.compile("ESLint couldn't find the plugin \"([^\"]+)\"")
def get_node_package_manager_install_dev():
if ex("yarn.lock"):
return "yarn add --dev"
return "npm i -D"
def get_new_command(command):
package = eslint_regex.search(command.output).group(1)
if not package:
return None
npm = get_node_package_manager_install_dev()
if not npm:
return None
return npm + " " + package