-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
68 lines (66 loc) · 3.74 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true,
},
"settings": {
"import/resolver": "webpack",
},
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
],
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2018,
},
"rules": {
// Basic settings
"indent": ["warn", 4], // Indent with 4 spaces
"no-tabs": ["warn"], // Don't use tabs
"no-trailing-spaces": ["warn"], // Don't allow trailing spaces
"linebreak-style": ["error", "unix"], // End lines with UNIX line breaks
"max-len": ["warn", { "code": 120 }], // Line length is limited by 120 characters
"semi": ["error", "never"], // Don't use semicolons if not necessary
"semi-style": ["error", "first"], // If necessary, write semicolon at the beginning of the line
"eol-last": ["error", "always"], // enforces at least one newline (or absence thereof) at the end of non-empty files
// Code settings
"no-use-before-define": ["error"], // Define functions, classes and variables before you use them
"no-var": ["warn"], // Don't allow var
"prefer-const": ["warn", { "ignoreReadBeforeAssign": true }], // If let is not assigned to, prefer const
"no-return-assign": ["error", "always"], // Don't allow assingment in return statement
"eqeqeq": ["error", "smart"], // Reqire use of === and !== instead of == and != (with a few exceptions)
"complexity": ["warn", 10], // Maximum cyclomatic complexity
"sort-imports": ["error", {
"allowSeparatedGroups": true, // Allow newlines between import groups
"ignoreDeclarationSort": true, // Ignore order of declarations, but still sort members of each import
}],
"import/order": ["error", {
"alphabetize": { "order": "asc" }, // Sort imports alphabetically by module
"newlines-between": "always", // Enforce newlines between import groups
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"pathGroups": [{
"pattern": "ferda/**",
"group": "internal",
}, {
"pattern": "ferda/../**",
"group": "internal",
}],
"pathGroupsExcludedImportTypes": ["builtin"],
}],
// Spacing settings
"space-before-blocks": ["warn"], // Require at least one preceding space before blocks
"keyword-spacing": ["warn"], // Reqiure spacing around keywords
"func-call-spacing": ["error", "never"], // Don't allow spaces between function call and arguments
"space-before-function-paren": ["error", "never"], // Don't allow spaces before function definition parenthesis
"spaced-comment": ["warn", "always"], // Require whitespace after //
"space-in-parens": ["warn", "never"], // Don't allow spaces in parenthesis
"comma-spacing": ["warn"], // Reqire space after comma, don't allow space before
"space-infix-ops": ["warn"], // Require spaces around infix operators (including =)
"quotes": ["warn", "single", { "avoidEscape": true, "allowTemplateLiterals": true }], // Requires the use of single quotes, allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise, allows strings to use backticks
"comma-dangle": ["warn", "always-multiline"], // Require for the last item in multiline object to be followed by comma
"no-multiple-empty-lines": ["warn", { "max": 1, "maxEOF": 0, "maxBOF": 0, }], // Allow max one empty line
}
};