zendesk / eslintrb

Ruby gem for eslint
MIT License
6 stars 6 forks source link

.eslintrc `extends` not working #5

Open pherris opened 8 years ago

pherris commented 8 years ago

Our .eslintrc file "extends": "eslint-config-airbnb", but with this configuration we don't receive the expected errors from our code (no errors are returned). Without this line, some errors are returned but obviously not all errors we expect.

arich commented 8 years ago

I'm having this issue too. Any ideas?

ocke commented 8 years ago

Interesting. The reason is that eslint is a npm package. What it normally would do is require('eslint-config-airbnb'), which you probably have installed using npm.

However, this is some 'standalone' version of eslint running in the ruby environment, which doesn't know about node_modules and all of that.

Correct me if i'm wrong, but I don't think this is going to work.

@sandlerr ? ideas?

pherris commented 8 years ago

Couple of thoughts...

  1. ExecJS says they don't support require - but commonjs.rb does - so theres that... (just saw that you made the same comment on #6)
  2. Executing eslint from ruby and capturing the output (like @pkristoff mentioned in #6) seems like a reasonable approach, but I'd prefer not to have a global eslint installed since (for me) this is running on CI. My pre-commit hook runs the linter with npm, so it makes sense that this plugin would execute the same command.
  3. I did play (unsuccessfully) with the --print-config option for eslint to see if I could fully hydrate the .eslintrc file. If all the configuration was fully generated before running this process (it's just a JSON object at the end of the day) this library would probably work as expected.