AtomLinter / linter-eslint-node

ESLint plugin for Atom/Pulsar Linter (v8 and above)
https://web.pulsar-edit.dev/packages/linter-eslint-node
MIT License
4 stars 3 forks source link

Restore option to specify global .eslintrc path #23

Open zhaolinlau opened 2 years ago

zhaolinlau commented 2 years ago

Issue Type

Question

Issue Description

May I know how to set the path of .eslintrc like linter-eslint package? Because I need to lint javascript in html & php files, and I did install the eslint-plugin-html in linter-eslint-node directory and added eslint-plugin-html to .eslintrc in that directory too. However, the linter says no eslint configuration found. Besides, linter-eslint package is just work fine with that.

Linter Eslint Node: ![image](https://user-images.githubusercontent.com/68846168/164946944-752c4614-acb0-411e-aa00-62a3231c516a.png)
savetheclocktower commented 2 years ago

Thanks for reporting this. We removed the Lint HTML files setting because all it did was add a scope to the List of scopes to run ESLint on list above, so I felt it was redundant. But I didn't do extensive testing to make sure this still worked.

Luckily, I just attempted an experiment, and it does work. Here's what I did:

I can think of three things that might be happening for you:

  1. You didn't add text.html.basic or text.html.php as described above. (The settings instruct you to add source.js.embedded.html, but that will only work when the cursor is inside that scope when you save or invoke the Lint command, and that's likely not what you want. I will change those instructions.)
  2. Your .eslintrc exists in a directory above your project root. This is unlikely, but it is another difference between this package and linter-eslint: starting from the file that you're linting, both packages traverse upwards and use the first .eslintrc they find, but linter-eslint-node will only go as far as the project root, whereas linter-eslint will keep going to the root of the volume if need be. One way to test this would be to lint a JavaScript file in your project; if it gets linted, then linter-eslint-node can find your .eslintrc.
  3. Just to be clear, eslint-plugin-html needs to be installed either locally (in your project) or globally, not “in linter-eslint-node directory” as you state, but I think this was just an ambiguous phrasing.

If you try all this and still can't get it working, please run the Linter Eslint Node: Debug command and paste the output, and also include the contents of your .eslintrc.

savetheclocktower commented 2 years ago

Sorry, I didn't read closely enough. You say that it gives you a “No ESLint configuration found” error message, so it's most likely item 2 in my list. I'm guessing that you'd get that error in all cases, not just for HTML files.

zhaolinlau commented 2 years ago

Yes, installing eslint-plugin-html and adding .eslintrc in project root actually it's just work fine. But to be more convenient to lint projects, I'm here to request to add .eslintrc path configuration like linter-eslint package so that we don't need to setup eslint everytime. And it's just my request also as my suggestion, not forcing you guys to add it because I understand you guys have your own opinion on it too. That's all from me.

savetheclocktower commented 2 years ago

Ah, I see. I'll keep this open as a feature request; if other people ask for it, we can see about adding it back in. Thanks!