Skip to content

Commit

Permalink
eslint rules based on recommend and standard rules, a few relaxtions …
Browse files Browse the repository at this point in the history
…on code checking (warnings only)
  • Loading branch information
tchakabam committed Mar 5, 2018
1 parent 9d01fb0 commit 07849c8
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 88 deletions.
155 changes: 69 additions & 86 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,99 +1,82 @@
module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"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
// 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
},
/*
"extends": "node-style-guide",
*/
// see https://standardjs.com/
// see https://github.com/standard/eslint-config-standard
// see https://github.com/felixge/node-style-guide
"extends": [
"eslint:recommended",
"standard"
],
"parserOptions": {
"sourceType": "module"
"sourceType": "module"
},
"plugins": ["prettier"],
"rules": {
// our basic style rules
"semi": ["error", "always"],
"indent": [
"error",
2
],
"quotes": [
"error",
"single"
],
"linebreak-style": [
"error",
"unix"
],
"space-infix-ops": 2,
"space-unary-ops": [2, {"words": true, "nonwords": false}],
"space-in-parens": ["error", "never"],
"keyword-spacing": [2, {"before": true, "after": true}],

"one-var": 0,

"no-bitwise": 0,
"camelcase": 2,
"curly": 2,
"eqeqeq": 2,
"no-eq-null": 2,
"wrap-iife": [
2,
"any"
],
"indent": [
2,
2,
{
"SwitchCase": 1
}
],
"no-use-before-define": [
2,
{
"functions": false
}
],
"new-cap": 2,
"no-caller": 2,
"quotes": [
2,
"single"
],
"strict": 0,
"no-undef": 2,
"no-unused-vars": 2
// limit code block and line length
/*
"max-len": 0,
"max-statements": 0,
"max-depth": 0,
"max-nested-callbacks": 0,
"max-params": 0,
"max-statements": 0,
"max-statements-per-line": 0
*/

/*
// customizations of Node style-guide
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"no-var": "error",
"block-spacing": "error",
"comma-style": ["error", "last"],
"comma-spacing": ["error", { "before": false, "after": true }],
"curly": ["error", "multi-or-nest", "consistent"],
"object-curly-spacing": ["error", "always"],
"object-curly-newline": ["error", {
"ObjectExpression": "always",
"ObjectPattern": { "multiline": false }
}],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "align": "colon" }],
"semi": ["error", "always"],
"object-property-newline": ["error"],
// part of Node Style-guide but ignored
"max-len": 0,
"max-statements": 0,
"space-after-keywords": 0
*/
// loosening of code-quality rules we may want to fix later
// (warnings for now)
"standard/no-callback-literal": 1,
"import/first": 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
}
};
3 changes: 1 addition & 2 deletions tests/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module.exports = {
"env": {
"node": true,
"browser": true,
"commonjs": true,
"es6": true,
},
Expand All @@ -16,6 +15,6 @@ module.exports = {
"expect": false,
"it": false,
"sinon": false,
"xit": false,
"xit": false
},
};

0 comments on commit 07849c8

Please sign in to comment.