mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1585565 - fix package.json loading in eslint setup to always use utf-8 instead of system encoding, r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D47883 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
23a9f21ad1
commit
438b65574e
@ -181,7 +181,7 @@ def call_process(name, cmd, cwd=None, append_env={}):
|
||||
def expected_eslint_modules():
|
||||
# Read the expected version of ESLint and external modules
|
||||
expected_modules_path = os.path.join(get_project_root(), "package.json")
|
||||
with open(expected_modules_path, "r") as f:
|
||||
with open(expected_modules_path, "r", encoding="utf-8") as f:
|
||||
sections = json.load(f)
|
||||
expected_modules = sections["dependencies"]
|
||||
expected_modules.update(sections["devDependencies"])
|
||||
@ -190,14 +190,14 @@ def expected_eslint_modules():
|
||||
# dependencies are up to date.
|
||||
mozilla_json_path = os.path.join(get_eslint_module_path(),
|
||||
"eslint-plugin-mozilla", "package.json")
|
||||
with open(mozilla_json_path, "r") as f:
|
||||
with open(mozilla_json_path, "r", encoding="utf-8") as f:
|
||||
expected_modules.update(json.load(f)["dependencies"])
|
||||
|
||||
# Also read the in-tree ESLint plugin spidermonkey information, to ensure the
|
||||
# dependencies are up to date.
|
||||
mozilla_json_path = os.path.join(get_eslint_module_path(),
|
||||
"eslint-plugin-spidermonkey-js", "package.json")
|
||||
with open(mozilla_json_path, "r") as f:
|
||||
with open(mozilla_json_path, "r", encoding="utf-8") as f:
|
||||
expected_modules.update(json.load(f)["dependencies"])
|
||||
|
||||
return expected_modules
|
||||
@ -246,8 +246,7 @@ def eslint_module_needs_setup():
|
||||
print("%s v%s needs to be installed locally." % (name, version_range))
|
||||
has_issues = True
|
||||
continue
|
||||
|
||||
data = json.load(open(path))
|
||||
data = json.load(open(path, encoding="utf-8"))
|
||||
|
||||
if version_range.startswith("file:"):
|
||||
# We don't need to check local file installations for versions, as
|
||||
|
Loading…
Reference in New Issue
Block a user