123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. "use strict";
  2. /**
  3. * @license
  4. * Copyright 2016 Palantir Technologies, Inc.
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. Object.defineProperty(exports, "__esModule", { value: true });
  19. exports.rules = {
  20. "adjacent-overload-signatures": true,
  21. "align": {
  22. options: [
  23. "parameters",
  24. "statements",
  25. ],
  26. },
  27. "array-type": {
  28. options: ["array-simple"],
  29. },
  30. "arrow-parens": true,
  31. "arrow-return-shorthand": true,
  32. "ban-types": {
  33. options: [
  34. ["Object", "Avoid using the `Object` type. Did you mean `object`?"],
  35. ["Function", "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."],
  36. ["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
  37. ["Number", "Avoid using the `Number` type. Did you mean `number`?"],
  38. ["String", "Avoid using the `String` type. Did you mean `string`?"],
  39. ["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"],
  40. ],
  41. },
  42. "callable-types": true,
  43. "class-name": true,
  44. "comment-format": {
  45. options: ["check-space"],
  46. },
  47. "curly": true,
  48. "cyclomatic-complexity": false,
  49. "eofline": true,
  50. "forin": true,
  51. "import-spacing": true,
  52. "indent": {
  53. options: ["spaces"],
  54. },
  55. "interface-name": {
  56. options: ["always-prefix"],
  57. },
  58. "interface-over-type-literal": true,
  59. "jsdoc-format": true,
  60. "label-position": true,
  61. "max-classes-per-file": {
  62. options: [1],
  63. },
  64. "max-line-length": {
  65. options: [120],
  66. },
  67. "member-access": true,
  68. "member-ordering": {
  69. options: {
  70. order: "statics-first",
  71. },
  72. },
  73. "new-parens": true,
  74. "no-angle-bracket-type-assertion": true,
  75. "no-any": false,
  76. "no-arg": true,
  77. "no-bitwise": true,
  78. "no-conditional-assignment": true,
  79. "no-consecutive-blank-lines": true,
  80. "no-console": true,
  81. "no-construct": true,
  82. "no-debugger": true,
  83. "no-duplicate-super": true,
  84. "no-empty": true,
  85. "no-empty-interface": true,
  86. "no-eval": true,
  87. "no-internal-module": true,
  88. "no-invalid-this": false,
  89. "no-misused-new": true,
  90. "no-namespace": true,
  91. "no-parameter-properties": false,
  92. "no-reference": true,
  93. "no-reference-import": true,
  94. "no-shadowed-variable": true,
  95. "no-string-literal": true,
  96. "no-string-throw": true,
  97. "no-switch-case-fall-through": false,
  98. "no-trailing-whitespace": true,
  99. "no-unnecessary-initializer": true,
  100. "no-unsafe-finally": true,
  101. "no-unused-expression": true,
  102. // disable this rule as it is very heavy performance-wise and not that useful
  103. "no-use-before-declare": false,
  104. "no-var-keyword": true,
  105. "no-var-requires": true,
  106. "object-literal-key-quotes": {
  107. options: ["consistent-as-needed"],
  108. },
  109. "object-literal-shorthand": true,
  110. "object-literal-sort-keys": true,
  111. "one-line": {
  112. options: [
  113. "check-catch",
  114. "check-else",
  115. "check-finally",
  116. "check-open-brace",
  117. "check-whitespace",
  118. ],
  119. },
  120. "one-variable-per-declaration": {
  121. options: ["ignore-for-loop"],
  122. },
  123. "only-arrow-functions": {
  124. options: [
  125. "allow-declarations",
  126. "allow-named-functions",
  127. ],
  128. },
  129. "ordered-imports": {
  130. options: {
  131. "import-sources-order": "case-insensitive",
  132. "module-source-path": "full",
  133. "named-imports-order": "case-insensitive",
  134. },
  135. },
  136. "prefer-const": true,
  137. "prefer-for-of": true,
  138. "quotemark": {
  139. options: [
  140. "double",
  141. "avoid-escape",
  142. ],
  143. },
  144. "radix": true,
  145. "semicolon": {
  146. options: ["always"],
  147. },
  148. "space-before-function-paren": {
  149. options: {
  150. anonymous: "never",
  151. asyncArrow: "always",
  152. constructor: "never",
  153. method: "never",
  154. named: "never",
  155. },
  156. },
  157. "trailing-comma": {
  158. options: {
  159. multiline: "always",
  160. singleline: "never",
  161. },
  162. },
  163. "triple-equals": {
  164. options: ["allow-null-check"],
  165. },
  166. "typedef": false,
  167. "typedef-whitespace": {
  168. options: [
  169. {
  170. "call-signature": "nospace",
  171. "index-signature": "nospace",
  172. "parameter": "nospace",
  173. "property-declaration": "nospace",
  174. "variable-declaration": "nospace",
  175. },
  176. {
  177. "call-signature": "onespace",
  178. "index-signature": "onespace",
  179. "parameter": "onespace",
  180. "property-declaration": "onespace",
  181. "variable-declaration": "onespace",
  182. },
  183. ],
  184. },
  185. "typeof-compare": false,
  186. "unified-signatures": true,
  187. "use-isnan": true,
  188. "variable-name": {
  189. options: [
  190. "ban-keywords",
  191. "check-format",
  192. "allow-pascal-case",
  193. ],
  194. },
  195. "whitespace": {
  196. options: [
  197. "check-branch",
  198. "check-decl",
  199. "check-operator",
  200. "check-separator",
  201. "check-type",
  202. "check-typecast",
  203. ],
  204. },
  205. };
  206. exports.jsRules = {
  207. "align": {
  208. options: [
  209. "parameters",
  210. "statements",
  211. ],
  212. },
  213. "class-name": true,
  214. "curly": true,
  215. "eofline": true,
  216. "forin": true,
  217. "import-spacing": true,
  218. "indent": {
  219. options: ["spaces"],
  220. },
  221. "jsdoc-format": true,
  222. "label-position": true,
  223. "max-line-length": {
  224. options: [120],
  225. },
  226. "new-parens": true,
  227. "no-arg": true,
  228. "no-bitwise": true,
  229. "no-conditional-assignment": true,
  230. "no-consecutive-blank-lines": true,
  231. "no-console": true,
  232. "no-construct": true,
  233. "no-debugger": true,
  234. "no-duplicate-super": true,
  235. "no-duplicate-variable": true,
  236. "no-empty": true,
  237. "no-eval": true,
  238. "no-reference": true,
  239. "no-shadowed-variable": true,
  240. "no-string-literal": true,
  241. "no-string-throw": true,
  242. "no-switch-case-fall-through": false,
  243. "no-trailing-whitespace": true,
  244. "no-unused-expression": true,
  245. // disable this rule as it is very heavy performance-wise and not that useful
  246. "no-use-before-declare": false,
  247. "object-literal-sort-keys": true,
  248. "one-line": {
  249. options: [
  250. "check-catch",
  251. "check-else",
  252. "check-finally",
  253. "check-open-brace",
  254. "check-whitespace",
  255. ],
  256. },
  257. "one-variable-per-declaration": {
  258. options: ["ignore-for-loop"],
  259. },
  260. "quotemark": {
  261. options: [
  262. "double",
  263. "avoid-escape",
  264. ],
  265. },
  266. "radix": true,
  267. "semicolon": {
  268. options: ["always"],
  269. },
  270. "space-before-function-paren": {
  271. options: {
  272. anonymous: "never",
  273. asyncArrow: "always",
  274. constructor: "never",
  275. method: "never",
  276. named: "never",
  277. },
  278. },
  279. "trailing-comma": {
  280. options: {
  281. multiline: "always",
  282. singleline: "never",
  283. },
  284. },
  285. "triple-equals": {
  286. options: ["allow-null-check"],
  287. },
  288. "use-isnan": true,
  289. "variable-name": {
  290. options: [
  291. "ban-keywords",
  292. "check-format",
  293. "allow-pascal-case",
  294. ],
  295. },
  296. "whitespace": {
  297. options: [
  298. "check-branch",
  299. "check-decl",
  300. "check-operator",
  301. "check-separator",
  302. "check-type",
  303. "check-typecast",
  304. ],
  305. },
  306. };