mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1230776: Support scripts from HTML files in eslint. r=gps
Also removes related unused variables in mach_commands.py. --HG-- extra : commitid : IiDVMuEZtA5 extra : rebase_source : 575a51dd0ad5450323b4da5f441f8e5d721e41d6
This commit is contained in:
parent
589f766eac
commit
8d948cbdfc
@ -4,6 +4,10 @@
|
||||
# Exclude expected objdirs.
|
||||
obj*/**
|
||||
|
||||
# Temporarily ignore HTML files that still need to be fixed.
|
||||
browser/extensions/loop/**/*.html
|
||||
devtools/**/*.html
|
||||
|
||||
# We ignore all these directories by default, until we get them enabled.
|
||||
# If you are enabling a directory, please add directory specific exclusions
|
||||
# below.
|
||||
|
@ -48,21 +48,6 @@ option in the node installation) and try again.
|
||||
Valid installation paths:
|
||||
'''.strip()
|
||||
|
||||
ESLINT_PROMPT = '''
|
||||
Would you like to use eslint
|
||||
'''.strip()
|
||||
|
||||
ESLINT_PLUGIN_MOZILLA_PROMPT = '''
|
||||
eslint-plugin-mozilla is an eslint plugin containing rules that help enforce
|
||||
JavaScript coding standards in the Mozilla project. Would you like to use this
|
||||
plugin
|
||||
'''.strip()
|
||||
|
||||
ESLINT_PLUGIN_REACT_PROMPT = '''
|
||||
eslint-plugin-react is an eslint plugin containing rules that help React
|
||||
developers follow strict guidelines. Would you like to install it
|
||||
'''.strip()
|
||||
|
||||
|
||||
@CommandProvider
|
||||
class MachCommands(MachCommandBase):
|
||||
@ -168,8 +153,8 @@ class MachCommands(MachCommandBase):
|
||||
description='Run eslint or help configure eslint for optimal development.')
|
||||
@CommandArgument('-s', '--setup', default=False, action='store_true',
|
||||
help='configure eslint for optimal development.')
|
||||
@CommandArgument('-e', '--ext', default='[.js,.jsm,.jsx,.xml]',
|
||||
help='Filename extensions to lint, default: "[.js,.jsm,.jsx]".')
|
||||
@CommandArgument('-e', '--ext', default='[.js,.jsm,.jsx,.xml,.html]',
|
||||
help='Filename extensions to lint, default: "[.js,.jsm,.jsx,.xml,.html]".')
|
||||
@CommandArgument('-b', '--binary', default=None,
|
||||
help='Path to eslint binary.')
|
||||
@CommandArgument('args', nargs=argparse.REMAINDER) # Passed through to eslint.
|
||||
@ -197,8 +182,13 @@ class MachCommands(MachCommandBase):
|
||||
args = args or ['.']
|
||||
|
||||
cmd_args = [binary,
|
||||
'--ext', ext, # This keeps ext as a single argument.
|
||||
] + args
|
||||
# Enable the HTML plugin.
|
||||
# We can't currently enable this in the global config file
|
||||
# because it has bad interactions with the SublimeText
|
||||
# ESLint plugin (bug 1229874).
|
||||
'--plugin', 'html',
|
||||
'--ext', ext, # This keeps ext as a single argument.
|
||||
] + args
|
||||
|
||||
success = self.run_process(cmd_args,
|
||||
pass_thru=True, # Allow user to run eslint interactively.
|
||||
@ -241,6 +231,12 @@ class MachCommands(MachCommandBase):
|
||||
if not success:
|
||||
return 1
|
||||
|
||||
# Install eslint-plugin-html.
|
||||
success = self.callProcess("eslint-plugin-html",
|
||||
[npmPath, "install", "eslint-plugin-html", "-g"])
|
||||
if not success:
|
||||
return 1
|
||||
|
||||
# Install eslint-plugin-react.
|
||||
success = self.callProcess("eslint-plugin-react",
|
||||
[npmPath, "install", "eslint-plugin-react", "-g"])
|
||||
|
Loading…
Reference in New Issue
Block a user