angelozerr / tern-eslint

Tern Plugin to validate JS files with ESLint
https://github.com/eslint/eslint
MIT License
10 stars 6 forks source link

eslint.json seems not to be taken into account #9

Closed ptitgraig closed 8 years ago

ptitgraig commented 9 years ago

Hello Angelo !

I'm using Eslint in my projects. I activated the tern module through Tern IDE. Then i set the Validation of my project with eslint and choose a local eslint.json file.

It seems that the plugin is working partially as i don't get the error messages I should.

For example, i'haven't set anything in rules for "double quote", and the plugin returns errors for "double quotes".

Somes screenshots attached. I'm using Eclipse Kepler.

ternide_eslint_json_issue

Content of eslint.json:

{
  "rules": {

    // Blocking rules provoke errors
    // -----------------------------
    "no-eval": 2,
    "no-multi-str": 2,
    "no-debugger": 2,
    "comma-dangle": 2,
    "no-bitwise": 2,

    // Critical rules provoke errors
    // -----------------------------
    "no-octal": 2,
    "no-new": 2,
    "no-loop-func": 2,
    "eqeqeq": 2,
    "no-with": 2,
    "guard-for-in": 2,
    "no-new-wrappers": 2,
    "no-array-constructor": 2,
    "no-extend-native":2,
    "no-undef": 2,
    "strict": 2,
    "no-iterator": 2,
    "no-sparse-arrays": 2,
    "no-obj-calls": 2,
    "use-isnan": 2,
    "no-implied-eval": 2,
    "no-delete-var": 2,

    // Major rules provoke warnings
    // ----------------------------
    "no-sequences": 1,
    "no-dupe-keys": 1,
    "no-unused-vars": 1,
    "no-use-before-define": [1, "nofunc"],
    "curly": 1,
    "semi": 1,
    "no-unreachable": 1,
    "no-fallthrough": 1,
    "no-new-object": 1,
    "wrap-iife": [1, "inside"],
    "new-cap": 1,
    "valid-typeof": 1,
    "no-undef": 1,
    "no-unused-expressions": 1,
    "no-proto": 1,
    "no-ex-assign": 1,
    "no-extra-semi": 1,
    "no-self-compare": 1,
    "radix": 1,
    "no-shadow-restricted-names": 1,
    "no-undef-init": 1,
    "no-undefined": 1
  },
  "env": {
    "browser": true,
    "jquery": true
  },
  "globals": {
    "angular": true,
    "toastr": true
  }
}

What I get in the IDE:

ternide_eslint_json_issue2

angelozerr commented 9 years ago

@ptitgraig to be honnest with you, I'm not a big expert with ESLint. I have defined a default config which defines double quotes https://github.com/angelozerr/tern-eslint/blob/master/eslint.js#L175 and if you define an eslint.json, it merges the defaultr rule with custom rules. If you think it's not a bad idea, please provide a PR.Thanks!

ptitgraig commented 9 years ago

Thanks for your feedback. I'll consider making a PR when i get time.

angelozerr commented 8 years ago

@ptitgraig it's the same issue than https://github.com/angelozerr/tern.java/issues/369 please reinstall tern.java to check if it works now. Thanks.

ptitgraig commented 8 years ago

Thanks @angelozerr i try that and let you noticed.

angelozerr commented 8 years ago

@ptitgraig is it ok for you?

zboro commented 8 years ago

Your fix seems to work, but it is not included in version published in Eclipse marketplace. I had to manually replace eslint.js with latest version from git.

angelozerr commented 8 years ago

@zboro yes it's normal, this fix is for tern.java 1.2.0-SNAPSHOT (not released). You can install it for the moment only with update site https://github.com/angelozerr/tern.java/wiki/Installation-Update-Site