I have just landed a change to how we handle the configuration of test directories for ESLint.

The big change is that all test directories which need manual ESLint configuration assignment are now listed in the top-level file .eslintrc-test-paths.js <https://searchfox.org/mozilla-central/source/.eslintrc-test-paths.js>. Previously, these would need individual .eslintrc.js files within the test directories.

The documentation on source docs has been updated <https://firefox-source-docs.mozilla.org/code-quality/lint/linters/eslint.html#i-m-adding-tests-how-do-i-set-up-the-right-configuration>.

Please note:

 * When adding new test directories, please try and conform to one of
   the formats listed at the start of .eslintrc-test-paths.js
   
<https://searchfox.org/mozilla-central/rev/14781effaa15c12b1652beb75f021489567bad8f/.eslintrc-test-paths.js#27-45>
     o This will mean you do not need to add your directory to
       .eslintrc-test-paths.js.
 * Do not add new cases where there are test directories with multiple
   types of tests in the same directory.
     o ESLint will now throw a failure in this case.
     o We do this because ESLint cannot easily handle multiple test
       types in one directory, and attempting to do so may cause rules
       to be applied to incorrect test types, as well as
       false-positives for availability of globals.

We've made this change because the previous way causes issues when rolling out new rules for tests. If the test configuration enables a new rule, but we want to disable it for some test directories (e.g. incremental roll-out), the fact the test configuration was applied in the sub-directory would override turning off the rule in the top-level .eslintrc.js file.

It also starts to move us in the direction of a single-top level configuration, which ESLint is currently heading towards <https://eslint.org/blog/2022/08/new-config-system-part-1/>.

I have considered having this list automatically generated from the build system/.ini files - maybe as part of running ESlint. However, that would potentially introduce an expensive build step, as well as being difficult for editors to handle. We might be able to do something to update the file in-place, but for now this is an intermediate step that would make it easier to do in future.

Mark

--
You received this message because you are subscribed to the Google Groups 
"[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/de588189-6da1-e6ef-2582-7e0ed27cbf9a%40mozilla.com.

Reply via email to