@anolilab/eslint-config 5.0.9 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +226 -73
  3. package/dist/chunk-3XUVOUJE.mjs +5 -0
  4. package/dist/chunk-3XUVOUJE.mjs.map +1 -0
  5. package/dist/chunk-6E2RGUNG.js +7 -0
  6. package/dist/chunk-6E2RGUNG.js.map +1 -0
  7. package/dist/chunk-ARKJLBXP.js +7 -0
  8. package/dist/chunk-ARKJLBXP.js.map +1 -0
  9. package/dist/chunk-B7GQAMYJ.js +9 -0
  10. package/dist/chunk-B7GQAMYJ.js.map +1 -0
  11. package/dist/chunk-DJDHW6UR.mjs +5 -0
  12. package/dist/chunk-DJDHW6UR.mjs.map +1 -0
  13. package/dist/chunk-F6JHPR4L.mjs +7 -0
  14. package/dist/chunk-F6JHPR4L.mjs.map +1 -0
  15. package/dist/chunk-G7JIJH44.mjs +5 -0
  16. package/dist/chunk-G7JIJH44.mjs.map +1 -0
  17. package/dist/chunk-NO36P4BR.js +9 -0
  18. package/dist/chunk-NO36P4BR.js.map +1 -0
  19. package/dist/chunk-PCIKFIV2.js +7 -0
  20. package/dist/chunk-PCIKFIV2.js.map +1 -0
  21. package/dist/chunk-RWRS63WY.mjs +7 -0
  22. package/dist/chunk-RWRS63WY.mjs.map +1 -0
  23. package/dist/chunk-SV64EPVP.js +7 -0
  24. package/dist/chunk-SV64EPVP.js.map +1 -0
  25. package/dist/chunk-UJAIXHCQ.js +13 -0
  26. package/dist/chunk-UJAIXHCQ.js.map +1 -0
  27. package/dist/chunk-WDMF75TJ.mjs +5 -0
  28. package/dist/chunk-WDMF75TJ.mjs.map +1 -0
  29. package/dist/chunk-WSETOOIE.mjs +5 -0
  30. package/dist/chunk-WSETOOIE.mjs.map +1 -0
  31. package/dist/chunk-XND2BWC4.mjs +7 -0
  32. package/dist/chunk-XND2BWC4.mjs.map +1 -0
  33. package/dist/chunk-YMWD4DNM.js +8 -0
  34. package/dist/chunk-YMWD4DNM.js.map +1 -0
  35. package/dist/config/best-practices.d.ts +5 -0
  36. package/dist/config/best-practices.js +9 -0
  37. package/dist/config/best-practices.js.map +1 -0
  38. package/dist/config/best-practices.mjs +3 -0
  39. package/dist/config/best-practices.mjs.map +1 -0
  40. package/dist/config/errors.d.ts +5 -0
  41. package/dist/config/errors.js +9 -0
  42. package/dist/config/errors.js.map +1 -0
  43. package/dist/config/errors.mjs +3 -0
  44. package/dist/config/errors.mjs.map +1 -0
  45. package/dist/config/es6.d.ts +5 -0
  46. package/dist/config/es6.js +9 -0
  47. package/dist/config/es6.js.map +1 -0
  48. package/dist/config/es6.mjs +3 -0
  49. package/dist/config/es6.mjs.map +1 -0
  50. package/dist/config/plugins/antfu.d.ts +5 -0
  51. package/dist/config/plugins/antfu.js +10 -0
  52. package/dist/config/plugins/antfu.js.map +1 -0
  53. package/dist/config/plugins/antfu.mjs +8 -0
  54. package/dist/config/plugins/antfu.mjs.map +1 -0
  55. package/dist/config/plugins/array-func.d.ts +5 -0
  56. package/dist/config/plugins/array-func.js +9 -0
  57. package/dist/config/plugins/array-func.js.map +1 -0
  58. package/dist/config/plugins/array-func.mjs +7 -0
  59. package/dist/config/plugins/array-func.mjs.map +1 -0
  60. package/dist/config/plugins/ava.d.ts +5 -0
  61. package/dist/config/plugins/ava.js +7 -0
  62. package/dist/config/plugins/ava.js.map +1 -0
  63. package/dist/config/plugins/ava.mjs +5 -0
  64. package/dist/config/plugins/ava.mjs.map +1 -0
  65. package/dist/config/plugins/babel.d.ts +5 -0
  66. package/dist/config/plugins/babel.js +12 -0
  67. package/dist/config/plugins/babel.js.map +1 -0
  68. package/dist/config/plugins/babel.mjs +10 -0
  69. package/dist/config/plugins/babel.mjs.map +1 -0
  70. package/dist/config/plugins/compat.d.ts +5 -0
  71. package/dist/config/plugins/compat.js +7 -0
  72. package/dist/config/plugins/compat.js.map +1 -0
  73. package/dist/config/plugins/compat.mjs +5 -0
  74. package/dist/config/plugins/compat.mjs.map +1 -0
  75. package/dist/config/plugins/cypress.d.ts +5 -0
  76. package/dist/config/plugins/cypress.js +7 -0
  77. package/dist/config/plugins/cypress.js.map +1 -0
  78. package/dist/config/plugins/cypress.mjs +5 -0
  79. package/dist/config/plugins/cypress.mjs.map +1 -0
  80. package/dist/config/plugins/es.d.ts +5 -0
  81. package/dist/config/plugins/es.js +7 -0
  82. package/dist/config/plugins/es.js.map +1 -0
  83. package/dist/config/plugins/es.mjs +5 -0
  84. package/dist/config/plugins/es.mjs.map +1 -0
  85. package/dist/config/plugins/eslint-comments.d.ts +5 -0
  86. package/dist/config/plugins/eslint-comments.js +7 -0
  87. package/dist/config/plugins/eslint-comments.js.map +1 -0
  88. package/dist/config/plugins/eslint-comments.mjs +5 -0
  89. package/dist/config/plugins/eslint-comments.mjs.map +1 -0
  90. package/dist/config/plugins/html.d.ts +5 -0
  91. package/dist/config/plugins/html.js +7 -0
  92. package/dist/config/plugins/html.js.map +1 -0
  93. package/dist/config/plugins/html.mjs +5 -0
  94. package/dist/config/plugins/html.mjs.map +1 -0
  95. package/dist/config/plugins/import.d.ts +5 -0
  96. package/dist/config/plugins/import.js +9 -0
  97. package/dist/config/plugins/import.js.map +1 -0
  98. package/dist/config/plugins/import.mjs +3 -0
  99. package/dist/config/plugins/import.mjs.map +1 -0
  100. package/dist/config/plugins/jest-async.d.ts +5 -0
  101. package/dist/config/plugins/jest-async.js +7 -0
  102. package/dist/config/plugins/jest-async.js.map +1 -0
  103. package/dist/config/plugins/jest-async.mjs +5 -0
  104. package/dist/config/plugins/jest-async.mjs.map +1 -0
  105. package/dist/config/plugins/jest-dom.d.ts +5 -0
  106. package/dist/config/plugins/jest-dom.js +7 -0
  107. package/dist/config/plugins/jest-dom.js.map +1 -0
  108. package/dist/config/plugins/jest-dom.mjs +5 -0
  109. package/dist/config/plugins/jest-dom.mjs.map +1 -0
  110. package/dist/config/plugins/jest-formatting.d.ts +5 -0
  111. package/dist/config/plugins/jest-formatting.js +7 -0
  112. package/dist/config/plugins/jest-formatting.js.map +1 -0
  113. package/dist/config/plugins/jest-formatting.mjs +5 -0
  114. package/dist/config/plugins/jest-formatting.mjs.map +1 -0
  115. package/dist/config/plugins/jest.d.ts +5 -0
  116. package/dist/config/plugins/jest.js +7 -0
  117. package/dist/config/plugins/jest.js.map +1 -0
  118. package/dist/config/plugins/jest.mjs +5 -0
  119. package/dist/config/plugins/jest.mjs.map +1 -0
  120. package/dist/config/plugins/jsdoc.d.ts +5 -0
  121. package/dist/config/plugins/jsdoc.js +11 -0
  122. package/dist/config/plugins/jsdoc.js.map +1 -0
  123. package/dist/config/plugins/jsdoc.mjs +9 -0
  124. package/dist/config/plugins/jsdoc.mjs.map +1 -0
  125. package/dist/config/plugins/jsonc.d.ts +5 -0
  126. package/dist/config/plugins/jsonc.js +11 -0
  127. package/dist/config/plugins/jsonc.js.map +1 -0
  128. package/dist/config/plugins/jsonc.mjs +9 -0
  129. package/dist/config/plugins/jsonc.mjs.map +1 -0
  130. package/dist/config/plugins/jsx-a11y.d.ts +5 -0
  131. package/dist/config/plugins/jsx-a11y.js +7 -0
  132. package/dist/config/plugins/jsx-a11y.js.map +1 -0
  133. package/dist/config/plugins/jsx-a11y.mjs +5 -0
  134. package/dist/config/plugins/jsx-a11y.mjs.map +1 -0
  135. package/dist/config/plugins/lodash-fp.d.ts +5 -0
  136. package/dist/config/plugins/lodash-fp.js +7 -0
  137. package/dist/config/plugins/lodash-fp.js.map +1 -0
  138. package/dist/config/plugins/lodash-fp.mjs +5 -0
  139. package/dist/config/plugins/lodash-fp.mjs.map +1 -0
  140. package/dist/config/plugins/lodash.d.ts +5 -0
  141. package/dist/config/plugins/lodash.js +7 -0
  142. package/dist/config/plugins/lodash.js.map +1 -0
  143. package/dist/config/plugins/lodash.mjs +5 -0
  144. package/dist/config/plugins/lodash.mjs.map +1 -0
  145. package/dist/config/plugins/markdown.d.ts +5 -0
  146. package/dist/config/plugins/markdown.js +7 -0
  147. package/dist/config/plugins/markdown.js.map +1 -0
  148. package/dist/config/plugins/markdown.mjs +5 -0
  149. package/dist/config/plugins/markdown.mjs.map +1 -0
  150. package/dist/config/plugins/mdx.d.ts +5 -0
  151. package/dist/config/plugins/mdx.js +7 -0
  152. package/dist/config/plugins/mdx.js.map +1 -0
  153. package/dist/config/plugins/mdx.mjs +5 -0
  154. package/dist/config/plugins/mdx.mjs.map +1 -0
  155. package/dist/config/plugins/no-extend-native.d.ts +5 -0
  156. package/dist/config/plugins/no-extend-native.js +7 -0
  157. package/dist/config/plugins/no-extend-native.js.map +1 -0
  158. package/dist/config/plugins/no-extend-native.mjs +5 -0
  159. package/dist/config/plugins/no-extend-native.mjs.map +1 -0
  160. package/dist/config/plugins/no-loops.d.ts +5 -0
  161. package/dist/config/plugins/no-loops.js +7 -0
  162. package/dist/config/plugins/no-loops.js.map +1 -0
  163. package/dist/config/plugins/no-loops.mjs +5 -0
  164. package/dist/config/plugins/no-loops.mjs.map +1 -0
  165. package/dist/config/plugins/no-secrets.d.ts +5 -0
  166. package/dist/config/plugins/no-secrets.js +7 -0
  167. package/dist/config/plugins/no-secrets.js.map +1 -0
  168. package/dist/config/plugins/no-secrets.mjs +5 -0
  169. package/dist/config/plugins/no-secrets.mjs.map +1 -0
  170. package/dist/config/plugins/no-unsanitized.d.ts +5 -0
  171. package/dist/config/plugins/no-unsanitized.js +7 -0
  172. package/dist/config/plugins/no-unsanitized.js.map +1 -0
  173. package/dist/config/plugins/no-unsanitized.mjs +5 -0
  174. package/dist/config/plugins/no-unsanitized.mjs.map +1 -0
  175. package/dist/config/plugins/node.d.ts +5 -0
  176. package/dist/config/plugins/node.js +9 -0
  177. package/dist/config/plugins/node.js.map +1 -0
  178. package/dist/config/plugins/node.mjs +7 -0
  179. package/dist/config/plugins/node.mjs.map +1 -0
  180. package/dist/config/plugins/optimize-regex.d.ts +5 -0
  181. package/dist/config/plugins/optimize-regex.js +7 -0
  182. package/dist/config/plugins/optimize-regex.js.map +1 -0
  183. package/dist/config/plugins/optimize-regex.mjs +5 -0
  184. package/dist/config/plugins/optimize-regex.mjs.map +1 -0
  185. package/dist/config/plugins/promise.d.ts +5 -0
  186. package/dist/config/plugins/promise.js +7 -0
  187. package/dist/config/plugins/promise.js.map +1 -0
  188. package/dist/config/plugins/promise.mjs +5 -0
  189. package/dist/config/plugins/promise.mjs.map +1 -0
  190. package/dist/config/plugins/react-hooks.d.ts +5 -0
  191. package/dist/config/plugins/react-hooks.js +7 -0
  192. package/dist/config/plugins/react-hooks.js.map +1 -0
  193. package/dist/config/plugins/react-hooks.mjs +5 -0
  194. package/dist/config/plugins/react-hooks.mjs.map +1 -0
  195. package/dist/config/plugins/react-redux.d.ts +5 -0
  196. package/dist/config/plugins/react-redux.js +7 -0
  197. package/dist/config/plugins/react-redux.js.map +1 -0
  198. package/dist/config/plugins/react-redux.mjs +5 -0
  199. package/dist/config/plugins/react-redux.mjs.map +1 -0
  200. package/dist/config/plugins/react.d.ts +5 -0
  201. package/dist/config/plugins/react.js +21 -0
  202. package/dist/config/plugins/react.js.map +1 -0
  203. package/dist/config/plugins/react.mjs +15 -0
  204. package/dist/config/plugins/react.mjs.map +1 -0
  205. package/dist/config/plugins/security.d.ts +5 -0
  206. package/dist/config/plugins/security.js +7 -0
  207. package/dist/config/plugins/security.js.map +1 -0
  208. package/dist/config/plugins/security.mjs +5 -0
  209. package/dist/config/plugins/security.mjs.map +1 -0
  210. package/dist/config/plugins/simple-import-sort.d.ts +5 -0
  211. package/dist/config/plugins/simple-import-sort.js +7 -0
  212. package/dist/config/plugins/simple-import-sort.js.map +1 -0
  213. package/dist/config/plugins/simple-import-sort.mjs +5 -0
  214. package/dist/config/plugins/simple-import-sort.mjs.map +1 -0
  215. package/dist/config/plugins/sonarjs.d.ts +5 -0
  216. package/dist/config/plugins/sonarjs.js +7 -0
  217. package/dist/config/plugins/sonarjs.js.map +1 -0
  218. package/dist/config/plugins/sonarjs.mjs +5 -0
  219. package/dist/config/plugins/sonarjs.mjs.map +1 -0
  220. package/dist/config/plugins/sort-keys-fix.d.ts +5 -0
  221. package/dist/config/plugins/sort-keys-fix.js +7 -0
  222. package/dist/config/plugins/sort-keys-fix.js.map +1 -0
  223. package/dist/config/plugins/sort-keys-fix.mjs +5 -0
  224. package/dist/config/plugins/sort-keys-fix.mjs.map +1 -0
  225. package/dist/config/plugins/tailwindcss.d.ts +5 -0
  226. package/dist/config/plugins/tailwindcss.js +7 -0
  227. package/dist/config/plugins/tailwindcss.js.map +1 -0
  228. package/dist/config/plugins/tailwindcss.mjs +5 -0
  229. package/dist/config/plugins/tailwindcss.mjs.map +1 -0
  230. package/dist/config/plugins/testing-library.d.ts +5 -0
  231. package/dist/config/plugins/testing-library.js +10 -0
  232. package/dist/config/plugins/testing-library.js.map +1 -0
  233. package/dist/config/plugins/testing-library.mjs +8 -0
  234. package/dist/config/plugins/testing-library.mjs.map +1 -0
  235. package/dist/config/plugins/toml.d.ts +5 -0
  236. package/dist/config/plugins/toml.js +7 -0
  237. package/dist/config/plugins/toml.js.map +1 -0
  238. package/dist/config/plugins/toml.mjs +5 -0
  239. package/dist/config/plugins/toml.mjs.map +1 -0
  240. package/dist/config/plugins/tsdoc.d.ts +5 -0
  241. package/dist/config/plugins/tsdoc.js +9 -0
  242. package/dist/config/plugins/tsdoc.js.map +1 -0
  243. package/dist/config/plugins/tsdoc.mjs +7 -0
  244. package/dist/config/plugins/tsdoc.mjs.map +1 -0
  245. package/dist/config/plugins/typescript-sort-keys.d.ts +5 -0
  246. package/dist/config/plugins/typescript-sort-keys.js +7 -0
  247. package/dist/config/plugins/typescript-sort-keys.js.map +1 -0
  248. package/dist/config/plugins/typescript-sort-keys.mjs +5 -0
  249. package/dist/config/plugins/typescript-sort-keys.mjs.map +1 -0
  250. package/dist/config/plugins/typescript.d.ts +5 -0
  251. package/dist/config/plugins/typescript.js +18 -0
  252. package/dist/config/plugins/typescript.js.map +1 -0
  253. package/dist/config/plugins/typescript.mjs +16 -0
  254. package/dist/config/plugins/typescript.mjs.map +1 -0
  255. package/dist/config/plugins/unicorn.d.ts +5 -0
  256. package/dist/config/plugins/unicorn.js +15 -0
  257. package/dist/config/plugins/unicorn.js.map +1 -0
  258. package/dist/config/plugins/unicorn.mjs +9 -0
  259. package/dist/config/plugins/unicorn.mjs.map +1 -0
  260. package/dist/config/plugins/vitest.d.ts +5 -0
  261. package/dist/config/plugins/vitest.js +7 -0
  262. package/dist/config/plugins/vitest.js.map +1 -0
  263. package/dist/config/plugins/vitest.mjs +5 -0
  264. package/dist/config/plugins/vitest.mjs.map +1 -0
  265. package/dist/config/plugins/yml.d.ts +5 -0
  266. package/dist/config/plugins/yml.js +7 -0
  267. package/dist/config/plugins/yml.js.map +1 -0
  268. package/dist/config/plugins/yml.mjs +5 -0
  269. package/dist/config/plugins/yml.mjs.map +1 -0
  270. package/dist/config/plugins/you-dont-need-lodash-underscore.d.ts +5 -0
  271. package/dist/config/plugins/you-dont-need-lodash-underscore.js +7 -0
  272. package/dist/config/plugins/you-dont-need-lodash-underscore.js.map +1 -0
  273. package/dist/config/plugins/you-dont-need-lodash-underscore.mjs +5 -0
  274. package/dist/config/plugins/you-dont-need-lodash-underscore.mjs.map +1 -0
  275. package/dist/config/plugins/you-dont-need-momentjs.d.ts +5 -0
  276. package/dist/config/plugins/you-dont-need-momentjs.js +7 -0
  277. package/dist/config/plugins/you-dont-need-momentjs.js.map +1 -0
  278. package/dist/config/plugins/you-dont-need-momentjs.mjs +5 -0
  279. package/dist/config/plugins/you-dont-need-momentjs.mjs.map +1 -0
  280. package/dist/config/plugins/zod.d.ts +5 -0
  281. package/dist/config/plugins/zod.js +7 -0
  282. package/dist/config/plugins/zod.js.map +1 -0
  283. package/dist/config/plugins/zod.mjs +5 -0
  284. package/dist/config/plugins/zod.mjs.map +1 -0
  285. package/dist/config/style.d.ts +5 -0
  286. package/dist/config/style.js +9 -0
  287. package/dist/config/style.js.map +1 -0
  288. package/dist/config/style.mjs +3 -0
  289. package/dist/config/style.mjs.map +1 -0
  290. package/dist/config/variables.d.ts +5 -0
  291. package/dist/config/variables.js +9 -0
  292. package/dist/config/variables.js.map +1 -0
  293. package/dist/config/variables.mjs +3 -0
  294. package/dist/config/variables.mjs.map +1 -0
  295. package/dist/index.d.ts +5 -0
  296. package/dist/index.js +22 -0
  297. package/dist/index.js.map +1 -0
  298. package/dist/index.mjs +16 -0
  299. package/dist/index.mjs.map +1 -0
  300. package/dist/postinstall.d.ts +2 -0
  301. package/dist/postinstall.js +65 -0
  302. package/dist/postinstall.js.map +1 -0
  303. package/dist/postinstall.mjs +63 -0
  304. package/dist/postinstall.mjs.map +1 -0
  305. package/dist/typescript-type-checking.d.ts +5 -0
  306. package/dist/typescript-type-checking.js +10 -0
  307. package/dist/typescript-type-checking.js.map +1 -0
  308. package/dist/typescript-type-checking.mjs +8 -0
  309. package/dist/typescript-type-checking.mjs.map +1 -0
  310. package/package.json +106 -50
  311. package/config.cjs +0 -88
  312. package/index.cjs +0 -58
  313. package/lib/check-missing.cjs +0 -57
  314. package/lib/is-module-available.cjs +0 -8
  315. package/lib/loggers.cjs +0 -12
  316. package/lib/postinstall.cjs +0 -115
  317. package/lib/show-loaded.cjs +0 -21
  318. package/lib/utils.cjs +0 -90
  319. package/rules/best-practices.cjs +0 -395
  320. package/rules/errors.cjs +0 -177
  321. package/rules/es6.cjs +0 -217
  322. package/rules/plugins/array-func.cjs +0 -13
  323. package/rules/plugins/babel.cjs +0 -36
  324. package/rules/plugins/compat.cjs +0 -3
  325. package/rules/plugins/cypress.cjs +0 -13
  326. package/rules/plugins/eslint-comments.cjs +0 -11
  327. package/rules/plugins/html.cjs +0 -3
  328. package/rules/plugins/import.cjs +0 -265
  329. package/rules/plugins/jest-async.cjs +0 -6
  330. package/rules/plugins/jest-dom.cjs +0 -3
  331. package/rules/plugins/jest-formatting.cjs +0 -3
  332. package/rules/plugins/jest.cjs +0 -43
  333. package/rules/plugins/jsdoc.cjs +0 -4
  334. package/rules/plugins/json.cjs +0 -40
  335. package/rules/plugins/jsonc.cjs +0 -70
  336. package/rules/plugins/jsx-a11y.cjs +0 -261
  337. package/rules/plugins/lodash-fp.cjs +0 -7
  338. package/rules/plugins/lodash.cjs +0 -52
  339. package/rules/plugins/markdown.cjs +0 -32
  340. package/rules/plugins/mdx.cjs +0 -4
  341. package/rules/plugins/no-loops.cjs +0 -7
  342. package/rules/plugins/no-secrets.cjs +0 -20
  343. package/rules/plugins/no-unsanitized.cjs +0 -8
  344. package/rules/plugins/node.cjs +0 -44
  345. package/rules/plugins/optimize-regex.cjs +0 -6
  346. package/rules/plugins/promise.cjs +0 -9
  347. package/rules/plugins/react-hooks.cjs +0 -20
  348. package/rules/plugins/react-redux.cjs +0 -9
  349. package/rules/plugins/react.cjs +0 -659
  350. package/rules/plugins/simple-import-sort.cjs +0 -10
  351. package/rules/plugins/sonarjs.cjs +0 -5
  352. package/rules/plugins/sort-keys-fix.cjs +0 -6
  353. package/rules/plugins/tailwindcss.cjs +0 -4
  354. package/rules/plugins/testing-library.cjs +0 -34
  355. package/rules/plugins/toml.cjs +0 -9
  356. package/rules/plugins/typescript-sort-keys.cjs +0 -19
  357. package/rules/plugins/typescript.cjs +0 -427
  358. package/rules/plugins/unicorn.cjs +0 -20
  359. package/rules/plugins/yml.cjs +0 -12
  360. package/rules/plugins/you-dont-need-lodash-underscore.cjs +0 -3
  361. package/rules/plugins/you-dont-need-momentjs.cjs +0 -3
  362. package/rules/style.cjs +0 -629
  363. package/rules/variables.cjs +0 -54
