forked from video-dev/hls.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request video-dev#1475 from video-dev/lets-improve-code-style
Move to eslint with idempotent configuration & ensure lint in CI
- Loading branch information
Showing
103 changed files
with
7,166 additions
and
7,501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
module.exports = { | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es6": true, | ||
}, | ||
"globals": { | ||
// Allowed globals | ||
"console": true, | ||
//"MediaSource": true, | ||
"performance": true, | ||
"crypto": true, | ||
"fetch": true, | ||
"Request": true, | ||
"Headers": true, | ||
"escape": true, | ||
|
||
// Compile-time defines | ||
"__VERSION__": true, | ||
"__USE_SUBTITLES__": true, | ||
"__USE_ALT_AUDIO__": true, | ||
"__USE_EME_DRM__": true | ||
}, | ||
// see https://standardjs.com/ | ||
// see https://github.com/standard/eslint-config-standard | ||
"extends": [ | ||
"eslint:recommended", | ||
"standard" | ||
], | ||
"parserOptions": { | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
// our basic style rules | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"indent": [ | ||
"error", | ||
2 | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
// spacing | ||
"space-infix-ops": 2, | ||
"space-unary-ops": [2, {"words": true, "nonwords": false}], | ||
"space-in-parens": ["error", "never"], | ||
"keyword-spacing": [2, {"before": true, "after": true}], | ||
// enforce litteral objects on multiple lines | ||
"block-spacing": "error", | ||
"curly": ["error", "multi-or-nest", "consistent"], | ||
"object-curly-spacing": ["error", "always"], | ||
"brace-style": ["error", "1tbs", { "allowSingleLine": true }], | ||
|
||
|
||
// limit code block and line length | ||
/* | ||
"max-len": 1, | ||
"max-statements": 1, | ||
"max-depth": 1, | ||
"max-nested-callbacks": 1, | ||
"max-params": 1, | ||
"max-statements": 1, | ||
"max-statements-per-line": 1 | ||
*/ | ||
|
||
// loosening of code-quality rules we may want to fix later | ||
// (warnings for now) | ||
|
||
// forbid "one var" style, enforce one declaration per variable | ||
"one-var": [ | ||
1, | ||
"never" | ||
], | ||
|
||
"standard/no-callback-literal": 1, | ||
"import/first": 1, | ||
"no-var": 1, | ||
"no-empty": 1, | ||
"no-mixed-operators": 1, | ||
"no-unused-vars": 1, | ||
"no-console": 1, | ||
"no-fallthrough": 1, | ||
"no-case-declarations": 1, | ||
"no-irregular-whitespace": 1, | ||
"no-self-assign": 1, | ||
"new-cap": 1, | ||
"no-undefined": 1 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
npm run lint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.