diff --git a/.gitignore b/.gitignore index 95b7492d146c..5214c66432a6 100644 --- a/.gitignore +++ b/.gitignore @@ -100,8 +100,8 @@ testing/mozharness/logs/ testing/mozharness/.coverage testing/mozharness/nosetests.xml -# Ignore node_modules -tools/lint/eslint/node_modules/ +# Ignore ESLint node_modules +node_modules/ # Ignore talos virtualenv and tp5n files. # The tp5n set is supposed to be decompressed at diff --git a/.hgignore b/.hgignore index 9227ae9a0b05..b257004c2889 100644 --- a/.hgignore +++ b/.hgignore @@ -112,8 +112,8 @@ GPATH # Ignore tox generated dir .tox/ -# Ignore node_modules -^tools/lint/eslint/node_modules/ +# Ignore ESLint node_modules +^node_modules/ # Ignore talos virtualenv and tp5n files. # The tp5n set is supposed to be decompressed at diff --git a/tools/lint/eslint/npm-shrinkwrap.json b/npm-shrinkwrap.json similarity index 100% rename from tools/lint/eslint/npm-shrinkwrap.json rename to npm-shrinkwrap.json diff --git a/tools/lint/eslint/package.json b/package.json similarity index 70% rename from tools/lint/eslint/package.json rename to package.json index c87a8ed55ad3..aa1a7258d2dc 100644 --- a/tools/lint/eslint/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "mach-eslint", - "description": "ESLint and external plugins for use with mach", + "name": "Mozilla ESLint Setup", + "description": "This package file is for setup of ESLint only for editor integration.", "repository": {}, "license": "MPL-2.0", "dependencies": { diff --git a/taskcluster/ci/source-test/mozlint.yml b/taskcluster/ci/source-test/mozlint.yml index 5ea81787bd91..8ab891d5ae63 100644 --- a/taskcluster/ci/source-test/mozlint.yml +++ b/taskcluster/ci/source-test/mozlint.yml @@ -13,12 +13,12 @@ mozlint-eslint: run: using: run-task command: > - cd /home/worker/checkouts/gecko/tools/lint/eslint && - /build/tooltool.py fetch -m manifest.tt && + cd /home/worker/checkouts/gecko/ && + /build/tooltool.py fetch -m tools/lint/eslint/manifest.tt && tar xvfz eslint.tar.gz && rm eslint.tar.gz && - ln -s ../eslint-plugin-mozilla node_modules && - cd ../../.. && + ln -s ../tools/lint/eslint/eslint-plugin-mozilla node_modules && + ln -s ../tools/lint/eslint/eslint-plugin-spidermonkey-js node_modules && ./mach lint -l eslint -f treeherder --quiet run-on-projects: - integration @@ -37,6 +37,7 @@ mozlint-eslint: - '**/*eslintrc*' # The plugin implementing custom checks. - 'tools/lint/eslint/eslint-plugin-mozilla/**' + - 'tools/lint/eslint/eslint-plugin-spidermonkey-js/**' # Other misc lint related files. - 'python/mozlint/**' - 'tools/lint/**' diff --git a/tools/lint/eslint.lint b/tools/lint/eslint.lint index 084a2c720374..feaa2c611ce3 100644 --- a/tools/lint/eslint.lint +++ b/tools/lint/eslint.lint @@ -72,7 +72,7 @@ def eslint_setup(): # npm sometimes fails to respect cwd when it is run using check_call so # we manually switch folders here instead. - os.chdir(module_path) + os.chdir(get_project_root()) npm_path = get_node_or_npm_path("npm") if not npm_path: @@ -125,7 +125,7 @@ def call_process(name, cmd, cwd=None): def expected_eslint_modules(): # Read the expected version of ESLint and external modules - expected_modules_path = os.path.join(get_eslint_module_path(), "package.json") + expected_modules_path = os.path.join(get_project_root(), "package.json") with open(expected_modules_path, "r") as f: expected_modules = json.load(f)["dependencies"] @@ -146,7 +146,7 @@ def expected_eslint_modules(): def eslint_module_has_issues(): has_issues = False - node_modules_path = os.path.join(get_eslint_module_path(), "node_modules") + node_modules_path = os.path.join(get_project_root(), "node_modules") for name, version_range in expected_eslint_modules().iteritems(): path = os.path.join(node_modules_path, name, "package.json") @@ -277,7 +277,7 @@ def lint(paths, binary=None, fix=None, setup=None, **lintargs): global project_root project_root = lintargs['root'] - module_path = get_eslint_module_path() + module_path = get_project_root() # eslint requires at least node 6.9.1 node_path = get_node_or_npm_path("node", LooseVersion("6.9.1")) diff --git a/tools/lint/eslint/update b/tools/lint/eslint/update index 47758423644d..4fd308841aa2 100755 --- a/tools/lint/eslint/update +++ b/tools/lint/eslint/update @@ -34,6 +34,8 @@ esac echo "" echo "Removing node_modules and npm_shrinkwrap.json..." +# Move to the top-level directory. +cd ../../../ rm -rf node_modules/ rm npm-shrinkwrap.json @@ -51,19 +53,21 @@ npm shrinkwrap echo "Creating eslint.tar.gz..." tar cvfz eslint.tar.gz node_modules +cd $DIR + echo "Downloading tooltool..." wget https://raw.githubusercontent.com/mozilla/build-tooltool/master/tooltool.py chmod +x tooltool.py echo "Adding eslint.tar.gz to tooltool..." rm manifest.tt -./tooltool.py add --visibility public eslint.tar.gz +./tooltool.py add --visibility public ../../../eslint.tar.gz echo "Uploading eslint.tar.gz to tooltool..." ./tooltool.py upload --authentication-file=~/.tooltool-token --message "node_modules folder update for tools/lint/eslint" echo "Cleaning up..." -rm eslint.tar.gz +rm ../../../eslint.tar.gz rm tooltool.py echo ""