Skip to content

Commit fc966e8

Browse files
committed
added eslint etc configs
1 parent 7208ebf commit fc966e8

File tree

5 files changed

+247
-0
lines changed

5 files changed

+247
-0
lines changed

Diff for: .editorconfig

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[{*.js, *.css, *.tpl, *.json}]
4+
indent_style = tab
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = false

Diff for: .eslintrc

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"extends": "airbnb-base",
3+
"parserOptions": {
4+
"sourceType": "script"
5+
},
6+
7+
"rules": {
8+
// Customized
9+
"handle-callback-err": [ "error","^(e$|(e|(.*(_e|E)))rr)" ],
10+
"comma-dangle": ["error", {
11+
"arrays": "always-multiline",
12+
"objects": "always-multiline",
13+
"imports": "always-multiline",
14+
"exports": "always-multiline",
15+
"functions": "never"
16+
}],
17+
"no-empty": ["error", { "allowEmptyCatch": true }],
18+
"no-underscore-dangle": "off",
19+
"newline-per-chained-call": "off",
20+
"no-console": "off",
21+
"no-mixed-operators": ["error", { "allowSamePrecedence": true }],
22+
"strict": ["error", "global"],
23+
"consistent-return": "off",
24+
"func-names": "off",
25+
"no-tabs": "off",
26+
"indent": ["error", "tab"],
27+
"no-eq-null": "off",
28+
"camelcase": "off",
29+
"no-new": "off",
30+
"no-shadow": "off",
31+
"no-use-before-define": ["error", "nofunc"],
32+
"no-prototype-builtins": "off",
33+
"new-cap": "off",
34+
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
35+
"import/no-unresolved": "error",
36+
37+
// ES6
38+
"prefer-rest-params": "off",
39+
"prefer-spread": "off",
40+
"prefer-arrow-callback": "off",
41+
"prefer-template": "off",
42+
"no-var": "off",
43+
"object-shorthand": "off",
44+
"vars-on-top": "off",
45+
46+
// TODO
47+
"import/no-extraneous-dependencies": "off",
48+
"import/no-dynamic-require": "off",
49+
"import/newline-after-import": "off",
50+
"no-bitwise": "off",
51+
"global-require": "off",
52+
"max-len": "off",
53+
"no-param-reassign": "off",
54+
"no-restricted-syntax": "off",
55+
"no-script-url": "off",
56+
"default-case": "off",
57+
"linebreak-style": "off",
58+
59+
// "no-multi-assign": "off",
60+
// "one-var": "off",
61+
// "no-undef": "off",
62+
// "max-nested-callbacks": "off",
63+
// "no-mixed-requires": "off",
64+
// "brace-style": "off",
65+
// "max-statements-per-line": "off",
66+
// "no-unused-vars": "off",
67+
// "no-mixed-spaces-and-tabs": "off",
68+
// "no-useless-concat": "off",
69+
// "require-jsdoc": "off",
70+
// "eqeqeq": "off",
71+
// "no-negated-condition": "off",
72+
// "one-var-declaration-per-line": "off",
73+
// "no-lonely-if": "off",
74+
// "radix": "off",
75+
// "no-else-return": "off",
76+
// "no-useless-escape": "off",
77+
// "block-scoped-var": "off",
78+
// "operator-assignment": "off",
79+
// "yoda": "off",
80+
// "no-loop-func": "off",
81+
// "no-void": "off",
82+
// "valid-jsdoc": "off",
83+
// "no-cond-assign": "off",
84+
// "no-redeclare": "off",
85+
// "no-unreachable": "off",
86+
// "no-nested-ternary": "off",
87+
// "operator-linebreak": "off",
88+
// "guard-for-in": "off",
89+
// "no-unneeded-ternary": "off",
90+
// "no-sequences": "off",
91+
// "no-extend-native": "off",
92+
// "no-shadow-restricted-names": "off",
93+
// "no-extra-boolean-cast": "off",
94+
// "no-path-concat": "off",
95+
// "no-unused-expressions": "off",
96+
// "no-return-assign": "off",
97+
// "no-restricted-modules": "off",
98+
// "object-curly-spacing": "off",
99+
// "indent": "off",
100+
// "padded-blocks": "off",
101+
// "eol-last": "off",
102+
// "lines-around-directive": "off",
103+
// "strict": "off",
104+
// "comma-dangle": "off",
105+
// "no-multi-spaces": "off",
106+
// "quotes": "off",
107+
// "keyword-spacing": "off",
108+
// "no-mixed-operators": "off",
109+
// "comma-spacing": "off",
110+
// "no-trailing-spaces": "off",
111+
// "key-spacing": "off",
112+
// "no-multiple-empty-lines": "off",
113+
// "spaced-comment": "off",
114+
// "space-in-parens": "off",
115+
// "block-spacing": "off",
116+
// "quote-props": "off",
117+
// "space-unary-ops": "off",
118+
// "no-empty": "off",
119+
// "dot-notation": "off",
120+
// "func-call-spacing": "off",
121+
// "array-bracket-spacing": "off",
122+
// "object-property-newline": "off",
123+
// "no-continue": "off",
124+
// "no-extra-semi": "off",
125+
// "no-spaced-func": "off",
126+
// "no-useless-return": "off"
127+
}
128+
}

