2018-02-22 14:25:26 -05:00
|
|
|
{
|
2018-10-30 06:03:05 -04:00
|
|
|
"extends": [
|
|
|
|
"standard",
|
2019-08-13 08:35:32 -04:00
|
|
|
"standard-jsx",
|
2018-10-30 06:03:05 -04:00
|
|
|
"standard-react",
|
2018-11-05 05:06:39 -05:00
|
|
|
"prettier",
|
|
|
|
"prettier/react",
|
|
|
|
"prettier/standard",
|
2018-10-30 06:03:05 -04:00
|
|
|
"plugin:jsx-a11y/recommended"
|
|
|
|
],
|
2018-02-28 06:45:30 -05:00
|
|
|
"plugins": [
|
2018-10-30 06:03:05 -04:00
|
|
|
"jsx-a11y",
|
|
|
|
"mocha",
|
2018-02-28 06:45:30 -05:00
|
|
|
"chai-expect",
|
|
|
|
"chai-friendly"
|
|
|
|
],
|
2019-08-19 11:17:13 -04:00
|
|
|
"parser": "babel-eslint",
|
2018-02-27 06:19:40 -05:00
|
|
|
"env": {
|
2019-03-07 10:29:59 -05:00
|
|
|
"browser": true,
|
2018-02-27 06:19:40 -05:00
|
|
|
"mocha": true
|
|
|
|
},
|
2018-10-30 06:03:05 -04:00
|
|
|
"settings": {
|
2019-01-17 04:52:07 -05:00
|
|
|
// Tell eslint-plugin-react to detect which version of React we are using
|
2018-10-30 06:03:05 -04:00
|
|
|
"react": {
|
2019-01-17 04:52:07 -05:00
|
|
|
"version": "detect"
|
2018-10-30 06:03:05 -04:00
|
|
|
}
|
|
|
|
},
|
2018-02-28 06:45:30 -05:00
|
|
|
"rules": {
|
2018-11-05 05:06:39 -05:00
|
|
|
// Fix conflict between prettier & standard by overriding to prefer
|
|
|
|
// double quotes
|
|
|
|
"jsx-quotes": ["error", "prefer-double"],
|
|
|
|
|
2018-10-30 06:03:05 -04:00
|
|
|
// Override weird behaviour of jsx-a11y label-has-for (says labels must be
|
|
|
|
// nested *and* have for/id attributes)
|
|
|
|
"jsx-a11y/label-has-for": [
|
|
|
|
"error",
|
|
|
|
{
|
|
|
|
"required": {
|
|
|
|
"some": [
|
|
|
|
"nesting",
|
|
|
|
"id"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
|
2018-02-28 06:45:30 -05:00
|
|
|
// Swap the no-unused-expressions rule with a more chai-friendly one
|
|
|
|
"no-unused-expressions": 0,
|
|
|
|
"chai-friendly/no-unused-expressions": "error"
|
2019-08-07 10:04:04 -04:00
|
|
|
},
|
|
|
|
"overrides": [
|
|
|
|
{
|
2019-10-14 09:17:30 -04:00
|
|
|
// Test specific rules
|
2019-08-07 10:04:04 -04:00
|
|
|
"files": ["**/test/*/src/**/*.js"],
|
2019-10-14 09:17:30 -04:00
|
|
|
"globals": {
|
|
|
|
"expect": true
|
|
|
|
},
|
2019-08-07 10:04:04 -04:00
|
|
|
"rules": {
|
|
|
|
// mocha-specific rules
|
|
|
|
"mocha/handle-done-callback": "error",
|
|
|
|
"mocha/no-exclusive-tests": "error",
|
|
|
|
"mocha/no-global-tests": "error",
|
|
|
|
"mocha/no-identical-title": "error",
|
|
|
|
"mocha/no-nested-tests": "error",
|
|
|
|
"mocha/no-pending-tests": "error",
|
|
|
|
"mocha/no-skipped-tests": "error",
|
|
|
|
"mocha/no-mocha-arrows": "error",
|
|
|
|
|
|
|
|
// chai-specific rules
|
|
|
|
"chai-expect/missing-assertion": "error",
|
|
|
|
"chai-expect/terminating-properties": "error",
|
|
|
|
|
|
|
|
// prefer-arrow-callback applies to all callbacks, not just ones in mocha tests.
|
|
|
|
// we don't enforce this at the top-level - just in tests to manage `this` scope
|
|
|
|
// based on mocha's context mechanism
|
|
|
|
"mocha/prefer-arrow-callback": "error"
|
|
|
|
}
|
2019-08-09 05:39:26 -04:00
|
|
|
},
|
|
|
|
{
|
2019-10-14 09:17:30 -04:00
|
|
|
// Frontend test specific rules
|
2019-11-05 09:00:13 -05:00
|
|
|
"files": ["**/test/frontend/**/*.js"],
|
2019-10-14 09:17:30 -04:00
|
|
|
"globals": {
|
|
|
|
"expect": true,
|
|
|
|
"define": true,
|
|
|
|
"$": true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// Backend specific rules
|
2019-11-13 09:23:20 -05:00
|
|
|
"files": ["**/app/src/**/*.js"],
|
2019-08-09 05:39:26 -04:00
|
|
|
"rules": {
|
2019-10-14 09:17:30 -04:00
|
|
|
// don't allow console.log in backend code
|
2019-08-09 05:39:26 -04:00
|
|
|
"no-console": "error"
|
|
|
|
}
|
2019-10-14 09:17:30 -04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
// Frontend specific rules
|
2019-11-05 09:00:13 -05:00
|
|
|
"files": ["**/frontend/js/**/*.js"],
|
2019-10-14 09:17:30 -04:00
|
|
|
"globals": {
|
|
|
|
"define": true,
|
|
|
|
"$": true,
|
|
|
|
"angular": true,
|
|
|
|
"_": true,
|
|
|
|
"ace": true,
|
|
|
|
"ga": true,
|
|
|
|
"sl_console": true,
|
|
|
|
"sl_debugging": true,
|
|
|
|
// Injected in layout.pug
|
|
|
|
"user_id": true
|
|
|
|
}
|
2019-08-07 10:04:04 -04:00
|
|
|
}
|
|
|
|
]
|
2018-03-02 11:06:48 -05:00
|
|
|
}
|