zendesk / eslintrb

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

.eslintrc `plugin` not working #6

Open pkristoff opened 8 years ago

pkristoff commented 8 years ago

I created a local plugin and included it in the .eslintrc file. See below.

When I run Eslintrb.lint(source, :eslintrc) i get

{"ruleId"=>"pattern/return-object-only", "severity"=>2, "message"=>"Definition for rule 'pattern/return-object-only' was not found", "line"=>1, "column"=>1, "nodeType"=>"Program", "source"=>"'use strict';"}

{ "extends": [ "eslint:recommended" ], "plugins": [ "pattern" ], "env": { "browser": true, "node": true }, "globals": { "angular": true, "$": true }, "rules": { "pattern/return-object-only" : 2, "comma-dangle": [ "error", "never" ], "no-console": "off", "no-unused-vars": ["error", { "vars": "all", "args": "none" }], "quote-props": ["error", "as-needed"], "quotes": [ 2, "single", {"avoidEscape": true, "allowTemplateLiterals": true} ], "semi": [ "error", "always" ] } }

ocke commented 8 years ago

I just commented on https://github.com/zendesk/eslintrb/issues/5 about this. The reason is similar. Eslint is a npm package. What it normally would do is require('return-object-ruby').

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

See the first FAQ question at https://github.com/sstephenson/execjs

pkristoff commented 8 years ago

Olaf,

I finally just wrote my own version, which just called eslint directly from ruby and it worked. This assumed Eslint is globally defined which is the recommended way.

Thanks,

Paul

On Jun 21, 2016, at 3:16 AM, Olaf Kwant notifications@github.com wrote:

I just commented on #5 https://github.com/zendesk/eslintrb/issues/5. The reason is similar. 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.

See the first FAQ question at https://github.com/sstephenson/execjs https://github.com/sstephenson/execjs — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zendesk/eslintrb/issues/6#issuecomment-227359568, or mute the thread https://github.com/notifications/unsubscribe/AAIna4APZu5lGfmRe6POWoWDxcXul36Sks5qN4_fgaJpZM4I23Up.