Improve the ESLint situation

This commit is contained in:
Xaekai 2022-01-22 09:42:39 -08:00
parent 3212aa5df6
commit cfe009323f
5 changed files with 97 additions and 35 deletions

45
.eslintrc.js Normal file
View file

@ -0,0 +1,45 @@
/* ESLint Config */
module.exports = {
env: {
'es2017': true,
// others envs defined by cascading .eslintrc files
},
extends: 'eslint:recommended',
parser: '@babel/eslint-parser',
parserOptions: {
'sourceType': 'module',
},
rules: {
'brace-style': ['error','1tbs',{ 'allowSingleLine': true }],
'indent': [
'off', // temporary... a lot of stuff needs to be reformatted | 2020-08-21: I guess it's not so temporary...
4,
{ 'SwitchCase': 1 }
],
'linebreak-style': ['error','unix'],
'no-control-regex': ['off'],
'no-prototype-builtins': ['off'], // should consider cleaning up the code and turning this back on at some point
'no-trailing-spaces': ['error'],
'no-unused-vars': [
'error', {
'argsIgnorePattern': '^_',
'varsIgnorePattern': '^_|^Promise$'
}
],
'semi': ['error','always'],
'quotes': ['off'] // Old code uses double quotes, new code uses single / template
},
ignorePatterns: [
// These are not ours
'www/js/dash.all.min.js',
'www/js/jquery-1.12.4.min.js',
'www/js/jquery-ui.js',
'www/js/peertube.js',
'www/js/playerjs-0.0.12.js',
'www/js/sc.js',
'www/js/video.js',
'www/js/videojs-contrib-hls.min.js',
'www/js/videojs-dash.js',
'www/js/videojs-resolution-switcher.js',
],
}

View file

@ -1,35 +0,0 @@
env:
es6: true
node: true
extends: 'eslint:recommended'
parser: '@babel/eslint-parser'
parserOptions:
sourceType: module
ecmaVersion: 2017 # For async/await
rules:
brace-style:
- error
- 1tbs
- allowSingleLine: true
indent:
- off # temporary... a lot of stuff needs to be reformatted | 2020-08-21: I guess it's not so temporary...
- 4
- SwitchCase: 1
linebreak-style:
- error
- unix
no-control-regex:
- off
no-prototype-builtins:
- off # should consider cleaning up the code and turning this back on at some point
no-trailing-spaces:
- error
no-unused-vars:
- error
- argsIgnorePattern: ^_
varsIgnorePattern: ^_|^Promise$
semi:
- error
- always
quotes:
- off # Old code uses double quotes, new code uses single / template

1
src/.eslintrc.json Normal file
View file

@ -0,0 +1 @@
{ "env": { "node": true } }

50
www/.eslintrc.json Normal file
View file

@ -0,0 +1,50 @@
{
"env": { "browser": true, "jquery": true },
"globals": {
"CHANNEL": "writable",
"CHANNELNAME": "writable",
"CHATHIST": "writable",
"CHATHISTIDX": "writable",
"CHATSOUND": "writable",
"CHATTHROTTLE": "writable",
"CLIENT": "writable",
"CSEMOTELIST": "writable",
"DEFAULT_THEME": "writable",
"EMOTELIST": "writable",
"EMOTELISTMODAL": "writable",
"FILTER_FROM": "writable",
"FILTER_TO": "writable",
"FOCUSED": "writable",
"GS_VERSION": "writable",
"HAS_CONNECTED_BEFORE": "writable",
"IGNORE_SCROLL_EVENT": "writable",
"IGNORED": "writable",
"IMAGE_MATCH": "writable",
"JSPREF": "writable",
"KICKED": "writable",
"LASTCHAT": "writable",
"LEADTMR": "writable",
"PAGETITLE": "writable",
"PL_ACTION_QUEUE": "writable",
"PL_AFTER": "writable",
"PL_CURRENT": "writable",
"PL_FROM": "writable",
"PL_QUEUED_ACTIONS": "writable",
"PL_WAIT_SCROLL": "writable",
"PLAYER": "writable",
"REBUILDING": "writable",
"SCROLLCHAT": "writable",
"SOCKETIO_CONNECT_ERROR_COUNT": "writable",
"SUPERADMIN": "writable",
"TITLE_BLINK": "writable",
"USEROPTS": "writable",
"VHEIGHT": "writable",
"VOLUME": "writable",
"VWIDTH": "writable",
"CyTube": "writable",
"Rank": "writable",
"getOpt": "writable",
"setOpt": "writable",
"socket": "writable"
}
}

View file

@ -1,3 +1,4 @@
/*eslint no-unused-vars: "off"*/
var CL_VERSION = 3.0;
var GS_VERSION = 1.7; // Google Drive Userscript