.eslintrc.json 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. {
  2. "root": true,
  3. "extends": [
  4. "plugin:import/errors",
  5. "plugin:import/warnings",
  6. "plugin:unicorn/recommended",
  7. "xo",
  8. "xo/browser"
  9. ],
  10. "rules": {
  11. "arrow-body-style": "off",
  12. "capitalized-comments": "off",
  13. "comma-dangle": [
  14. "error",
  15. "never"
  16. ],
  17. "import/extensions": [
  18. "error",
  19. "ignorePackages",
  20. {
  21. "js": "always"
  22. }
  23. ],
  24. "import/first": "error",
  25. "import/newline-after-import": "error",
  26. "import/no-absolute-path": "error",
  27. "import/no-amd": "error",
  28. "import/no-cycle": [
  29. "error",
  30. {
  31. "ignoreExternal": true
  32. }
  33. ],
  34. "import/no-duplicates": "error",
  35. "import/no-extraneous-dependencies": "error",
  36. "import/no-mutable-exports": "error",
  37. "import/no-named-as-default": "error",
  38. "import/no-named-as-default-member": "error",
  39. "import/no-named-default": "error",
  40. "import/no-self-import": "error",
  41. "import/no-unassigned-import": [
  42. "error"
  43. ],
  44. "import/no-useless-path-segments": "error",
  45. "import/order": "error",
  46. "indent": [
  47. "error",
  48. 2,
  49. {
  50. "MemberExpression": "off",
  51. "SwitchCase": 1
  52. }
  53. ],
  54. "logical-assignment-operators": "off",
  55. "max-params": [
  56. "warn",
  57. 5
  58. ],
  59. "multiline-ternary": [
  60. "error",
  61. "always-multiline"
  62. ],
  63. "new-cap": [
  64. "error",
  65. {
  66. "properties": false
  67. }
  68. ],
  69. "no-console": "error",
  70. "no-negated-condition": "off",
  71. "object-curly-spacing": [
  72. "error",
  73. "always"
  74. ],
  75. "operator-linebreak": [
  76. "error",
  77. "after"
  78. ],
  79. "prefer-object-has-own": "off",
  80. "prefer-template": "error",
  81. "semi": [
  82. "error",
  83. "never"
  84. ],
  85. "strict": "error",
  86. "unicorn/explicit-length-check": "off",
  87. "unicorn/filename-case": "off",
  88. "unicorn/no-anonymous-default-export": "off",
  89. "unicorn/no-array-callback-reference": "off",
  90. "unicorn/no-array-method-this-argument": "off",
  91. "unicorn/no-null": "off",
  92. "unicorn/no-typeof-undefined": "off",
  93. "unicorn/no-unused-properties": "error",
  94. "unicorn/numeric-separators-style": "off",
  95. "unicorn/prefer-array-flat": "off",
  96. "unicorn/prefer-at": "off",
  97. "unicorn/prefer-dom-node-dataset": "off",
  98. "unicorn/prefer-module": "off",
  99. "unicorn/prefer-query-selector": "off",
  100. "unicorn/prefer-spread": "off",
  101. "unicorn/prefer-string-raw": "off",
  102. "unicorn/prefer-string-replace-all": "off",
  103. "unicorn/prefer-structured-clone": "off",
  104. "unicorn/prevent-abbreviations": "off"
  105. },
  106. "overrides": [
  107. {
  108. "files": [
  109. "build/**"
  110. ],
  111. "env": {
  112. "browser": false,
  113. "node": true
  114. },
  115. "parserOptions": {
  116. "sourceType": "module"
  117. },
  118. "rules": {
  119. "no-console": "off",
  120. "unicorn/prefer-top-level-await": "off"
  121. }
  122. },
  123. {
  124. "files": [
  125. "js/**"
  126. ],
  127. "parserOptions": {
  128. "sourceType": "module"
  129. }
  130. },
  131. {
  132. "files": [
  133. "js/tests/*.js",
  134. "js/tests/integration/rollup*.js"
  135. ],
  136. "env": {
  137. "node": true
  138. },
  139. "parserOptions": {
  140. "sourceType": "script"
  141. }
  142. },
  143. {
  144. "files": [
  145. "js/tests/unit/**"
  146. ],
  147. "env": {
  148. "jasmine": true
  149. },
  150. "rules": {
  151. "no-console": "off",
  152. "unicorn/consistent-function-scoping": "off",
  153. "unicorn/no-useless-undefined": "off",
  154. "unicorn/prefer-add-event-listener": "off"
  155. }
  156. },
  157. {
  158. "files": [
  159. "js/tests/visual/**"
  160. ],
  161. "plugins": [
  162. "html"
  163. ],
  164. "settings": {
  165. "html/html-extensions": [
  166. ".html"
  167. ]
  168. },
  169. "rules": {
  170. "no-console": "off",
  171. "no-new": "off",
  172. "unicorn/no-array-for-each": "off"
  173. }
  174. },
  175. {
  176. "files": [
  177. "scss/tests/**"
  178. ],
  179. "env": {
  180. "node": true
  181. },
  182. "parserOptions": {
  183. "sourceType": "script"
  184. }
  185. },
  186. {
  187. "files": [
  188. "site/**"
  189. ],
  190. "env": {
  191. "browser": true,
  192. "node": false
  193. },
  194. "parserOptions": {
  195. "sourceType": "script",
  196. "ecmaVersion": 2019
  197. },
  198. "rules": {
  199. "no-new": "off",
  200. "unicorn/no-array-for-each": "off"
  201. }
  202. },
  203. {
  204. "files": [
  205. "site/src/assets/application.js",
  206. "site/src/assets/partials/*.js",
  207. "site/src/assets/search.js",
  208. "site/src/assets/snippets.js",
  209. "site/src/assets/stackblitz.js",
  210. "site/src/plugins/*.js"
  211. ],
  212. "parserOptions": {
  213. "sourceType": "module",
  214. "ecmaVersion": 2020
  215. }
  216. },
  217. {
  218. "files": [
  219. "**/*.md"
  220. ],
  221. "plugins": [
  222. "markdown"
  223. ],
  224. "processor": "markdown/markdown"
  225. },
  226. {
  227. "files": [
  228. "**/*.md/*.js",
  229. "**/*.md/*.mjs"
  230. ],
  231. "extends": "plugin:markdown/recommended-legacy",
  232. "parserOptions": {
  233. "sourceType": "module"
  234. },
  235. "rules": {
  236. "unicorn/prefer-node-protocol": "off"
  237. }
  238. }
  239. ]
  240. }