brackets-userland / brackets-eslint

Adds ESLint support to Brackets
MIT License
43 stars 15 forks source link

Enabling Default Rules? #59

Open Gwinert opened 7 years ago

Gwinert commented 7 years ago

Hello, I read through the user-guide, and the read me, and many of the links provided, but I think I need further help activating specific default rules. To turn on rules, all I need to do is create a "eslintrules.json" file in the "C:\Users\%USERNAME%\AppData\Roaming\Brackets\extensions\user\brackets-eslint.eslintrules" Directory? Or do I put these in the ".brackets.json" file in "C:\Users\%USERNAME%\AppData\Roaming\Brackets\extensions\user\brackets-eslint" Directory? If I do make my own file, do I just write the code like this?

{
   "env":{
    "node": 1
}
    "rules": {
        "constructor-super": "error",
        "no-case-declarations": "error",
        "no-class-assign": "error"
      }
}

or do I add these to the .brackets.json like so:

{
  "smartIndent": true,
  "spaceUnits": 2,
  "useTabChar": false,
  "language": {
    "javascript": {
      "linting.prefer": ["ESLint"],
      "linting.usePreferredOnly": true
    }
  }
"env":{
"node": 1
}
"rules": {
        "constructor-super": "error",
        "no-case-declarations": "error",
        "no-class-assign": "error"
      }
}

Let me know, guys! Thank you so much!

zaggino commented 7 years ago

Hi, to configure rules, you need to put normal .eslintrc file into YOUR project, like this one: https://github.com/adobe/brackets/blob/master/.eslintrc.js

See more here: http://eslint.org/docs/user-guide/configuring Or another project here: https://github.com/zaggino/brackets-git

tweakimp commented 7 years ago

I have similar problems understanding how to apply my own rules. With the post above me I can apply my own rules for one project, but how can I make the same configuration for all projects at the same time, globally for brackets?

zaggino commented 7 years ago

@tweakimp It's not a good idea to allow global configuration. First of all, ESLint doesn't support it. Second, if you configure your rules anywhere but the project itself, and upload that project to github (or anywhere else), anyone that would download that project (including you on a different machine) would have no idea what rules are supposed to be used developing that project. That's why you should always use .eslintrc file in your project root.

ghost commented 6 years ago

I dont understand anything about ESlint,some kind of errors are down in brackets but no point on exact line,think maybe this is a bad idea.