Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

__dirname should not cause error when using node env #46

Closed
OliverJAsh opened this issue Jul 13, 2016 · 5 comments
Closed

__dirname should not cause error when using node env #46

OliverJAsh opened this issue Jul 13, 2016 · 5 comments
Labels

Comments

@OliverJAsh
Copy link

OliverJAsh commented Jul 13, 2016

Hi, thanks for your amazing work. I have some feedback but I am very aware this project is still in the very early stages.

Versions:

$ npm ls eslint typescript-eslint-parser
/Users/OliverJAsh/Development/samefourchords.com
├── [email protected]
└── [email protected]

ESLint config:

{
    "extends": "eslint:recommended",
    "parser": "typescript-eslint-parser",
    "env": {
        "node": true
    }
}

Input and output:

$ echo "console.log(__dirname)" > test.js
$ eslint test.js

/Users/OliverJAsh/Development/samefourchords.com/test.js
  1:1   error  Unexpected console statement  no-console
  1:13  error  '___dirname' is not defined   no-undef

Since I set the node env to true, I do not expect __dirname to cause an error.

@nzakas
Copy link
Member

nzakas commented Jul 16, 2016

Sorry, same response as here: #47 (comment)

@nzakas nzakas closed this as completed Jul 16, 2016
@jbcpollak
Copy link

jbcpollak commented Feb 17, 2017

Hi @nzakas - Its been quite a few months, has any progress been made about this? I read the comment you link to, but I don't understand quite how that issue relates to this one.

Is there a work around? Should we just do // eslint-disable-line for now?

Also, what I don't quite understand is I am seeing the error in a .js file, not a .ts one.

@soda0289
Copy link
Member

@jbcpollak The error with node globals such as __filename and __dirname has been fixed in master. Check the issue #145 for more details.

When you enable a parser in eslint it will parse all files passed into it, this includes javascript and typescript files.

If you still have problems with the master branch you can open a new issue and we can look into.

@jbcpollak
Copy link

@soda0289 thanks - should I used a Git URL for the dependency or is it published to npm? Thanks!

@soda0289
Copy link
Member

@jbcpollak We have one pull request, that fixes some JSX issues, that is waiting on a review. As soon as it is merged there will be a new release. Should not take too long but if you want to try out master today use the git url.

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

No branches or pull requests

5 participants