Bug 1291910 - Add ability for mach eslint to accept --fix. r=Felipe

MozReview-Commit-ID: 5PB2oI2jPri

--HG--
extra : rebase_source : 42d03b9ab93c4ef390d0dfa59d25dd330309071d
This commit is contained in:
Jared Wein 2016-08-03 19:18:55 -04:00
Родитель 871ed4e3ba
Коммит df53d45313
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -86,8 +86,10 @@ class MachCommands(MachCommandBase):
help='Filename extensions to lint, default: "[.js,.jsm,.jsx,.xml,.html]".')
@CommandArgument('-b', '--binary', default=None,
help='Path to eslint binary.')
@CommandArgument('--fix', default=False, action='store_true',
help='Request that eslint automatically fix errors, where possible.')
@CommandArgument('args', nargs=argparse.REMAINDER) # Passed through to eslint.
def eslint(self, setup, ext=None, binary=None, args=None):
def eslint(self, setup, ext=None, binary=None, fix=False, args=None):
'''Run eslint.'''
module_path = self.get_eslint_module_path()
@ -148,6 +150,10 @@ class MachCommands(MachCommandBase):
'--ext', ext, # This keeps ext as a single argument.
] + args
# eslint requires that --fix be set before the --ext argument.
if fix:
cmd_args.insert(1, '--fix')
success = self.run_process(
cmd_args,
pass_thru=True, # Allow user to run eslint interactively.