0

I installed SublimeLinter for linting JavaScript in Sublime. It works, but i want to change it's settings so it'll always detect unused variables. I managed to do it by adding // jshint unused:true to top of the .js file itself, but i want to make it default so it'll always work.

I tried adding the setting to the SublimeLinter user settings in SublimeText, but it didn't work:

"user": {
    "debug": false,
    "delay": 0.25,
    "error_color": "D02000",
    "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
    "gutter_theme_excludes": [],
    "lint_mode": "background",
    "linters": {
        "jshint": {
            "@disable": false,
            "args": [],
            "excludes": [],
            "unused": true,  <-------- THIS
            "ignore_match": ["Missing semicolon"]
        }
    },
moonlander
  • 143
  • 2
  • 8
  • Per the [documentation](http://jshint.com/docs/) you can either create a config file called `.jshintrc` in the root directory of your projects, or you can include the settings in your `package.json`. If you want this to be global to _all_ projects, you can create a [`.jshintrc` at the root directory](https://stackoverflow.com/questions/14569785/how-do-you-configure-jshint-options-globally-in-sublime-text-2). – Alexander Nied Feb 21 '18 at 15:12
  • I can't make a file named .jshintrc (under windows), the file must have a file name before the extension. – moonlander Feb 22 '18 at 01:05
  • https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows – Alexander Nied Feb 22 '18 at 17:21

1 Answers1

0

I managed to create the .jshintsrc file under windows thanks to the tip from Alexander Nied. That is: Name the file ".jshintsrc.", windows explorer will drop the last dot when you hit enter. I created the file in C:\ but probably can be put in other paths.

The settings i used for my .jshintsrc file, for NodeJS development:

{
    "undef": true,
    "unused": true,
    "node": true,
    "globals": {
        "MY_GLOBAL": true
    }
}
moonlander
  • 143
  • 2
  • 8