react-native-navigation的迁移库

.eslintrc 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. {
  2. "env": {
  3. "es6": true,
  4. "node": true
  5. },
  6. "parserOptions": {
  7. "ecmaVersion": 8,
  8. "sourceType": "module",
  9. "ecmaFeatures": {
  10. "impliedStrict": true,
  11. "jsx": true,
  12. "experimentalObjectRestSpread": true
  13. }
  14. },
  15. "plugins": [
  16. "react",
  17. "react-native",
  18. "babel"
  19. ],
  20. "rules": {
  21. /*
  22. * possible errors
  23. */
  24. "comma-dangle": "error",
  25. "no-cond-assign": [
  26. "error",
  27. "except-parens"
  28. ],
  29. "no-console": "warn",
  30. "no-constant-condition": "error",
  31. "no-control-regex": "error",
  32. "no-debugger": "warn",
  33. "no-dupe-args": "error",
  34. "no-dupe-keys": "error",
  35. "no-duplicate-case": "error",
  36. "no-empty": "error",
  37. "no-empty-character-class": "error",
  38. "no-ex-assign": "error",
  39. "no-extra-boolean-cast": "error",
  40. "no-extra-parens": 0,
  41. "no-extra-semi": "error",
  42. "no-func-assign": "error",
  43. "no-inner-declarations": "error",
  44. "no-invalid-regexp": "error",
  45. "no-irregular-whitespace": "error",
  46. "no-negated-in-lhs": "error",
  47. "no-obj-calls": "error",
  48. "no-regex-spaces": "error",
  49. "no-sparse-arrays": "error",
  50. "no-unexpected-multiline": "error",
  51. "no-unreachable": "error",
  52. "use-isnan": "error",
  53. "valid-jsdoc": 0,
  54. "valid-typeof": "error",
  55. /*
  56. * best practices
  57. */
  58. "accessor-pairs": "warn",
  59. "array-callback-return": 0,
  60. "block-scoped-var": "error",
  61. "complexity": 0,
  62. "consistent-return": "error",
  63. "curly": [
  64. "error",
  65. "all"
  66. ],
  67. "default-case": "error",
  68. "dot-location": [
  69. "error",
  70. "property"
  71. ],
  72. "dot-notation": "error",
  73. "eqeqeq": "error",
  74. "guard-for-in": "error",
  75. "no-alert": "error",
  76. "no-caller": "error",
  77. "no-case-declarations": "error",
  78. "no-div-regex": 0,
  79. "no-else-return": 0,
  80. "no-empty-function": "error",
  81. "no-empty-pattern": "error",
  82. "no-eq-null": "error",
  83. "no-eval": "error",
  84. "no-extend-native": "error",
  85. "no-extra-bind": "error",
  86. "no-extra-label": "error",
  87. "no-fallthrough": "error",
  88. "no-floating-decimal": "error",
  89. "no-implicit-coercion": "error",
  90. "no-implicit-globals": 0,
  91. "no-implied-eval": "error",
  92. "no-invalid-this": 0,
  93. "no-iterator": "error",
  94. "no-labels": "error",
  95. "no-lone-blocks": "error",
  96. "no-loop-func": "error",
  97. "no-magic-numbers": 0,
  98. "no-multi-spaces": "error",
  99. "no-multi-str": 0,
  100. "no-native-reassign": "error",
  101. "no-new": "error",
  102. "no-new-func": "error",
  103. "no-new-wrappers": "error",
  104. "no-octal": "error",
  105. "no-octal-escape": "error",
  106. "no-param-reassign": "error",
  107. "no-proto": "error",
  108. "no-redeclare": 0,
  109. "no-return-assign": 0,
  110. "no-script-url": "error",
  111. "no-self-assign": "error",
  112. "no-self-compare": "error",
  113. "no-sequences": "error",
  114. "no-throw-literal": "error",
  115. "no-unmodified-loop-condition": 0,
  116. "no-unused-expressions": "error",
  117. "no-unused-labels": 0,
  118. "no-useless-call": "error",
  119. "no-useless-concat": "error",
  120. "no-void": "error",
  121. "no-warning-comments": 0,
  122. "no-with": "error",
  123. "radix": 0,
  124. "vars-on-top": 0,
  125. "wrap-iife": "error",
  126. "yoda": 0,
  127. "strict": [
  128. "error",
  129. "never"
  130. ],
  131. /*
  132. * variables
  133. */
  134. "init-declarations": 0,
  135. "no-catch-shadow": "error",
  136. "no-delete-var": "error",
  137. "no-label-var": "error",
  138. "no-restricted-globals": "error",
  139. "no-shadow": "error",
  140. "no-shadow-restricted-names": "error",
  141. "no-undef": 0,
  142. "no-undef-init": "error",
  143. "no-undefined": 0,
  144. "no-unused-vars": 0,
  145. "no-use-before-define": 0,
  146. /*
  147. * Node.js
  148. */
  149. "callback-return": 0,
  150. "global-require": 0,
  151. "handle-callback-err": 0,
  152. "no-mixed-requires": "error",
  153. "no-new-require": "error",
  154. "no-path-concat": "error",
  155. "no-process-env": 0,
  156. "no-process-exit": "error",
  157. "no-restricted-modules": 0,
  158. "no-sync": 0,
  159. /*
  160. * style
  161. */
  162. "array-bracket-spacing": [
  163. "error",
  164. "never"
  165. ],
  166. "block-spacing": "error",
  167. "brace-style": [
  168. "error",
  169. "1tbs"
  170. ],
  171. "camelcase": [
  172. "error",
  173. {
  174. "properties": "never"
  175. }
  176. ],
  177. "comma-spacing": [
  178. "error",
  179. {
  180. "before": false,
  181. "after": true
  182. }
  183. ],
  184. "comma-style": [
  185. "error",
  186. "last"
  187. ],
  188. "computed-property-spacing": [
  189. "error",
  190. "never"
  191. ],
  192. "consistent-this": [
  193. "error",
  194. "self"
  195. ],
  196. "eol-last": [
  197. "error",
  198. "unix"
  199. ],
  200. "func-names": 0,
  201. "func-style": 0,
  202. "id-blacklist": 0,
  203. "id-length": 0,
  204. "id-match": 0,
  205. "indent": [
  206. "error",
  207. 2,
  208. {
  209. "SwitchCase": 1
  210. }
  211. ],
  212. "jsx-quotes": "error",
  213. "key-spacing": [
  214. "error",
  215. {
  216. "singleLine": {
  217. "beforeColon": false,
  218. "afterColon": true,
  219. "mode": "strict"
  220. },
  221. "multiLine": {
  222. "beforeColon": false,
  223. "afterColon": true,
  224. "mode": "strict"
  225. }
  226. }
  227. ],
  228. "keyword-spacing": [
  229. "error",
  230. {
  231. "before": true,
  232. "after": true
  233. }
  234. ],
  235. "linebreak-style": [
  236. "error",
  237. "unix"
  238. ],
  239. "lines-around-comment": 0,
  240. "max-depth": [
  241. "error",
  242. 4
  243. ],
  244. "max-len": [
  245. "warn",
  246. 150
  247. ],
  248. "max-nested-callbacks": [
  249. "error",
  250. 4
  251. ],
  252. "max-params": [
  253. "error",
  254. 6
  255. ],
  256. "max-statements": [
  257. "error",
  258. 15,
  259. {
  260. "ignoreTopLevelFunctions": true
  261. }
  262. ],
  263. "new-cap": [
  264. "error",
  265. {
  266. "capIsNewExceptions": [
  267. "Immutable"
  268. ]
  269. }
  270. ],
  271. "new-parens": "error",
  272. "newline-after-var": 0,
  273. "newline-before-return": 0,
  274. "newline-per-chained-call": 0,
  275. "no-array-constructor": "error",
  276. "no-bitwise": 0,
  277. "no-continue": 0,
  278. "no-inline-comments": 0,
  279. "no-lonely-if": "error",
  280. "no-mixed-spaces-and-tabs": 0,
  281. "no-multiple-empty-lines": [
  282. "error",
  283. {
  284. "max": 1
  285. }
  286. ],
  287. "no-negated-condition": 0,
  288. "no-nested-ternary": "error",
  289. "no-new-object": "error",
  290. "no-plusplus": 0,
  291. "no-restricted-syntax": 0,
  292. "no-spaced-func": "error",
  293. "no-ternary": 0,
  294. "no-trailing-spaces": [
  295. "error",
  296. {
  297. "skipBlankLines": true
  298. }
  299. ],
  300. "no-underscore-dangle": 0,
  301. "no-unneeded-ternary": "error",
  302. "no-whitespace-before-property": "error",
  303. "object-curly-spacing": [
  304. "error",
  305. "never"
  306. ],
  307. "one-var": 0,
  308. "one-var-declaration-per-line": 0,
  309. "operator-assignment": 0,
  310. "operator-linebreak": [
  311. "error",
  312. "before"
  313. ],
  314. "padded-blocks": [
  315. "error",
  316. "never"
  317. ],
  318. "quote-props": [
  319. "error",
  320. "consistent-as-needed"
  321. ],
  322. "quotes": 0,
  323. "require-jsdoc": 0,
  324. "semi": [
  325. "error",
  326. "always"
  327. ],
  328. "semi-spacing": [
  329. "error",
  330. {
  331. "before": false,
  332. "after": true
  333. }
  334. ],
  335. "sort-imports": 0,
  336. "sort-vars": 0,
  337. "space-before-blocks": [
  338. "error",
  339. "always"
  340. ],
  341. "space-before-function-paren": [
  342. "error",
  343. "never"
  344. ],
  345. "space-in-parens": [
  346. "error",
  347. "never"
  348. ],
  349. "space-infix-ops": "error",
  350. "space-unary-ops": "error",
  351. "spaced-comment": 0,
  352. "wrap-regex": "error",
  353. /*
  354. * ECMAScript 6
  355. */
  356. "arrow-body-style": 0,
  357. "arrow-parens": 0,
  358. "arrow-spacing": [
  359. "error",
  360. {
  361. "before": true,
  362. "after": true
  363. }
  364. ],
  365. "constructor-super": "error",
  366. "generator-star-spacing": 0,
  367. "no-class-assign": "error",
  368. "no-confusing-arrow": "error",
  369. "no-const-assign": "error",
  370. "no-dupe-class-members": "error",
  371. "no-new-symbol": "error",
  372. "no-restricted-imports": 0,
  373. "no-this-before-super": "error",
  374. "no-useless-constructor": 0,
  375. "no-var": "error",
  376. "object-shorthand": 0,
  377. "prefer-arrow-callback": 0,
  378. "prefer-const": "error",
  379. "prefer-reflect": 0,
  380. "prefer-rest-params": "error",
  381. "prefer-spread": "error",
  382. "prefer-template": 0,
  383. "require-yield": 0,
  384. "template-curly-spacing": [
  385. "error",
  386. "never"
  387. ],
  388. "yield-star-spacing": [
  389. "error",
  390. "after"
  391. ],
  392. /*
  393. * react plugin
  394. */
  395. "react/display-name": 0,
  396. "react/forbid-prop-types": [
  397. "error",
  398. {
  399. "forbid": [
  400. "any"
  401. ]
  402. }
  403. ],
  404. "react/no-danger": "error",
  405. "react/no-deprecated": "error",
  406. "react/no-did-mount-set-state": [
  407. "error"
  408. ],
  409. "react/no-did-update-set-state": [
  410. "error"
  411. ],
  412. "react/no-direct-mutation-state": "error",
  413. "react/no-is-mounted": "error",
  414. "react/no-multi-comp": "error",
  415. "react/no-set-state": 0,
  416. "react/no-string-refs": 0,
  417. "react/no-unknown-property": 0,
  418. "react/prefer-es6-class": [
  419. "error",
  420. "always"
  421. ],
  422. "react/prefer-stateless-function": 0,
  423. "react/prop-types": 0,
  424. "react/react-in-jsx-scope": "error",
  425. "react/require-extension": 0,
  426. "react/self-closing-comp": "error",
  427. "react/sort-comp": [
  428. "error",
  429. {
  430. "order": [
  431. "static-methods",
  432. "lifecycle",
  433. "/^on.+$/",
  434. "/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/",
  435. "everything-else",
  436. "/^render.+$/",
  437. "render"
  438. ]
  439. }
  440. ],
  441. "react/sort-prop-types": 0,
  442. "react/jsx-wrap-multilines": "error",
  443. "react/jsx-boolean-value": [
  444. "error",
  445. "always"
  446. ],
  447. "react/jsx-closing-bracket-location": "error",
  448. "react/jsx-curly-spacing": [
  449. "error",
  450. "never"
  451. ],
  452. "react/jsx-equals-spacing": [
  453. "error",
  454. "never"
  455. ],
  456. "react/jsx-handler-names": [
  457. "error",
  458. {
  459. "eventHandlerPropPrefix": "handle"
  460. }
  461. ],
  462. "react/jsx-indent-props": [
  463. 0,
  464. 2
  465. ],
  466. "react/jsx-indent": [
  467. "error",
  468. 2
  469. ],
  470. "react/jsx-key": "error",
  471. "react/jsx-max-props-per-line": [
  472. "error",
  473. {
  474. "maximum": 2
  475. }
  476. ],
  477. "react/jsx-no-bind": 0,
  478. "react/jsx-no-duplicate-props": [
  479. "error",
  480. {
  481. "ignoreCase": true
  482. }
  483. ],
  484. "react/jsx-no-literals": "error",
  485. "react/jsx-no-undef": "error",
  486. "react/jsx-pascal-case": "error",
  487. "react/jsx-sort-props": 0,
  488. "react/jsx-space-before-closing": 0,
  489. "react/jsx-uses-react": "error",
  490. "react/jsx-uses-vars": "error",
  491. /*
  492. * react-native plugin
  493. */
  494. "react-native/no-unused-styles": "error",
  495. "react-native/split-platform-components": "error",
  496. /*
  497. * babel plugin
  498. */
  499. "babel/generator-star-spacing": [
  500. "error",
  501. "after"
  502. ],
  503. "babel/new-cap": [
  504. "error",
  505. {
  506. "capIsNewExceptions": [
  507. "Immutable"
  508. ]
  509. }
  510. ],
  511. "babel/array-bracket-spacing": [
  512. "error",
  513. "never"
  514. ],
  515. "babel/object-curly-spacing": [
  516. "error",
  517. "never"
  518. ],
  519. "babel/object-shorthand": 0,
  520. "babel/arrow-parens": [
  521. "error",
  522. "always"
  523. ],
  524. "babel/no-await-in-loop": 0
  525. }
  526. }