|
1 | 1 | {
|
2 |
| - "root": true, |
3 |
| - "env": { |
4 |
| - "browser": true, |
5 |
| - "es2017": true |
6 |
| - }, |
7 |
| - "extends": ["plugin:@typescript-eslint/recommended", "plugin:import/errors"], |
8 |
| - "globals": { |
9 |
| - "Atomics": "readonly", |
10 |
| - "SharedArrayBuffer": "readonly" |
11 |
| - }, |
12 |
| - "parser": "@typescript-eslint/parser", |
13 |
| - "plugins": ["@typescript-eslint"], |
14 |
| - "overrides": [ |
15 |
| - { |
16 |
| - "files": ["*.ts", "**/*.ts, *.js", "**/*.js"], |
17 |
| - "rules": { |
18 |
| - "no-multi-spaces": [ |
19 |
| - "error", |
20 |
| - { |
21 |
| - "exceptions": { |
22 |
| - //our imports |
23 |
| - "ImportDeclaration": true, |
24 |
| - //our variables |
25 |
| - "VariableDeclarator": true |
26 |
| - } |
| 2 | + "root": true, |
| 3 | + "env": { |
| 4 | + "browser": true, |
| 5 | + "es2017": true |
| 6 | + }, |
| 7 | + "extends": ["plugin:@typescript-eslint/recommended", "plugin:import/errors"], |
| 8 | + "globals": { |
| 9 | + "Atomics": "readonly", |
| 10 | + "SharedArrayBuffer": "readonly" |
| 11 | + }, |
| 12 | + "parser": "@typescript-eslint/parser", |
| 13 | + "plugins": ["@typescript-eslint"], |
| 14 | + "overrides": [ |
| 15 | + { |
| 16 | + "files": ["**/*.ts", "**/**/*.ts", "**/**/**/*.ts", "**/**/**/**/*.ts", "**/**/**/**/**/*.ts"], |
| 17 | + "rules": { |
| 18 | + //this will conflict with our standards regarding horizontal and vertical aligning in page models class parameters. |
| 19 | + //we must decide if this rules is relevant or not, we can't do both... |
| 20 | + //******************************************** STANDARDS ******************************************** |
| 21 | + //Forcing usage of ; |
| 22 | + "semi": "off", |
| 23 | + "@typescript-eslint/semi": ["error"], |
| 24 | + //All clauses must have {} |
| 25 | + "curly": ["error", "all"], |
| 26 | + //Forces usage of string[] over Array<string> |
| 27 | + "@typescript-eslint/array-type": ["error", { |
| 28 | + "array": true |
| 29 | + }], |
| 30 | + //Makes sure that the identation is 4 each all the time. |
| 31 | + "indent": ["error", 4, { "SwitchCase": 1 }], |
| 32 | + //Forcing a function to have a return type |
| 33 | + "@typescript-eslint/explicit-function-return-type": "error", |
| 34 | + //Use ' instead of " |
| 35 | + "quotes": ["error", "single"], |
| 36 | + //Use let only when reusing a variable. Else always use const. |
| 37 | + "prefer-const": "error", |
| 38 | + //Use grace accent (`) for string concetration rather than + |
| 39 | + "prefer-template": "error", |
| 40 | + //Forcing usage of primitive types over boxed types. i.e. Use number instead of Number |
| 41 | + "@typescript-eslint/ban-types": [ |
| 42 | + "error", |
| 43 | + { |
| 44 | + "types": { |
| 45 | + "object": false |
27 | 46 | }
|
28 |
| - ], |
29 |
| - //Makes sure that the identation is 4 each all the time. |
30 |
| - "indent": ["error", 4, { "SwitchCase": 1 }], |
31 |
| - //Limits the length of a row to 100 |
32 |
| - "max-len": ["off", 200], |
33 |
| - //Forcing a function to have a return type |
34 |
| - "@typescript-eslint/explicit-function-return-type": "error", |
35 |
| - //Forcing that all of the comments are with spaces. |
36 |
| - "spaced-comment": "off", |
37 |
| - //Forcing not to have random spaces. |
38 |
| - "no-trailing-spaces": [ |
39 |
| - "error", |
40 |
| - { |
41 |
| - "ignoreComments": false |
42 |
| - } |
43 |
| - ], |
44 |
| - //Forcing to use json.['dot'] vs json.dot |
45 |
| - "dot-notation": "error", |
46 |
| - //Require === and !== (eqeqeq) |
47 |
| - "eqeqeq": "error", |
48 |
| - //preventing from us to keep unused variables. relevant for imports as well. |
49 |
| - "no-unused-vars": "error", |
50 |
| - //prevents from having multiple empty lines, our standard should be max of 1 empty line. |
51 |
| - "no-multiple-empty-lines": [ |
52 |
| - "error", |
53 |
| - { |
54 |
| - "max": 1 |
55 |
| - } |
56 |
| - ], |
57 |
| - "comma-dangle": ["error", "never"], |
58 |
| - "brace-style": ["error", "stroustrup"], |
59 |
| - //using { key: value } or { 'key': value } consistently only! |
60 |
| - "quote-props": ["error", "consistent"], |
61 |
| - //cannot use constructor () only constructor() |
62 |
| - "space-before-function-paren": ["error", "never"], |
63 |
| - //cannot use else return |
64 |
| - "no-else-return": [ |
65 |
| - "error", |
66 |
| - { |
67 |
| - "allowElseIf": true |
68 |
| - } |
69 |
| - ], |
70 |
| - //spaces between ops, bad: a+ b, good: a + b |
71 |
| - "space-infix-ops": "error", |
72 |
| - "radix": "off", |
73 |
| - "prefer-const": "error", |
74 |
| - "comma-spacing": [ |
75 |
| - "error", |
76 |
| - { |
77 |
| - "before": false, |
78 |
| - "after": true |
79 |
| - } |
80 |
| - ], |
81 |
| - "import/no-unresolved": "off", |
82 |
| - "space-in-parens": ["error", "never"], |
83 |
| - "quotes": ["error", "single"], |
84 |
| - "prefer-template": "error", |
85 |
| - "default-case": "error", |
86 |
| - "nonblock-statement-body-position": [ |
87 |
| - "error", "beside", { "overrides": { "if": "any" }} |
88 |
| - ], |
89 |
| - "no-extra-semi": "error", |
90 |
| - "no-empty-function": "error", |
91 |
| - "no-spaced-func": "off", |
92 |
| - "func-call-spacing": "off", |
93 |
| - "dot-location": "off", |
94 |
| - "arrow-spacing": [ |
95 |
| - "error", |
96 |
| - { |
97 |
| - "before": true, |
98 |
| - "after": true |
99 |
| - } |
100 |
| - ], |
101 |
| - "import/order": "error", |
102 |
| - "import/no-duplicates": "error", |
103 |
| - /* below are extended rules regarding the recommended typescript rule package...*/ |
104 |
| - "@typescript-eslint/type-annotation-spacing": "error", //RELEVANT: makes sure you have spaces around type declaration. |
105 |
| - "@typescript-eslint/member-delimiter-style": [ |
106 |
| - "error", |
107 |
| - { |
108 |
| - "multiline": { |
109 |
| - "delimiter": "comma", |
110 |
| - "requireLast": false |
111 |
| - }, |
112 |
| - "singleline": { |
113 |
| - "delimiter": "comma", |
114 |
| - "requireLast": false |
115 |
| - } |
116 |
| - } |
117 |
| - ], //interface styling for each row, we use comma |
118 |
| - "@typescript-eslint/no-inferrable-types": "error", // Tells you not to add a type, because it automatically taken it! |
| 47 | + } |
| 48 | + ], |
| 49 | + //Require === and !== (eqeqeq) unless Comparing two literal values, Evaluating the value of typeof, Comparing against null |
| 50 | + "eqeqeq": ["error", "smart"], |
119 | 51 |
|
120 |
| - //Additional rules.. |
121 |
| - "key-spacing": [ |
122 |
| - "error", |
123 |
| - { |
124 |
| - "beforeColon": false, |
125 |
| - "afterColon": true |
| 52 | + // ******************** NOT README STANDARDS ******************** |
| 53 | + //Limits the length of a row to 400 |
| 54 | + "max-len": ["error", 400], |
| 55 | + |
| 56 | + //Forcing that all of the comments are with spaces. |
| 57 | + "spaced-comment": "off", |
| 58 | + //Forcing not to have random spaces. |
| 59 | + "no-trailing-spaces": [ |
| 60 | + "error", |
| 61 | + { |
| 62 | + "ignoreComments": false |
| 63 | + } |
| 64 | + ], |
| 65 | + //Forcing to use json.['dot'] vs json.dot |
| 66 | + "dot-notation": "error", |
| 67 | + |
| 68 | + //preventing from us to keep unused variables. relevant for imports as well. |
| 69 | + "no-unused-vars": "off", |
| 70 | + "@typescript-eslint/no-unused-vars": "error", |
| 71 | + //prevents from having multiple empty lines, our standard should be max of 1 empty line. |
| 72 | + "no-multiple-empty-lines": [ |
| 73 | + "error", |
| 74 | + { |
| 75 | + "max": 1 |
| 76 | + } |
| 77 | + ], |
| 78 | + //Require or disallow trailing commas |
| 79 | + "comma-dangle": ["error", "never"], |
| 80 | + //Forcing if, else if, else, finally, catch to have opening curly brackets on the same line |
| 81 | + "brace-style": ["error", "stroustrup"], |
| 82 | + //using { key: value } or { 'key': value } consistently only! |
| 83 | + "quote-props": ["error", "consistent"], |
| 84 | + //cannot use constructor () only constructor() |
| 85 | + "space-before-function-paren": ["error", "never"], |
| 86 | + //cannot use else return |
| 87 | + "no-else-return": [ |
| 88 | + "error", |
| 89 | + { |
| 90 | + "allowElseIf": true |
| 91 | + } |
| 92 | + ], |
| 93 | + //spaces between ops, bad: a+ b, good: a + b |
| 94 | + "space-infix-ops": "error", |
| 95 | + //Disabling the requirement of using the Radix parameter when using parseInt function |
| 96 | + "radix": "off", |
| 97 | + //Forcing command spacing, comma (,) should not have a space before but should have one after. |
| 98 | + "comma-spacing": [ |
| 99 | + "error", |
| 100 | + { |
| 101 | + "before": false, |
| 102 | + "after": true |
| 103 | + } |
| 104 | + ], |
| 105 | + //Ensures an imported module can be resolved to a module on the local filesystem |
| 106 | + "import/no-unresolved": "off", |
| 107 | + //Disallow or enforce spaces inside of parentheses |
| 108 | + "space-in-parens": ["error", "never"], |
| 109 | + //Require Default Case in Switch Statements |
| 110 | + "default-case": "error", |
| 111 | + //Disallow unnecessary semicolons |
| 112 | + "no-extra-semi": "error", |
| 113 | + //Disallow empty functions |
| 114 | + "no-empty-function": "error", |
| 115 | + //Disallow spacing between function identifiers and their applications |
| 116 | + "no-spaced-func": "error", |
| 117 | + //Eequire or disallow spacing between function identifiers and their invocations |
| 118 | + "func-call-spacing": ["error", "never"], |
| 119 | + //Enforce newline before and after dot |
| 120 | + "dot-location": ["off"], |
| 121 | + //Require space before/after arrow function's arrow. (a) => {} |
| 122 | + "arrow-spacing": [ |
| 123 | + "error", |
| 124 | + { |
| 125 | + "before": true, |
| 126 | + "after": true |
| 127 | + } |
| 128 | + ], |
| 129 | + //Enforce a convention in module import order |
| 130 | + "import/order": "error", |
| 131 | + //Disallow duplicate imports |
| 132 | + "import/no-duplicates": "error", |
| 133 | + /* Below are extended rules regarding the recommended typescript rule package...*/ |
| 134 | + //Require consistent spacing around type annotations |
| 135 | + "@typescript-eslint/type-annotation-spacing": "error", //RELEVANT: makes sure you have spaces around type declaration. |
| 136 | + //Require a specific member delimiter style for interfaces and type literals. |
| 137 | + "@typescript-eslint/member-delimiter-style": [ |
| 138 | + "error", |
| 139 | + { |
| 140 | + "multiline": { |
| 141 | + "delimiter": "comma", |
| 142 | + "requireLast": false |
| 143 | + }, |
| 144 | + "singleline": { |
| 145 | + "delimiter": "comma", |
| 146 | + "requireLast": false |
126 | 147 | }
|
127 |
| - ] |
128 |
| - } |
129 |
| - }, |
130 |
| - { |
131 |
| - //Exceptions for our tests |
132 |
| - "files": ["tests/*.ts", "tests/**/*.ts"], |
133 |
| - "rules": { |
134 |
| - "@typescript-eslint/no-use-before-define": ["error", { "functions": false }], |
135 |
| - "key-spacing": "off", |
136 |
| - "indent": "off", |
137 |
| - "@typescript-eslint/camelcase": "off" |
138 |
| - } |
139 |
| - }, |
140 |
| - { |
141 |
| - //Exceptions for our API files |
142 |
| - "files": "api/*.ts", |
143 |
| - "rules": { |
144 |
| - "@typescript-eslint/camelcase": "off", |
145 |
| - "@typescript-eslint/no-use-before-define": "off" |
146 |
| - } |
147 |
| - }, |
148 |
| - { |
149 |
| - //Exceptions for our page models |
150 |
| - "files": "pageObjects/*.ts", |
151 |
| - "rules": { |
152 |
| - "no-multi-spaces": "off", |
153 |
| - "@typescript-eslint/type-annotation-spacing": "off", |
154 |
| - "@typescript-eslint/no-use-before-define": "off", |
155 |
| - "key-spacing": "off" |
156 |
| - } |
157 |
| - }, |
158 |
| - { |
159 |
| - //Exceptions for filler file. |
160 |
| - "files": "*/filler.ts", |
161 |
| - "rules": { |
162 |
| - "indent": "off", |
163 |
| - "@typescript-eslint/no-var-requires": "off" |
164 |
| - } |
165 |
| - }, |
166 |
| - { |
167 |
| - "files": "common-actions/*.ts", |
168 |
| - "rules": { |
169 |
| - "@typescript-eslint/camelcase": "off", |
170 |
| - "space-infix-ops": "off" |
171 |
| - } |
| 148 | + } |
| 149 | + ], //interface styling for each row, we use comma |
| 150 | + //Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean |
| 151 | + "@typescript-eslint/no-inferrable-types": "error", |
| 152 | + |
| 153 | + //Enforce consistent spacing between keys and values in object literal properties |
| 154 | + //Colons never have a space before and only after. key: item instead of key : item |
| 155 | + "key-spacing": [ |
| 156 | + "error", |
| 157 | + { |
| 158 | + "beforeColon": false, |
| 159 | + "afterColon": true |
| 160 | + } |
| 161 | + ] |
172 | 162 | }
|
173 |
| - ] |
174 |
| - } |
| 163 | + } |
| 164 | + ] |
| 165 | +} |
0 commit comments