AtomLinter / linter-eslint

ESLint plugin for Atom Linter
https://atom.io/packages/linter-eslint
584 stars 141 forks source link

.conf/eslint/eslintrc.js ignored after update #1418

Closed db-developer closed 3 years ago

db-developer commented 3 years ago

Question

Issue Description (before update)

A project which has no .eslintrc file in its root folder used to eslint perfectly with having set:

Issue Description (after update)

Just did an update to 8.6.2. and got the following after restart: "eslint parsing error: the keyword 'const' is reserved"

WTF? Obviously the file .conf/eslint/eslintrc.js is not considered any more. Bug or Feature?

If Feature, then how do I make linter-eslint use .conf/eslint/eslintrc.js? Adding .conf/eslint/ to "Uncommon/ESLint Rules Directories" does not change a thing And no, I don't want another ".something" file polluting the projects root directory. :-)

Thanx 4 replies.

UziTech commented 3 years ago

probably from #1068 @aminya maybe this should have been a major version bump?

Have you tried adding it to the setting Global ESLint -> .eslintrc Path

image

db-developer commented 3 years ago

Yes, this is exactly what I tried to describe above. Looks like it was misleading. sorry. So here is a screenshot of what does NOT work.

image

db-developer commented 3 years ago

This is what I tried next. It did NOT work as well.

image

db-developer commented 3 years ago

Just for the records: I'm running atom on windows ...

UziTech commented 3 years ago

I think .eslintrc Path needs to be an absolute path.

db-developer commented 3 years ago

Hopefully not. At least for the previous version '.conf/eslint/.eslitrc.js' seemed to resolve as '${current_project_directory}/.conf/eslint/.eslitrc.js' which worked like charm.

UziTech commented 3 years ago

Does it work when you use an absolute path?

db-developer commented 3 years ago

Okay. Sorry for being unspecific. I just tried the path that always worked. Just did some tests and found, neither of these work:

C:\projects\myproject.conf\eslint.eslitrc.js C:\\projects\\myproject\\.conf\\eslint\\.eslitrc.js C:/projects/myproject/.conf/eslint/.eslitrc.js \.conf\eslint\.eslitrc.js \\.conf\\eslint\\.eslitrc.js /.conf/eslint/.eslitrc.js .conf\\eslint\\.eslintrc.js .conf\eslint\.eslintrc.js .conf/eslint/.eslintrc.js


This works: C:\\.eslintrc.js C:\.eslintrc.js C:/.eslintrc.js


This does not work: C:\\tests\\.eslintrc.js C:\tests\.eslintrc.js C:/tests/.eslintrc.js

Windows issue? ... out of fun :-)

I did test this with D:\\.eslintrc.js (works) D:\\fun\\.eslintrc.js (does not work)

So I would say as soon as there are directories, it fails.

db-developer commented 3 years ago

linter-eslint version 8.6.2 Did I go wrong somewhere? Can anyone confirm the issue?

UziTech commented 3 years ago

I just tested it on Windows 10 atom v1.56.0-beta0 and it worked with an absolute path and a relative path (.config\eslint\.eslintrc.json) in the project

db-developer commented 3 years ago

Windows 10 pro, atom v1.55.0 x64 on a Hyper-V VM Clean uninstall (removed .atom and directories in AppData/Roaming and AppData/Local + Tmp) Fresh install with latest download: v1.55.0 x64 Installed linter, ... and finally linter-eslint

Problem persists.

aminya commented 3 years ago

Does Eslint CLI find your eslintrc? In the new version, we no longer implement our own interpretation of finding the config file. If Eslint's CLI is able to find it, then it will work for linter-eslint as well.

https://github.com/AtomLinter/linter-eslint/blob/a9e60cafc3cf3e9f02cb35dce2ce3fb7b27b3483/src/worker-helpers.js#L129

UziTech commented 3 years ago

@aminya are you able to reproduce this?

aminya commented 3 years ago

Mentioning the eslintrc path works without issues:

image

Without mentioning the eslint path in the config:

image

And even our fallback can't find this path. This is an unconventional path for eslintrc.

image

UziTech commented 3 years ago

@db-developer did this used to work without setting .eslintrc Path?

UziTech commented 3 years ago

Or are you able to get it to work by installing an older version?

db-developer commented 3 years ago

@aminya In the past, I always had to do these two changes to the settings to make the config work:

image

Edit: Disable is checked by default ... so it had to be unchecked to work

Note: Usually it was ignored, if (forked) projects came along with .eslintrc files in the project root. This was a comfortable setting, because it offered me to

