Closed Bug 1369829 Opened 2 years ago Closed 2 years ago
eslint-plugin-mozilla requires .eslintignore, which I didn't expect
Bug 1369829 - Make eslint-plugin-mozilla more flexible with finding the root directory of the repository.
59 bytes, text/x-review-board-request
`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. Thanks! GL
Version: "eslint-plugin-mozilla": "^0.3.2"
https://hg.mozilla.org/mozilla-central/rev/2be1833d89d2 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: https://github.com/mozilla/one-off-system-add-ons/ https://github.com/mozilla/example-addon-repo/
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 https://hg.mozilla.org/mozilla-central/rev/2be1833d89d2#l1.42 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!) GL
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. https://reviewboard.mozilla.org/r/149468/#review154156
Attachment #8878048 - Flags: review?(dtownsend) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/2a03a91b03e8 Make eslint-plugin-mozilla more flexible with finding the root directory of the repository. r=mossop
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)
Gregg: sorry, I totally forgot to push the new version - thanks for reminding me, 0.3.4 is out now.
You need to log in before you can comment on or make changes to this bug.