From e6d5cae88be513e1a3fd2888075d9bc1ee56c309 Mon Sep 17 00:00:00 2001 From: Nihanth Subramanya Date: Wed, 13 Oct 2021 21:26:40 +0000 Subject: [PATCH] Bug 1731780 - Reject .only() chained onto add_task in tests. r=Gijs,mythmon,Standard8 Differential Revision: https://phabricator.services.mozilla.com/D128027 --- .../lint/linters/eslint-plugin-mozilla.rst | 1 + .../reject-addtask-only.rst | 6 ++ .../mochitest/chrome/test_tasks_skipall.xhtml | 1 + .../tests/browser/browser_tasks_skipall.js | 2 + .../example/unit/test_tasks_skipall.js | 2 + .../browser/browser_PreferenceExperiments.js | 2 + .../lib/configs/recommended.js | 1 + .../eslint/eslint-plugin-mozilla/lib/index.js | 1 + .../lib/rules/reject-addtask-only.js | 48 ++++++++++++++++ .../tests/reject-addtask-only.js | 56 +++++++++++++++++++ 10 files changed, 120 insertions(+) create mode 100644 docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-addtask-only.rst create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/lib/rules/reject-addtask-only.js create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/tests/reject-addtask-only.js diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla.rst index 924dfbb80887..bf2f209e9c9b 100644 --- a/docs/code-quality/lint/linters/eslint-plugin-mozilla.rst +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla.rst @@ -40,6 +40,7 @@ The plugin implements the following rules: eslint-plugin-mozilla/no-useless-parameters eslint-plugin-mozilla/no-useless-removeEventListener eslint-plugin-mozilla/no-useless-run-test + eslint-plugin-mozilla/reject-addtask-only eslint-plugin-mozilla/reject-chromeutils-import-params eslint-plugin-mozilla/reject-importGlobalProperties eslint-plugin-mozilla/reject-osfile diff --git a/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-addtask-only.rst b/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-addtask-only.rst new file mode 100644 index 000000000000..e540b2441664 --- /dev/null +++ b/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-addtask-only.rst @@ -0,0 +1,6 @@ +reject-addtask-only +=================== + +Designed for JavaScript tests using the add_task pattern. Rejects chaining +.only() to an add_task() call, which is useful for local testing to run a +single task in isolation but is easy to land into the tree by accident. diff --git a/testing/mochitest/chrome/test_tasks_skipall.xhtml b/testing/mochitest/chrome/test_tasks_skipall.xhtml index b0732fd41449..40a2fe1a5867 100644 --- a/testing/mochitest/chrome/test_tasks_skipall.xhtml +++ b/testing/mochitest/chrome/test_tasks_skipall.xhtml @@ -7,6 +7,7 @@