eslint: Make subdirectory configurations more consistent.

Enable ES2020 everywhere except Casper.  Disable Node-specific globals
in static.  Disable browser-specific and CommonJS globals in shared.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-07-23 19:33:22 -07:00 committed by Tim Abbott
parent c9ce77c28b
commit a83c2c6296
3 changed files with 49 additions and 40 deletions

View File

@ -1,12 +1,11 @@
{
"env": {
"node": true,
"es6": true
"es2020": true,
"node": true
},
"extends": ["eslint:recommended", "prettier"],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2019,
"warnOnUnsupportedTypeScriptVersion": false,
"sourceType": "module"
},
@ -86,7 +85,7 @@
},
"overrides": [
{
"files": ["frontend_tests/**/*.{js,ts}", "static/js/**/*.{js,ts}"],
"files": ["frontend_tests/**", "static/js/**"],
"globals": {
"$": false,
"ClipboardJS": false,
@ -296,15 +295,6 @@
"zxcvbn": false
}
},
{
"files": ["frontend_tests/casper_tests/*.js", "frontend_tests/casper_lib/*.js"],
"rules": {
// Dont require ES features that PhantomJS doesnt support
"no-var": "off",
"object-shorthand": "off",
"prefer-arrow-callback": "off"
}
},
{
"files": ["**/*.ts"],
"extends": ["plugin:@typescript-eslint/recommended", "prettier/@typescript-eslint"],
@ -340,6 +330,52 @@
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/unified-signatures": "error"
}
},
{
"files": ["frontend_tests/**"],
"globals": {
"assert": false,
"casper": false,
"document": false,
"set_global": false,
"window": false,
"zrequire": false
},
"rules": {
"no-sync": "off"
}
},
{
"files": ["frontend_tests/casper_lib/**", "frontend_tests/casper_tests/**"],
"env": {
"browser": true,
"es2020": false
},
"rules": {
// Dont require ES features that PhantomJS doesnt support
"no-var": "off",
"object-shorthand": "off",
"prefer-arrow-callback": "off"
}
},
{
"files": ["static/**"],
"env": {
"browser": true,
"commonjs": true,
"node": false
},
"rules": {
"no-console": "error"
}
},
{
"files": ["static/shared/**"],
"env": {
"browser": false,
"commonjs": false,
"shared-node-browser": true
}
}
]
}

View File

@ -1,19 +0,0 @@
{
"env": {
"shared-node-browser": true,
"es6": true
},
"parserOptions": {"ecmaVersion": 2018},
"globals": {
"assert": false,
"casper": false,
"document": false,
"set_global": false,
"window": false,
"zrequire": false
},
"rules": {
"no-sync": 0,
"prefer-const": "error"
}
}

View File

@ -1,8 +0,0 @@
{
"env": {
"browser": true
},
"rules": {
"no-console": "error"
}
}