Diff for: .jsbeautifyrc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"indent_size": 4,
3+
"indent_char": " ",
4+
"indent_level": 0,
5+
"indent_with_tabs": true,
6+
"preserve_newlines": true,
7+
"max_preserve_newlines": 10,
8+
"jslint_happy": true,
9+
"brace_style": "collapse",
10+
"keep_array_indentation": false,
11+
"keep_function_indentation": false,
12+
"space_before_conditional": true,
13+
"break_chained_methods": false,
14+
"eval_code": false,
15+
"unescape_strings": false,
16+
"wrap_line_length": 0
17+
}

Diff for: .jshintrc

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
// JSHint Default Configuration File (as on JSHint website)
3+
// See http://jshint.com/docs/ for more details
4+
5+
"maxerr" : 50, // {int} Maximum error before stopping
6+
7+
// Enforcing
8+
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
9+
"camelcase" : false, // true: Identifiers must be in camelCase
10+
"curly" : true, // true: Require {} for every new block or scope
11+
"eqeqeq" : true, // true: Require triple equals (===) for comparison
12+
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
13+
"immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
14+
"indent" : 4, // {int} Number of spaces to use for indentation
15+
"latedef" : false, // true: Require variables/functions to be defined before being used
16+
"newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()`
17+
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
18+
"noempty" : true, // true: Prohibit use of empty blocks
19+
"nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment)
20+
"plusplus" : false, // true: Prohibit use of `++` & `--`
21+
"quotmark" : false, // Quotation mark consistency:
22+
// false : do nothing (default)
23+
// true : ensure whatever is used is consistent
24+
// "single" : require single quotes
25+
// "double" : require double quotes
26+
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
27+
"unused" : true, // true: Require all defined variables be used
28+
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
29+
"trailing" : false, // true: Prohibit trailing whitespaces
30+
"maxparams" : false, // {int} Max number of formal params allowed per function
31+
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
32+
"maxstatements" : false, // {int} Max number statements per function
33+
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
34+
"maxlen" : false, // {int} Max number of characters per line
35+
36+
// Relaxing
37+
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
38+
"boss" : false, // true: Tolerate assignments where comparisons would be expected
39+
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
40+
"eqnull" : false, // true: Tolerate use of `== null`
41+
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
42+
"esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
43+
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
44+
// (ex: `for each`, multiple try/catch, function expression…)
45+
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
46+
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
47+
"funcscope" : false, // true: Tolerate defining variables inside control statements"
48+
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
49+
"iterator" : false, // true: Tolerate using the `__iterator__` property
50+
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
51+
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
52+
"laxcomma" : false, // true: Tolerate comma-first style coding
53+
"loopfunc" : false, // true: Tolerate functions being defined in loops
54+
"multistr" : false, // true: Tolerate multi-line strings
55+
"proto" : false, // true: Tolerate using the `__proto__` property
56+
"scripturl" : false, // true: Tolerate script-targeted URLs
57+
"smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment
58+
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
59+
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
60+
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
61+
"validthis" : false, // true: Tolerate using this in a non-constructor function
62+
63+
// Environments
64+
"browser" : true, // Web Browser (window, document, etc)
65+
"couch" : false, // CouchDB
66+
"devel" : true, // Development/debugging (alert, confirm, etc)
67+
"dojo" : false, // Dojo Toolkit
68+
"jquery" : true, // jQuery
69+
"mootools" : false, // MooTools
70+
"node" : true, // Node.js
71+
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
72+
"prototypejs" : false, // Prototype and Scriptaculous
73+
"rhino" : false, // Rhino
74+
"worker" : false, // Web Workers
75+
"wsh" : false, // Windows Scripting Host
76+
"yui" : false, // Yahoo User Interface
77+
"mocha": true,
78+
79+
// Legacy
80+
"nomen" : false, // true: Prohibit dangling `_` in variables
81+
"onevar" : false, // true: Allow only one `var` statement per function
82+
"passfail" : false, // true: Stop on first error
83+
"white" : false, // true: Check against strict whitespace and indentation rules
84+
85+
// Custom Globals
86+
"globals" : {
87+
"Promise": true
88+
} // additional predefined global variables
89+
}

Diff for: package.json

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
"nbbpm": {
2222
"compatibility": "^1.6.0"
2323
},
24+
"devDependencies": {
25+
"eslint": "^3.12.0",
26+
"eslint-config-airbnb-base": "^11.1.0",
27+
"eslint-plugin-import": "^2.2.0"
28+
},
2429
"license": "BSD-2-Clause",
2530
"bugs": {
2631
"url": "https://github.com/psychobunny/nodebb-plugin-custom-pages/issues"

0 commit comments

Comments
 (0)