PSA: .eslintrc.js files are no longer needed in test directories (in most cases)

Mark Banner mbanner at mozilla.com
Thu Mar 28 10:19:06 UTC 2019


tl;dr I've just landed bug 1415265 
<https://bugzilla.mozilla.org/show_bug.cgi?id=1415265> which means you 
no longer need .eslintrc.js files extending the configuration in 
commonly-named directories.

Since early in the ESLint days, we've needed extra configuration files 
in our test directories to ensure that we have the right environment and 
rules set up for them.

This is no more! Following a hint 
<https://github.com/eslint/eslint/issues/8813#issuecomment-456034732> on 
the ESLint issue that was preventing this, we've been able to work 
around the issue, and removed about 200 of the .eslintrc.js files.

If your test directory is named matching one of regexps below, then the 
configuration will be automatically applied:

  * xpcshell:
      o **/test*/unit*/
      o **/test*/xpcshell/
  * Browser-chrome mochitest:
      o **/test*/**/browser/
  * Chrome mochitest:
      o **/test*/chrome/
  * Plain mochitest:
      o **/test*/mochitest/

These can be found in the top-level .eslintrc.js file.

I've commented on revisions already in Phabricator where I know they are 
now adding files unnecessarily. I'll keep an eye out for any more.

For the next steps, I'm planning on making more of our directories 
conform to this format where it makes sense. A lot of the remaining 
cases either have no named subdirectory (e.g. just test/) or are sharing 
multiple test types in one directory (this latter case makes it very 
hard to get the ESLint configuration right).

Mark

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/firefox-dev/attachments/20190328/eeaa5f33/attachment.html>


More information about the firefox-dev mailing list