db-developer commented 3 years ago

If it is possible, I'd like to revert to an earlier version, but I don't know how (yet)... Up to now I have always been using what I got and never did any atom hacking... (Sidenote: Just clicking buttons and setting values to UI fields ... like any ignorant windows user, ya' know? 😃 )

db-developer commented 3 years ago

Yesssss! Back to 8.5.5 (2019-04-22) things are back and working like I think they should 😄

db-developer commented 3 years ago

Okay ... like expected ... 8.6.0 comes with the "breaking" changes. (although from reading @aminya I already expected this, when looking up the changenotes) I updated version by version to 8.6.0 so I'm pretty sure it introduces the problems I ran in.

A personal perspective about eslint configuration: Primary it offers ways of configurations, which are bound closely to a project.

Each of the above usually results in git changes. So (for third party projects) one has to tell git to ignore changes in a file. Later, when running in trouble after a pull, one hopefully remembers about that git change ... As of this, atoms linter-eslint helped a lot, because it enabled me introducing the eslinter style I required and I was able to do it in a very individual place like .myconf/ which I could add to all my (own and forked) projects and which could be hidden from git by default. By doing so, I can be sure, my additions would never interfere with existing or future project files, which might come along with a git pull.

It's a feature I heavily use on about a hundred projects. So it would be a pain, if it ran out of support 😢 Instead, I was always hoping for an additional checkbox, like: "ignore all default eslintconfig files and paths, just use the one specified" 😄 Which would switch my ./conf/eslintrc from "fallback" to "default".

I m no native english speaker, but I hope I could explain my usage of eslinter

UziTech commented 3 years ago

The strange thing is that v8.6.0 doesn't change how the .eslintrc Path setting works. And v8.6.2 works for me with those settings.

The changes in v8.6.0 only affect how the .eslintrc is found automatically, which doesn't apply in this case since you are explicitly setting it.

The only thing I can think of is that the new way we search for .eslintrc is finding one in a folder above the project folder or maybe in your home directory, so it is never using the .eslintrc Path setting.

UziTech commented 3 years ago

Can you try these steps to try to debug it on your system:

  1. Install linter-eslint v8.6.2
  2. Open ~\.atom\packages\linter-eslint\src\worker-helpers.js in an editor
  3. Add the following code to line 196:
    console.log("eslint paths:", fileConfig, cleanPath(config.global.eslintrcPath));
  4. Restart Atom
  5. Open the console Ctrl + Shift + I
  6. Go to a js file to start linting
  7. Check the console for eslint paths:
db-developer commented 3 years ago

Okay...

Is there a logfile, which logs the eslintrc which is used? A flag to turn on logging...?

Ah! You already answered while I was typing :)

db-developer commented 3 years ago

Version 8.6.2

image

db-developer commented 3 years ago

Version 8.5.9

image

UziTech commented 3 years ago

What version of eslint are you using?

db-developer commented 3 years ago

Within the project I'm using grunt-eslint which places an eslint "version": "7.22.0" into the projects node_modules. But I doubt, this is what you meant.

I did not install a global eslint. All I use is a clean Atom install ... apm list returns the following:

