mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 09:39:01 +00:00
Merge 3536fad3d92918475c947ecb8ba6dd1f1b10350a into c7e7e1d884d3bb241ea6448f72a989434c2a35ec
This commit is contained in:
commit
6a42af3d7b
29
thefuck/rules/eslint.py
Normal file
29
thefuck/rules/eslint.py
Normal 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
|
Loading…
x
Reference in New Issue
Block a user