Skip to content

Commit af296ed

Browse files
authored
feat: add rxjs rules (#66)
1 parent edf5c8c commit af296ed

File tree

3 files changed

+43
-45
lines changed

3 files changed

+43
-45
lines changed

.eslintrc.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = {
1616
globals: {
1717
globalThis: false, // false means not writable
1818
},
19-
plugins: ['ban', 'jsdoc', 'react', 'react-hooks', 'etc'],
19+
plugins: ['ban', 'jsdoc', 'react', 'react-hooks', 'etc', 'rxjs'],
2020
settings: {
2121
react: {
2222
version: 'detect',
@@ -171,6 +171,18 @@ module.exports = {
171171
'react/void-dom-elements-no-children': 'error',
172172
'react/prop-types': 'off', // Not needed with TypeScript
173173

174+
// Rules for RxJS
175+
'rxjs/no-ignored-observable': 'error',
176+
'rxjs/no-ignored-subscription': 'error',
177+
'rxjs/no-async-subscribe': 'error',
178+
'rxjs/no-nested-subscribe': 'error',
179+
'rxjs/no-unbound-methods': 'error',
180+
'rxjs/throw-error': 'error',
181+
'rxjs/no-internal': 'error',
182+
'rxjs/no-subclass': 'error',
183+
'rxjs/no-unsafe-catch': 'error',
184+
'rxjs/no-subject-unsubscribe': 'error',
185+
174186
// https://github.com/cartant/eslint-plugin-etc/issues/1
175187
// 'etc/throw-error': 'error',
176188
'etc/deprecation': 'warn',

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"eslint-plugin-import": "^2.20.2",
4444
"eslint-plugin-jsdoc": "^22.0.0",
4545
"eslint-plugin-react": "^7.19.0",
46-
"eslint-plugin-react-hooks": "^3.0.0"
46+
"eslint-plugin-react-hooks": "^3.0.0",
47+
"eslint-plugin-rxjs": "^0.0.2-beta.16"
4748
}
4849
}

yarn.lock

Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,11 @@ comment-parser@^0.7.2:
10441044
resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-0.7.2.tgz#baf6d99b42038678b81096f15b630d18142f4b8a"
10451045
integrity sha512-4Rjb1FnxtOcv9qsfuaNuVsmmVn4ooVoBHzYfyKteiXwIU84PClyGA5jASoFMwPV93+FPh9spwueXauxFJZkGAg==
10461046

1047+
common-tags@^1.8.0:
1048+
version "1.8.0"
1049+
resolved "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz#8e3153e542d4a39e9b10554434afaaf98956a937"
1050+
integrity sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw==
1051+
10471052
compare-func@^1.3.1:
10481053
version "1.3.2"
10491054
resolved "https://registry.npmjs.org/compare-func/-/compare-func-1.3.2.tgz#99dd0ba457e1f9bc722b12c08ec33eeab31fa648"
@@ -1305,7 +1310,7 @@ debug@^2.6.9:
13051310
dependencies:
13061311
ms "2.0.0"
13071312

1308-
debuglog@*, debuglog@^1.0.1:
1313+
debuglog@^1.0.1:
13091314
version "1.0.1"
13101315
resolved "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
13111316
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
@@ -1323,6 +1328,13 @@ decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.2.0:
13231328
resolved "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
13241329
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
13251330

1331+
decamelize@^3.0.0:
1332+
version "3.2.0"
1333+
resolved "https://registry.npmjs.org/decamelize/-/decamelize-3.2.0.tgz#84b8e8f4f8c579f938e35e2cc7024907e0090851"
1334+
integrity sha512-4TgkVUsmmu7oCSyGBm5FvfMoACuoh9EOidm7V5/J2X2djAwwt57qb3F2KMP2ITqODTCSwb+YRV+0Zqrv18k/hw==
1335+
dependencies:
1336+
xregexp "^4.2.4"
1337+
13261338
decode-uri-component@^0.2.0:
13271339
version "0.2.0"
13281340
resolved "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"
@@ -1654,6 +1666,19 @@ eslint-plugin-react@^7.19.0:
16541666
string.prototype.matchall "^4.0.2"
16551667
xregexp "^4.3.0"
16561668

1669+
eslint-plugin-rxjs@^0.0.2-beta.16:
1670+
version "0.0.2-beta.16"
1671+
resolved "https://registry.npmjs.org/eslint-plugin-rxjs/-/eslint-plugin-rxjs-0.0.2-beta.16.tgz#8b216ac71386362a3569e3d9ad4b67325ad51fdd"
1672+
integrity sha512-qR7u+DvF2eeZhhO8JX0f6hHn0CRi5nen7O2pJku+AZYJOmA+pXzgG5gv3x0rBBxTuR2busSWGY5YObcup++sYA==
1673+
dependencies:
1674+
common-tags "^1.8.0"
1675+
decamelize "^3.0.0"
1676+
eslint-etc "^0.0.8"
1677+
requireindex "~1.2.0"
1678+
tslib "^1.8.0"
1679+
tsutils "^3.0.0"
1680+
tsutils-etc "^1.0.0"
1681+
16571682
eslint-scope@^5.0.0:
16581683
version "5.0.0"
16591684
resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9"
@@ -2294,7 +2319,7 @@ import-lazy@^2.1.0:
22942319
resolved "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43"
22952320
integrity sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=
22962321

2297-
imurmurhash@*, imurmurhash@^0.1.4:
2322+
imurmurhash@^0.1.4:
22982323
version "0.1.4"
22992324
resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
23002325
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
@@ -2864,11 +2889,6 @@ lockfile@^1.0.4:
28642889
dependencies:
28652890
signal-exit "^3.0.2"
28662891

2867-
lodash._baseindexof@*:
2868-
version "3.1.0"
2869-
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
2870-
integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=
2871-
28722892
lodash._baseuniq@~4.6.0:
28732893
version "4.6.0"
28742894
resolved "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
@@ -2877,33 +2897,11 @@ lodash._baseuniq@~4.6.0:
28772897
lodash._createset "~4.0.0"
28782898
lodash._root "~3.0.0"
28792899

2880-
lodash._bindcallback@*:
2881-
version "3.0.1"
2882-
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
2883-
integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=
2884-
2885-
lodash._cacheindexof@*:
2886-
version "3.0.2"
2887-
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
2888-
integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=
2889-
2890-
lodash._createcache@*:
2891-
version "3.1.2"
2892-
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
2893-
integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
2894-
dependencies:
2895-
lodash._getnative "^3.0.0"
2896-
28972900
lodash._createset@~4.0.0:
28982901
version "4.0.3"
28992902
resolved "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
29002903
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=
29012904

2902-
lodash._getnative@*, lodash._getnative@^3.0.0:
2903-
version "3.9.1"
2904-
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
2905-
integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=
2906-
29072905
lodash._reinterpolate@^3.0.0:
29082906
version "3.0.0"
29092907
resolved "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
@@ -2944,11 +2942,6 @@ lodash.isstring@^4.0.1:
29442942
resolved "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"
29452943
integrity sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=
29462944

2947-
lodash.restparam@*:
2948-
version "3.6.1"
2949-
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
2950-
integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=
2951-
29522945
lodash.set@^4.3.2:
29532946
version "4.3.2"
29542947
resolved "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
@@ -3489,7 +3482,6 @@ npm@^6.10.3:
34893482
cmd-shim "^3.0.3"
34903483
columnify "~1.5.4"
34913484
config-chain "^1.1.12"
3492-
debuglog "*"
34933485
detect-indent "~5.0.0"
34943486
detect-newline "^2.1.0"
34953487
dezalgo "~1.0.3"
@@ -3504,7 +3496,6 @@ npm@^6.10.3:
35043496
has-unicode "~2.0.1"
35053497
hosted-git-info "^2.8.5"
35063498
iferr "^1.0.2"
3507-
imurmurhash "*"
35083499
infer-owner "^1.0.4"
35093500
inflight "~1.0.6"
35103501
inherits "^2.0.4"
@@ -3523,14 +3514,8 @@ npm@^6.10.3:
35233514
libnpx "^10.2.2"
35243515
lock-verify "^2.1.0"
35253516
lockfile "^1.0.4"
3526-
lodash._baseindexof "*"
35273517
lodash._baseuniq "~4.6.0"
3528-
lodash._bindcallback "*"
3529-
lodash._cacheindexof "*"
3530-
lodash._createcache "*"
3531-
lodash._getnative "*"
35323518
lodash.clonedeep "~4.5.0"
3533-
lodash.restparam "*"
35343519
lodash.union "~4.6.0"
35353520
lodash.uniq "~4.5.0"
35363521
lodash.without "~4.4.0"
@@ -5361,7 +5346,7 @@ xdg-basedir@^3.0.0:
53615346
resolved "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4"
53625347
integrity sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=
53635348

5364-
xregexp@^4.3.0:
5349+
xregexp@^4.2.4, xregexp@^4.3.0:
53655350
version "4.3.0"
53665351
resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.3.0.tgz#7e92e73d9174a99a59743f67a4ce879a04b5ae50"
53675352
integrity sha512-7jXDIFXh5yJ/orPn4SXjuVrWWoi4Cr8jfV1eHv9CixKSbU+jY4mxfrBwAuDvupPNKpMUY+FeIqsVw/JLT9+B8g==

0 commit comments

Comments
 (0)