Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

linter-eslint not working within atom #1163

Closed
3 tasks done
tremendus opened this issue Aug 18, 2018 · 9 comments
Closed
3 tasks done

linter-eslint not working within atom #1163

tremendus opened this issue Aug 18, 2018 · 9 comments

Comments

@tremendus
Copy link

Issue Type

Bug/Question

Issue Description

In Atom, linter installed, with three lints:
json
yaml
eslint

json and yaml lint correctly, eslint shows no errors in js file even when syntax errors exist and eslint from command line correctly identifies error and the file scope is javascript:

  22 |   }
  23 |> 24 |   if (x) [] {{     |             ^
  25 |
  26 |   // then initialize
  27 |   state.route = to.fullPath

Bug Checklist

  • Restart Atom
  • Verify the eslint CLI gives the proper result, while linter-eslint does not
  • Paste the output of the Linter Eslint: Debug command from the Command Palette below
Linter Eslint: Debug

Atom version: 1.29.0
linter-eslint version: 8.4.1
ESLint version: 5.4.0
Hours since last Atom restart: 0.3
Platform: darwin
Using global ESLint from: /Users/tremendus/.nvm/versions/node/v8.11.1/lib/node_modules/eslint
Current file's scopes: [
  "javascript",
  "program",
  "expression_statement",
  "function",
  "statement_block",
  "if_statement",
  "statement_block"
]
linter-eslint configuration: {
  "eslintrcPath": "~/.eslintrc.yml",
  "fixOnSave": true,
  "ignoreFixableRulesWhileTyping": true,
  "lintHtmlFiles": true,
  "rulesToSilenceWhileTyping": [
    "no-trailing-spaces eol-last"
  ],
  "useGlobalEslint": true,
  "showRuleIdInMessage": true,
  "disableWhenNoEslintConfig": true,
  "globalNodePath": "",
  "advancedLocalNodeModules": "",
  "eslintRulesDirs": [],
  "disableEslintIgnore": false,
  "disableFSCache": false,
  "scopes": [
    "source.js",
    "source.jsx",
    "source.js.jsx",
    "source.babel",
    "source.js-semantic"
  ],
  "rulesToDisableWhileFixing": []
}

The project structure has two 'folders', both git repos, both with their own .eslintrc/.estlinrc.js files, and there is a fallback ~/.estlintrc.yml also.

Debug: Linter
Platform: darwin
Atom Version: 1.29.0
Linter Version: 2.2.0
Opened file is ignored: No
Matching Linter Providers: 
Disabled Linter Providers: 
  - Unknown
  - sass-lint
  - json-lint
  - scss-lint
Standard Linter Providers: 
  - ESLint
  - Js-YAML
  - JSON Lint
  - json-lint
  - sass-lint
  - scss-lint
  - Unknown
Indie Linter Providers: 
UI Providers: 
  - Linter
Ignore Glob: **/*.min.{js,css}
VCS Ignored Paths are excluded: true
Current File Scopes: 
  - *
  - javascript
  - program
  - expression_statement
  - function
  - statement_block

Screenshot :
screen shot 2018-08-17 at 6 19 43 pm

I've tried everything to get this to work! I'm stumped, including resorting to local eslint and plugins (didn't make a difference, still no linting) ....

Appreciate any help anyone can offer! Thanks.

(Interestingly enough, on Mac in Safari, linting is shown as typo, we need to get this added to the Oxford dictionary ;)

@skylize
Copy link
Contributor

skylize commented Aug 18, 2018

When using the experimental Tree Sitter Parser, you need to add javascript to the list of scopes.

@tremendus
Copy link
Author

Thanks for the reply. That's configured as part of the linter or the tree sitter? I wasn't able to find any docs on how to do that. Is there a guide or link to that?

@skylize
Copy link
Contributor

skylize commented Aug 20, 2018

The Tree Sitter parser is a new experimental feature of Atom, which I can tell you have activated based on the Debug Log.

The current release of linter-eslint technically does not support Tree Sitter out of the box. A patch is already in place for future releases.

All you need to do to work around it for now is open the Package Settings for linter-eslint in Atom and find the list of scopes to lint. Add javascript to that list and you should be good to go.

@tremendus
Copy link
Author

Yes, I understand it's experimental, I thought it was more 'beta'.

I added the javascript scope as suggested and sure enough it does lint, but then the syntax colouring changes (to something I struggle to understand - a property of an object may be either one of two colors, for reasons I cannot differentiate) and I lose my ability to use snippets.

Disabling until ready for production, thank you for your help.

@skylize
Copy link
Contributor

skylize commented Aug 20, 2018

We have nothing to do with syntax highlighting here. 😉

@EvHaus
Copy link

EvHaus commented Oct 31, 2018

In case others run into the same issue, for me, I had to add source.flow to the end of the scopes setting to get linter-eslint to work again since I'm using Flow Javascript.

@IanVS
Copy link
Member

IanVS commented Nov 1, 2018

@EvHaus, do you happen to be using nuclide or atom-ide-ui? I myself use nuclide, and hit this bug as well, causing me to open facebookarchive/nuclide#1630, which unfortunately hasn't gotten any attention so far.

The long and short of it is, you technically shouldn't have to add source.flow to your scopes, but due to bugs in other packages you might need to do so as a workaround.

@EvHaus
Copy link

EvHaus commented Nov 1, 2018

Nope. I'm using Atom straight up. v1.32.1 on Windows 10.

@IanVS
Copy link
Member

IanVS commented Nov 1, 2018

If you could share the scopes in the file you were attempting to lint but which was failing (Editor: Log cursor scope in the command palette), as well as the results of Linter Eslint: debug, that would be really helpful. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants