Now that we switched to ESLint, that we agreed on what our coding standards should be and now that we can auto-format our JS, there are a few more configuration options we can use to be even stricter.
For reference here is the current config:
{
"env": {
"browser": true
},
"globals": {
"Drupal": true,
"drupalSettings": true,
"domready": true,
"jQuery": true,
"_": true,
"matchMedia": true,
"Backbone": true,
"Modernizr": true,
"CKEDITOR": true
},
"rules": {
"eqeqeq": [2, "smart"],
"guard-for-in": 2,
"no-undef": 2,
//"no-unused-vars": [2, {"vars": "local", "args": "none"}],
"no-unused-vars": 0,
"strict": 2,
"new-cap": 0,
"quotes": 0,
"camelcase": 0,
"no-underscore-dangle": 0,
"no-new": 0,
"no-alert": 0,
"no-use-before-define": 0,
"consistent-return": 0,
"no-constant-condition": 0
}
}
Comments
Comment #1
nod_Comment #2
nod_Proposed config in child issue:
Comment #3
nod_All right, I'm happy enough with the config now. It's strict and cover a lot of our coding standards.
Well done everyone on getting all our JS up to snuff :)
Comment #5
andriyun commentedHow about eslint config for drupal?
What you thinking about this proposition https://www.drupal.org/node/1955232#comment-8936173 ?
Comment #6
nod_It's been decided: https://www.drupal.org/node/1955232