Closed Bug 1369829 Opened 2 years ago Closed 2 years ago

eslint-plugin-mozilla requires .eslintignore, which I didn't expect


(Firefox Build System :: Lint and Formatting, defect)

3 Branch
Not set


(firefox56 fixed)

Tracking Status
firefox56 --- fixed


(Reporter: glind, Assigned: standard8)



(1 file)

`helpers.js:rootDir()` uses the existence of `.eslintignore` to determine the root of a directory.  This seems a little unexpected, for people who are using this package outside m-c.  

Suggested remedy:
- Unclear.  Documentation if nothing else.
- Clearer error message, saying something about `.eslintignore`.

Use case:

- linting system addon build directories
- restartless addons
- re-usable `.jsm` libraries.


Version:      "eslint-plugin-mozilla": "^0.3.2" might have already fixed this.

Can you install eslint-plugin-mozilla from a local copy of mozilla-central, and see if that fixes it?

We've already got various system add-ons & other repositories using eslint-plugin-mozila, though I think they all have .eslintignore at the top level, xref:
That patch fixes a different problem, but still assumes there is an `.eslintignore` somewhere up ONE OF SEVERAL trees.  

I claim the easiest fix is to have the `throw` at  be more descriptive, and mention you need to have an `.eslintignore` somewhere.  

(Side note: i have no idea of why it is needed, but I bet it is for Good Reasons!)

Ok, so I hit this over the weekend. For me, ESLint seems to just say that it can't find the mozilla package. I think we can do two things:

1) Look for package.json as a fallback if we can't find .eslintignore
2) Use the current working directory.

I think that should cover most instances that we'll come across.
Assignee: nobody → standard8
Comment on attachment 8878048 [details]
Bug 1369829 - Make eslint-plugin-mozilla more flexible with finding the root directory of the repository.
Attachment #8878048 - Flags: review?(dtownsend) → review+
Pushed by
Make eslint-plugin-mozilla more flexible with finding the root directory of the repository. r=mossop
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
This feels like a very robust solution!   The code looks very nice!

Any chance we can get a new release to npm?  (Assuming it's on the way, and I am impatient)
Flags: needinfo?(standard8)
Gregg: sorry, I totally forgot to push the new version - thanks for reminding me, 0.3.4 is out now.
Flags: needinfo?(standard8)
Product: Testing → Firefox Build System
Version: Version 3 → 3 Branch
You need to log in before you can comment on or make changes to this bug.