@@ -1,659 +0,0 @@
1
- // @see https://github.com/yannickcr/eslint-plugin-react
2
- const assign = require("object.assign");
3
- const findUp = require("find-up");
4
- const { hasAnyDep } = require("../../lib/utils.cjs");
5
- const { rules: baseStyleRules } = require("../style.cjs");
6
-
7
- const dangleRules = baseStyleRules["no-underscore-dangle"];
8
-
9
- let prettierReactRules = {};
10
-
11
- if (hasAnyDep("react")) {
12
- prettierReactRules = {
13
- "react/jsx-indent": "off",
14
- "react/jsx-closing-tag-location": "off",
15
- "react/jsx-closing-bracket-location": "off",
16
- "react/jsx-curly-spacing": "off",
17
- "react/jsx-equals-spacing": "off",
18
- "react/jsx-first-prop-new-line": "off",
19
- "react/jsx-indent-props": "off",
20
- "react/jsx-max-props-per-line": "off",
21
- "react/jsx-tag-spacing": "off",
22
- "react/jsx-wrap-multilines": "off",
23
- "react/prefer-stateless-function": "off",
24
- "react/jsx-one-expression-per-line": "off",
25
- "react/jsx-props-no-multi-spaces": "off",
26
- };
27
- }
28
-
29
- const hasJsxRuntime = (() => {
30
- // Workaround VS Code trying to run this file twice!
31
- if (!global.AnolilabEsLintConfigReactRuntimePath) {
32
- const reactPath = findUp.sync("node_modules/react/jsx-runtime.js");
33
-
34
- // eslint-disable-next-line no-undef
35
- if (process.env.NO_LOGS && process.env.NO_LOGS !== "true" && typeof reactPath === "string") {
36
- console.info(`\n@anolilab/eslint-config found react jsx-runtime. \n
37
- Following rules are disabled: "react/jsx-uses-react" and "react/react-in-jsx-scope".
38
- If you dont use the new react jsx-runtime in you project, please enable it manually.\n`);
39
- }
40
-
41
- global.AnolilabEsLintConfigReactRuntimePath = typeof reactPath === "string";
42
- }
43
-
44
- return global.AnolilabEsLintConfigReactRuntimePath;
45
- })();
46
-
47
- module.exports = {
48
- plugins: ["react"],
49
-
50
- parserOptions: {
51
- ecmaFeatures: {
52
- jsx: true,
53
- },
54
- },
55
-
56
- // View link below for react rules documentation
57
- // https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
58
- rules: {
59
- "no-underscore-dangle": [
60
- dangleRules[0],
61
- assign({}, dangleRules[1], {
62
- allow: [...dangleRules[1].allow, "__REDUX_DEVTOOLS_EXTENSION_COMPOSE__"],
63
- }),
64
- ],
65
-
66
- // Specify whether double or single quotes should be used in JSX attributes
67
- // https://eslint.org/docs/rules/jsx-quotes
68
- "jsx-quotes": ["error", "prefer-double"],
69
-
70
- "class-methods-use-this": [
71
- "error",
72
- {
73
- exceptMethods: [
74
- "render",
75
- "getInitialState",
76
- "getDefaultProps",
77
- "getChildContext",
78
- "componentWillMount",
79
- "UNSAFE_componentWillMount",
80
- "componentDidMount",
81
- "componentWillReceiveProps",
82
- "UNSAFE_componentWillReceiveProps",
83
- "shouldComponentUpdate",
84
- "componentWillUpdate",
85
- "UNSAFE_componentWillUpdate",
86
- "componentDidUpdate",
87
- "componentWillUnmount",
88
- "componentDidCatch",
89
- "getSnapshotBeforeUpdate",
90
- ],
91
- },
92
- ],
93
-
94
- // Prevent missing displayName in a React component definition
95
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
96
- "react/display-name": ["off", { ignoreTranspilerName: false }],
97
-
98
- // Forbid certain propTypes (any, array, object)
99
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-prop-types.md
100
- "react/forbid-prop-types": [
101
- "error",
102
- {
103
- forbid: ["any", "array", "object"],
104
- checkContextTypes: true,
105
- checkChildContextTypes: true,
106
- },
107
- ],
108
-
109
- // Forbid certain props on DOM Nodes
110
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-dom-props.md
111
- "react/forbid-dom-props": ["off", { forbid: [] }],
112
-
113
- // Enforce boolean attributes notation in JSX
114
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
115
- "react/jsx-boolean-value": ["error", "never", { always: [] }],
116
-
117
- // Validate closing bracket location in JSX
118
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
119
- "react/jsx-closing-bracket-location": ["error", "line-aligned"],
120
-
121
- // Validate closing tag location in JSX
122
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
123
- "react/jsx-closing-tag-location": "error",
124
-
125
- // Enforce or disallow spaces inside of curly braces in JSX attributes
126
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
127
- "react/jsx-curly-spacing": ["error", "never", { allowMultiline: true }],
128
-
129
- // Enforce event handler naming conventions in JSX
130
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
131
- "react/jsx-handler-names": [
132
- "off",
133
- {
134
- eventHandlerPrefix: "handle",
135
- eventHandlerPropPrefix: "on",
136
- },
137
- ],
138
-
139
- // Validate props indentation in JSX
140
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
141
- "react/jsx-indent-props": ["error", 2],
142
-
143
- // Validate JSX has key prop when in array or iterator
144
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
145
- "react/jsx-key": "off",
146
-
147
- // Limit maximum of props on a single line in JSX
148
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
149
- "react/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
150
-
151
- // Prevent usage of .bind() in JSX props
152
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
153
- "react/jsx-no-bind": [
154
- "error",
155
- {
156
- ignoreRefs: true,
157
- allowArrowFunctions: true,
158
- allowFunctions: false,
159
- allowBind: false,
160
- ignoreDOMComponents: true,
161
- },
162
- ],
163
-
164
- // Prevent duplicate props in JSX
165
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
166
- "react/jsx-no-duplicate-props": ["error", { ignoreCase: true }],
167
-
168
- // Prevent usage of unwrapped JSX strings
169
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
170
- "react/jsx-no-literals": ["off", { noStrings: true }],
171
-
172
- // Disallow undeclared variables in JSX
173
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
174
- "react/jsx-no-undef": "error",
175
-
176
- // Enforce PascalCase for user-defined JSX components
177
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
178
- "react/jsx-pascal-case": [
179
- "error",
180
- {
181
- allowAllCaps: true,
182
- ignore: [],
183
- },
184
- ],
185
-
186
- // Enforce propTypes declarations alphabetical sorting
187
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
188
- "react/sort-prop-types": [
189
- "off",
190
- {
191
- ignoreCase: true,
192
- callbacksLast: false,
193
- requiredFirst: false,
194
- sortShapeProp: true,
195
- },
196
- ],
197
-
198
- // Deprecated in favor of react/jsx-sort-props
199
- "react/jsx-sort-prop-types": "off",
200
-
201
- // Enforce props alphabetical sorting
202
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
203
- "react/jsx-sort-props": [
204
- "off",
205
- {
206
- ignoreCase: true,
207
- callbacksLast: false,
208
- shorthandFirst: false,
209
- shorthandLast: false,
210
- noSortAlphabetically: false,
211
- reservedFirst: true,
212
- },
213
- ],
214
-
215
- // Enforce defaultProps declarations alphabetical sorting
216
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md
217
- "react/jsx-sort-default-props": [
218
- "off",
219
- {
220
- ignoreCase: true,
221
- },
222
- ],
223
-
224
- // Prevent React to be incorrectly marked as unused
225
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
226
- "react/jsx-uses-react": [hasJsxRuntime ? "off" : "error"],
227
-
228
- // Prevent variables used in JSX to be incorrectly marked as unused
229
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
230
- "react/jsx-uses-vars": "error",
231
-
232
- // Prevent usage of dangerous JSX properties
233
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
234
- "react/no-danger": "warn",
235
-
236
- // Prevent usage of deprecated methods
237
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
238
- "react/no-deprecated": ["error"],
239
-
240
- // Prevent usage of setState in componentDidMount
241
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
242
- // this is necessary for server-rendering
243
- "react/no-did-mount-set-state": "off",
244
-
245
- // Prevent usage of setState in componentDidUpdate
246
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
247
- "react/no-did-update-set-state": "error",
248
-
249
- // Prevent usage of setState in componentWillUpdate
250
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
251
- "react/no-will-update-set-state": "error",
252
-
253
- // Prevent direct mutation of this.state
254
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
255
- "react/no-direct-mutation-state": "off",
256
-
257
- // Prevent usage of isMounted
258
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
259
- "react/no-is-mounted": "error",
260
-
261
- // Prevent multiple component definition per file
262
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
263
- "react/no-multi-comp": "off",
264
-
265
- // Prevent usage of setState
266
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
267
- "react/no-set-state": "off",
268
-
269
- // Prevent using string references
270
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
271
- "react/no-string-refs": "error",
272
-
273
- // Prevent usage of unknown DOM property
274
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
275
- "react/no-unknown-property": "error",
276
-
277
- // Require ES6 class declarations over React.createClass
278
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
279
- "react/prefer-es6-class": ["error", "always"],
280
-
281
- // Require stateless functions when not using lifecycle methods, setState or ref
282
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
283
- "react/prefer-stateless-function": ["error", { ignorePureComponents: true }],
284
-
285
- // Prevent missing props validation in a React component definition
286
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
287
- "react/prop-types": [
288
- "error",
289
- {
290
- ignore: [],
291
- customValidators: [],
292
- skipUndeclared: false,
293
- },
294
- ],
295
-
296
- // Prevent missing React when using JSX
297
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
298
- "react/react-in-jsx-scope": hasJsxRuntime ? "off" : "error",
299
-
300
- // Require render() methods to return something
301
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
302
- "react/require-render-return": "error",
303
-
304
- // Prevent extra closing tags for components without children
305
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
306
- "react/self-closing-comp": "error",
307
-
308
- // Enforce component methods order
309
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
310
- "react/sort-comp": [
311
- "error",
312
- {
313
- order: [
314
- "static-variables",
315
- "static-methods",
316
- "instance-variables",
317
- "lifecycle",
318
- "/^handle.+$/",
319
- "/^on.+$/",
320
- "getters",
321
- "setters",
322
- "/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/",
323
- "instance-methods",
324
- "everything-else",
325
- "rendering",
326
- ],
327
- groups: {
328
- lifecycle: [
329
- "displayName",
330
- "propTypes",
331
- "contextTypes",
332
- "childContextTypes",
333
- "mixins",
334
- "statics",
335
- "defaultProps",
336
- "constructor",
337
- "getDefaultProps",
338
- "getInitialState",
339
- "state",
340
- "getChildContext",
341
- "getDerivedStateFromProps",
342
- "componentWillMount",
343
- "UNSAFE_componentWillMount",
344
- "componentDidMount",
345
- "componentWillReceiveProps",
346
- "UNSAFE_componentWillReceiveProps",
347
- "shouldComponentUpdate",
348
- "componentWillUpdate",
349
- "UNSAFE_componentWillUpdate",
350
- "getSnapshotBeforeUpdate",
351
- "componentDidUpdate",
352
- "componentDidCatch",
353
- "componentWillUnmount",
354
- ],
355
- rendering: ["/^render.+$/", "render"],
356
- },
357
- },
358
- ],
359
-
360
- // Prevent missing parentheses around multilines JSX
361
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-wrap-multilines.md
362
- "react/jsx-wrap-multilines": [
363
- "error",
364
- {
365
- // eslint-disable-next-line sonarjs/no-duplicate-string
366
- declaration: "parens-new-line",
367
- assignment: "parens-new-line",
368
- return: "parens-new-line",
369
- arrow: "parens-new-line",
370
- condition: "parens-new-line",
371
- logical: "parens-new-line",
372
- prop: "parens-new-line",
373
- },
374
- ],
375
-
376
- // Require that the first prop in a JSX element be on a new line when the element is multiline
377
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
378
- "react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
379
-
380
- // Enforce spacing around jsx equals signs
381
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
382
- "react/jsx-equals-spacing": ["error", "never"],
383
-
384
- // Enforce JSX indentation
385
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
386
- "react/jsx-indent": ["error", 4, { checkAttributes: true, indentLogicalExpressions: true }],
387
-
388
- // Disallow target="_blank" on links
389
- // https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
390
- "react/jsx-no-target-blank": ["error", { enforceDynamicLinks: "always" }],
391
-
392
- // only .jsx files may have JSX
393
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
394
- "react/jsx-filename-extension": [
395
- "error",
396
- { extensions: [".jsx", ...(hasAnyDep("typescript") ? [".tsx"] : [])] },
397
- ],
398
-
399
- // prevent accidental JS comments from being injected into JSX as text
400
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
401
- "react/jsx-no-comment-textnodes": "error",
402
-
403
- // disallow using React.render/ReactDOM.render's return value
404
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
405
- "react/no-render-return-value": "error",
406
-
407
- // require a shouldComponentUpdate method, or PureRenderMixin
408
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
409
- "react/require-optimization": ["off", { allowDecorators: [] }],
410
-
411
- // warn against using findDOMNode()
412
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
413
- "react/no-find-dom-node": "error",
414
-
415
- // Forbid certain props on Components
416
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
417
- "react/forbid-component-props": ["off", { forbid: [] }],
418
-
419
- // Forbid certain elements
420
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
421
- "react/forbid-elements": ["off", { forbid: [] }],
422
-
423
- // Prevent problem with children and props.dangerouslySetInnerHTML
424
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
425
- "react/no-danger-with-children": "error",
426
-
427
- // Prevent unused propType definitions
428
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
429
- "react/no-unused-prop-types": [
430
- "error",
431
- {
432
- customValidators: [],
433
- skipShapeProps: true,
434
- },
435
- ],
436
-
437
- // Require style prop value be an object or var
438
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
439
- "react/style-prop-object": "error",
440
-
441
- // Prevent invalid characters from appearing in markup
442
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
443
- "react/no-unescaped-entities": "error",
444
-
445
- // Prevent passing of children as props
446
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
447
- "react/no-children-prop": "error",
448
-
449
- // Validate whitespace in and around the JSX opening and closing brackets
450
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
451
- "react/jsx-tag-spacing": [
452
- "error",
453
- {
454
- closingSlash: "never",
455
- beforeSelfClosing: "always",
456
- afterOpening: "never",
457
- beforeClosing: "never",
458
- },
459
- ],
460
-
461
- // Enforce spaces before the closing bracket of self-closing JSX elements
462
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
463
- // Deprecated in favor of jsx-tag-spacing
464
- "react/jsx-space-before-closing": ["off", "always"],
465
-
466
- // Prevent usage of Array index in keys
467
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
468
- "react/no-array-index-key": "error",
469
-
470
- // Enforce a defaultProps definition for every prop that is not a required prop
471
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/require-default-props.md
472
- "react/require-default-props": [
473
- "error",
474
- {
475
- forbidDefaultForRequired: true,
476
- },
477
- ],
478
-
479
- // Forbids using non-exported propTypes
480
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
481
- // this is intentionally set to "warn". it would be "error",
482
- // but it's only critical if you're stripping propTypes in production.
483
- "react/forbid-foreign-prop-types": ["warn", { allowInPropTypes: true }],
484
-
485
- // Prevent void DOM elements from receiving children
486
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
487
- "react/void-dom-elements-no-children": "error",
488
-
489
- // Enforce all defaultProps have a corresponding non-required PropType
490
- // https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/default-props-match-prop-types.md
491
- "react/default-props-match-prop-types": ["error", { allowRequiredDefaults: false }],
492
-
493
- // Prevent usage of shouldComponentUpdate when extending React.PureComponent
494
- // https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/no-redundant-should-component-update.md
495
- "react/no-redundant-should-component-update": "error",
496
-
497
- // Prevent unused state values
498
- // https://github.com/yannickcr/eslint-plugin-react/pull/1103/
499
- "react/no-unused-state": "error",
500
-
501
- // Enforces consistent naming for boolean props
502
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md
503
- "react/boolean-prop-naming": [
504
- "off",
505
- {
506
- propTypeNames: ["bool", "mutuallyExclusiveTrueProps"],
507
- rule: "^(is|has)[A-Z]([A-Za-z0-9]?)+",
508
- message: "",
509
- },
510
- ],
511
-
512
- // Prevents common casing typos
513
- // https://github.com/yannickcr/eslint-plugin-react/blob/73abadb697034b5ccb514d79fb4689836fe61f91/docs/rules/no-typos.md
514
- "react/no-typos": "error",
515
-
516
- // Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
517
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
518
- "react/jsx-curly-brace-presence": ["error", { props: "never", children: "never" }],
519
-
520
- // One JSX Element Per Line
521
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-one-expression-per-line.md
522
- "react/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
523
-
524
- // Enforce consistent usage of destructuring assignment of props, state, and context
525
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
526
- "react/destructuring-assignment": ["error", "always"],
527
-
528
- // Prevent using this.state within a this.setState
529
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-access-state-in-setstate.md
530
- "react/no-access-state-in-setstate": "error",
531
-
532
- // Prevent usage of button elements without an explicit type attribute
533
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/button-has-type.md
534
- "react/button-has-type": [
535
- "error",
536
- {
537
- button: true,
538
- submit: true,
539
- reset: false,
540
- },
541
- ],
542
-
543
- // Ensures inline tags are not rendered without spaces between them
544
- "react/jsx-child-element-spacing": "off",
545
-
546
- // Prevent this from being used in stateless functional components
547
- // https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-this-in-sfc.md
548
- "react/no-this-in-sfc": "error",
549
-
550
- // Validate JSX maximum depth
551
- // https://github.com/yannickcr/eslint-plugin-react/blob/abe8381c0d6748047224c430ce47f02e40160ed0/docs/rules/jsx-max-depth.md
552
- "react/jsx-max-depth": "off",
553
-
554
- // Disallow multiple spaces between inline JSX props
555
- // https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-props-no-multi-spaces.md
556
- "react/jsx-props-no-multi-spaces": "error",
557
-
558
- // Prevent usage of UNSAFE_ methods
559
- // https://github.com/yannickcr/eslint-plugin-react/blob/157cc932be2cfaa56b3f5b45df6f6d4322a2f660/docs/rules/no-unsafe.md
560
- "react/no-unsafe": "off",
561
-
562
- // Enforce shorthand or standard form for React fragments
563
- // https://github.com/yannickcr/eslint-plugin-react/blob/bc976b837abeab1dffd90ac6168b746a83fc83cc/docs/rules/jsx-fragments.md
564
- "react/jsx-fragments": ["error", "syntax"],
565
-
566
- // Enforce linebreaks in curly braces in JSX attributes and expressions.
567
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
568
- "react/jsx-curly-newline": [
569
- "error",
570
- {
571
- multiline: "consistent",
572
- singleline: "consistent",
573
- },
574
- ],
575
-
576
- // Enforce state initialization style
577
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
578
- // TODO: set to "never" once @anolilab/babel-preset supports public class fields
579
- "react/state-in-constructor": ["error", "always"],
580
-
581
- // Enforces where React component static properties should be positioned
582
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
583
- // TODO: set to "static public field" once @anolilab/babel-preset supports public class fields
584
- "react/static-property-placement": ["error", "property assignment"],
585
-
586
- // Disallow JSX props spreading
587
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
588
- "react/jsx-props-no-spreading": [
589
- "error",
590
- {
591
- html: "enforce",
592
- custom: "enforce",
593
- explicitSpread: "ignore",
594
- exceptions: [],
595
- },
596
- ],
597
-
598
- // Enforce that props are read-only
599
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md
600
- "react/prefer-read-only-props": "off",
601
-
602
- // Prevent usage of `javascript:` URLs
603
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
604
- "react/jsx-no-script-url": [
605
- "error",
606
- [
607
- {
608
- name: "Link",
609
- props: ["to"],
610
- },
611
- ],
612
- ],
613
-
614
- // Disallow unnecessary fragments
615
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
616
- "react/jsx-no-useless-fragment": "error",
617
-
618
- // Prevent adjacent inline elements not separated by whitespace
619
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md
620
- "react/no-adjacent-inline-elements": "error",
621
-
622
- // Enforce a specific function type for function components
623
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
624
- "react/function-component-definition": [
625
- "error",
626
- {
627
- namedComponents: "arrow-function",
628
- unnamedComponents: "arrow-function",
629
- },
630
- ],
631
-
632
- // Enforce a new line after jsx elements and expressions
633
- // https://github.com/yannickcr/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-newline.md
634
- "react/jsx-newline": "off",
635
-
636
- // Prevent react contexts from taking non-stable values
637
- // https://github.com/yannickcr/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-no-constructed-context-values.md
638
- "react/jsx-no-constructed-context-values": "error",
639
-
640
- ...prettierReactRules,
641
- },
642
-
643
- settings: {
644
- "import/resolver": {
645
- node: {
646
- extensions: [".js", ".jsx", ".json", ...(hasAnyDep("rect") ? [".ts", ".tsx", ".d.ts"] : [])],
647
- },
648
- },
649
- react: {
650
- pragma: "React",
651
- version: "detect",
652
- },
653
- propWrapperFunctions: [
654
- "forbidExtraProps", // https://www.npmjs.com/package/airbnb-prop-types
655
- "exact", // https://www.npmjs.com/package/prop-types-exact
656
- "Object.freeze", // https://tc39.github.io/ecma262/#sec-object.freeze
657
- ],
658
- },
659
- };
@@ -1,10 +0,0 @@
1
- module.exports = {
2
- plugins: ["simple-import-sort"],
3
- rules: {
4
- "simple-import-sort/imports": ["error", { groups: [["^\\u0000"], ["^[^.]"], ["^\\."]] }],
5
- "simple-import-sort/exports": "off",
6
- "import/first": "error",
7
- "import/newline-after-import": "error",
8
- "import/no-duplicates": "error",
9
- },
10
- };