Built-in Atom Packages (93) ├── atom-dark-syntax@0.29.1 ├── atom-dark-ui@0.53.3 ├── atom-light-syntax@0.29.1 ├── atom-light-ui@0.46.3 ├── base16-tomorrow-dark-theme@1.6.0 ├── base16-tomorrow-light-theme@1.6.0 ├── one-dark-ui@1.12.5 ├── one-light-ui@1.12.5 ├── one-dark-syntax@1.8.4 ├── one-light-syntax@1.8.4 ├── solarized-dark-syntax@1.3.0 ├── solarized-light-syntax@1.3.0 ├── about@1.9.1 ├── archive-view@0.65.2 ├── autocomplete-atom-api@0.10.7 ├── autocomplete-css@0.17.5 ├── autocomplete-html@0.8.8 ├── autocomplete-plus@2.42.3 ├── autocomplete-snippets@1.12.1 ├── autoflow@0.29.4 ├── autosave@0.24.6 ├── background-tips@0.28.0 ├── bookmarks@0.46.0 ├── bracket-matcher@0.91.2 ├── command-palette@0.43.5 ├── dalek@0.2.2 ├── deprecation-cop@0.56.9 ├── dev-live-reload@0.48.1 ├── encoding-selector@0.23.9 ├── exception-reporting@0.43.1 ├── find-and-replace@0.219.7 ├── fuzzy-finder@1.14.3 ├── github@0.36.7 ├── git-diff@1.3.9 ├── go-to-line@0.33.0 ├── grammar-selector@0.50.1 ├── image-view@0.64.0 ├── incompatible-packages@0.27.3 ├── keybinding-resolver@0.39.0 ├── line-ending-selector@0.7.7 ├── link@0.31.6 ├── markdown-preview@0.160.2 ├── metrics@1.8.1 ├── notifications@0.71.0 ├── open-on-github@1.3.2 ├── package-generator@1.3.0 ├── settings-view@0.261.6 ├── snippets@1.5.1 ├── spell-check@0.76.2 ├── status-bar@1.8.17 ├── styleguide@0.49.12 ├── symbols-view@0.118.4 ├── tabs@0.110.0 ├── timecop@0.36.2 ├── tree-view@0.228.2 ├── update-package-dependencies@0.13.1 ├── welcome@0.36.9 ├── whitespace@0.37.7 ├── wrap-guide@0.41.0 ├── language-c@0.60.19 ├── language-clojure@0.22.8 ├── language-coffee-script@0.50.0 ├── language-csharp@1.1.0 ├── language-css@0.44.4 ├── language-gfm@0.90.8 ├── language-git@0.19.1 ├── language-go@0.47.2 ├── language-html@0.53.1 ├── language-hyperlink@0.17.1 ├── language-java@0.32.0 ├── language-javascript@0.134.1 ├── language-json@1.0.5 ├── language-less@0.34.3 ├── language-make@0.23.0 ├── language-mustache@0.14.5 ├── language-objective-c@0.16.0 ├── language-perl@0.38.1 ├── language-php@0.44.7 ├── language-property-list@0.9.1 ├── language-python@0.53.5 ├── language-ruby@0.72.23 ├── language-ruby-on-rails@0.25.3 ├── language-rust-bundled@0.1.0 ├── language-sass@0.62.1 ├── language-shellscript@0.28.2 ├── language-source@0.9.0 ├── language-sql@0.25.10 ├── language-text@0.7.4 ├── language-todo@0.29.4 ├── language-toml@0.20.0 ├── language-typescript@0.6.3 ├── language-xml@0.35.3 └── language-yaml@0.32.0

Community Packages (10) C:\Users....atom\packages ├── busy-signal@2.0.1 ├── highlight-selected@0.17.0 ├── intentions@1.1.5 ├── linter@3.3.0 ├── linter-eslint@8.6.2 ├── linter-ui-default@3.3.0 ├── permanent-delete@0.1.8 ├── project-viewer@1.4.0 ├── termination@0.7.6 └── todo-show@2.3.2

Did this help? If not, what should I check?

UziTech commented 3 years ago

It looks like in your version v8.5.9 it doesn't set the configFile option so how does eslint know which config file to read?

Just curious can you log the options for v8.6.2 if you don't set the .eslintrc Path setting?

Or can you hard code the config options in v8.6.2 to the same options as v8.5.9 and see if it works?

db-developer commented 3 years ago

Version 8.6.2

image image

UziTech commented 3 years ago

Does eslint-linter work with v8.6.2 like that?

Whatever eslint version you are using shouldn't change between v8.5.9 and v8.6.2 so the only thing that changes is the options, and those options look very similar to the v8.5.9 options above.

db-developer commented 3 years ago

Sure. There is always a linting. As far as I understand it, it's the "linter 3.3.0" package.

It is a linter-eslint dependency

image

Linting stops if this package is not installed. If the package is installed, it uses a default setting which I cant change. This is why I installed linter-eslint v. 8.5.9. It managed to read a configuration file from a path set by the UI ... which is relative to the current project. This is where v. 8.6.2 fails ... it does not consider the relative config path.

UziTech commented 3 years ago

The linter package only has to do with how linting errors are displayed it doesn't do anything with the config file

db-developer commented 3 years ago

Version 8.6.2

image Maybe this helps you to find the source/cause of this wrong path?

Version 8.5.9

image

This is displayed in linter-eslint helpers.js

UziTech commented 3 years ago

Did you add the .conf/eslintrc/.eslintrc.js file to the linter-eslint folder? Can you share that file?

db-developer commented 3 years ago

No. I did not do that ... but whatever you enter here image

will produce this: image

aminya commented 3 years ago

You should use an absolute path if you want your config to work in all the projects.

UziTech commented 3 years ago

Ya so it is working like it is supposed to. It is looking for that file but not finding it and showing you an error.

aminya commented 3 years ago

I'm going to close this as it is working as intended.