Add rollup to eslint-plugin-react-forget
Lauren Tan committed
Sep 5, 2023 at 12:08 UTC
fdd6a1b8b1bc72fffb813ce1fc046b87ea8435a7
5 files changed
+168
-6
compiler/packages/eslint-plugin-react-forget/package.json
+7
-2
@@ -10,7 +10,7 @@
10
"main": "./lib/index.js",
11
"exports": "./lib/index.js",
12
"scripts": {
13
- "build": "tsc",
13
+ "build": "rimraf dist && rollup --config --bundleConfigAsCjs",
14
"test": "tsc && jest"
15
},
16
"dependencies": {
@@ -24,6 +24,10 @@
24
"@babel/preset-env": "^7.22.4",
25
"@babel/preset-typescript": "^7.18.6",
26
"@babel/types": "^7.19.0",
27
+ "@rollup/plugin-commonjs": "^25.0.4",
28
+ "@rollup/plugin-json": "^6.0.0",
29
+ "@rollup/plugin-node-resolve": "^15.2.1",
30
+ "@rollup/plugin-typescript": "^11.1.3",
31
"@types/node": "^20.2.5",
32
"babel-jest": "^29.0.3",
33
"eslint": "^8.19.0",
@@ -31,7 +35,8 @@
35
"eslint-plugin-eslint-plugin": "^5.0.0",
36
"eslint-plugin-node": "^11.1.0",
37
"jest": "^29.5.0",
34
- "npm-run-all": "^4.1.5"
38
+ "npm-run-all": "^4.1.5",
39
+ "rollup": "^3.28.1"
40
},
41
"engines": {
42
"node": "^14.17.0 || ^16.0.0 || >= 18.0.0"
compiler/packages/eslint-plugin-react-forget/rollup.config.js
new
+29
@@ -0,0 +1,29 @@
1
+import typescript from "@rollup/plugin-typescript";
2
+import { nodeResolve } from "@rollup/plugin-node-resolve";
3
+import commonjs from "@rollup/plugin-commonjs";
4
+import json from "@rollup/plugin-json";
5
+import path from "path";
6
+import process from "process";
7
+
8
+export default {
9
+ input: "src/index.ts",
10
+ output: {
11
+ file: "dist/index.js",
12
+ format: "cjs",
13
+ sourcemap: false,
14
+ },
15
+ plugins: [
16
+ typescript({
17
+ compilerOptions: {
18
+ noEmit: true,
19
+ },
20
+ }),
21
+ json(),
22
+ nodeResolve({
23
+ preferBuiltins: true,
24
+ resolveOnly: ["@babel-plugin-react-forget"],
25
+ rootDir: path.join(process.cwd(), ".."),
26
+ }),
27
+ commonjs(),
28
+ ],
29
+};
compiler/packages/eslint-plugin-react-forget/src/rules/ReactForgetDiagnostics.ts
+3
-1
@@ -6,6 +6,8 @@
6
*/
7
8
import { transformFromAstSync } from "@babel/core";
9
+// @ts-expect-error
10
+import PluginProposalPrivateMethods from "@babel/plugin-proposal-private-methods";
11
import type { SourceLocation as BabelSourceLocation } from "@babel/types";
12
import ReactForgetBabelPlugin, {
13
CompilerSuggestionOperation,
@@ -91,7 +93,7 @@ const rule: Rule.RuleModule = {
93
highlightCode: false,
94
retainLines: true,
95
plugins: [
94
- ["@babel/plugin-proposal-private-methods", { loose: true }],
96
+ [PluginProposalPrivateMethods, { loose: true }],
97
[ReactForgetBabelPlugin, COMPILER_OPTIONS],
98
],
99
sourceType: "module",
compiler/packages/eslint-plugin-react-forget/tsconfig.json
+3
-3
@@ -1,8 +1,8 @@
1
{
2
"extends": "@tsconfig/node18-strictest/tsconfig.json",
3
"compilerOptions": {
4
- "declaration": true,
5
- "outDir": "dist",
4
+ "rootDir": "../",
5
+ "noEmit": true,
6
"jsx": "react-jsxdev",
7
8
// weaken strictness from preset
@@ -13,7 +13,7 @@
13
"target": "ES2015",
14
// ideally turn off only during dev, or on a per-file basis
15
"noUnusedLocals": false,
16
- "sourceMap": true
16
+ "sourceMap": false
17
},
18
"exclude": ["node_modules"],
19
"include": ["src/**/*.ts"]
compiler/yarn.lock
+126
@@ -2410,6 +2410,11 @@
2410
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24"
2411
integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==
2412
2413
+"@jridgewell/sourcemap-codec@^1.4.13":
2414
+ version "1.4.15"
2415
+ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"
2416
+ integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==
2417
+
2418
"@jridgewell/trace-mapping@0.3.9":
2419
version "0.3.9"
2420
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9"
@@ -2583,6 +2588,54 @@
2588
picocolors "^1.0.0"
2589
tslib "^2.5.0"
2590
2591
+"@rollup/plugin-commonjs@^25.0.4":
2592
+ version "25.0.4"
2593
+ resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.4.tgz#a7547a0c4ec3fa79818eb313e1de0023e548f4e6"
2594
+ integrity sha512-L92Vz9WUZXDnlQQl3EwbypJR4+DM2EbsO+/KOcEkP4Mc6Ct453EeDB2uH9lgRwj4w5yflgNpq9pHOiY8aoUXBQ==
2595
+ dependencies:
2596
+ "@rollup/pluginutils" "^5.0.1"
2597
+ commondir "^1.0.1"
2598
+ estree-walker "^2.0.2"
2599
+ glob "^8.0.3"
2600
+ is-reference "1.2.1"
2601
+ magic-string "^0.27.0"
2602
+
2603
+"@rollup/plugin-json@^6.0.0":
2604
+ version "6.0.0"
2605
+ resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-6.0.0.tgz#199fea6670fd4dfb1f4932250569b14719db234a"
2606
+ integrity sha512-i/4C5Jrdr1XUarRhVu27EEwjt4GObltD7c+MkCIpO2QIbojw8MUs+CCTqOphQi3Qtg1FLmYt+l+6YeoIf51J7w==
2607
+ dependencies:
2608
+ "@rollup/pluginutils" "^5.0.1"
2609
+
2610
+"@rollup/plugin-node-resolve@^15.2.1":
2611
+ version "15.2.1"
2612
+ resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.2.1.tgz#a15b14fb7969229e26a30feff2816d39eff503f0"
2613
+ integrity sha512-nsbUg588+GDSu8/NS8T4UAshO6xeaOfINNuXeVHcKV02LJtoRaM1SiOacClw4kws1SFiNhdLGxlbMY9ga/zs/w==
2614
+ dependencies:
2615
+ "@rollup/pluginutils" "^5.0.1"
2616
+ "@types/resolve" "1.20.2"
2617
+ deepmerge "^4.2.2"
2618
+ is-builtin-module "^3.2.1"
2619
+ is-module "^1.0.0"
2620
+ resolve "^1.22.1"
2621
+
2622
+"@rollup/plugin-typescript@^11.1.3":
2623
+ version "11.1.3"
2624
+ resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-11.1.3.tgz#8172858a1e5f4c181aebc61f8920002fd5e04b91"
2625
+ integrity sha512-8o6cNgN44kQBcpsUJTbTXMTtb87oR1O0zgP3Dxm71hrNgparap3VujgofEilTYJo+ivf2ke6uy3/E5QEaiRlDA==
2626
+ dependencies:
2627
+ "@rollup/pluginutils" "^5.0.1"
2628
+ resolve "^1.22.1"
2629
+
2630
+"@rollup/pluginutils@^5.0.1":
2631
+ version "5.0.4"
2632
+ resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.4.tgz#74f808f9053d33bafec0cc98e7b835c9667d32ba"
2633
+ integrity sha512-0KJnIoRI8A+a1dqOYLxH8vBf8bphDmty5QvIm2hqm7oFCFYKCAZWWd2hXgMibaPsNDhI0AtpYfQZJG47pt/k4g==
2634
+ dependencies:
2635
+ "@types/estree" "^1.0.0"
2636
+ estree-walker "^2.0.2"
2637
+ picomatch "^2.3.1"
2638
+
2639
"@rushstack/eslint-patch@^1.1.3":
2640
version "1.3.0"
2641
resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.3.0.tgz#f5635b36fc0dad96ef1e542a302cd914230188c0"
@@ -2935,6 +2988,11 @@
2988
"@types/scheduler" "*"
2989
csstype "^3.0.2"
2990
2991
+"@types/resolve@1.20.2":
2992
+ version "1.20.2"
2993
+ resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975"
2994
+ integrity sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==
2995
+
2996
"@types/scheduler@*":
2997
version "0.16.2"
2998
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39"
@@ -3949,6 +4007,13 @@ brace-expansion@^1.1.7:
4007
balanced-match "^1.0.0"
4008
concat-map "0.0.1"
4009
4010
+brace-expansion@^2.0.1:
4011
+ version "2.0.1"
4012
+ resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
4013
+ integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
4014
+ dependencies:
4015
+ balanced-match "^1.0.0"
4016
+
4017
braces@^3.0.2, braces@~3.0.2:
4018
version "3.0.2"
4019
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
@@ -4092,6 +4157,11 @@ buffer@^6.0.3:
4157
base64-js "^1.3.1"
4158
ieee754 "^1.2.1"
4159
4160
+builtin-modules@^3.3.0:
4161
+ version "3.3.0"
4162
+ resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6"
4163
+ integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==
4164
+
4165
builtin-status-codes@^3.0.0:
4166
version "3.0.0"
4167
resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8"
@@ -5669,6 +5739,11 @@ estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0:
5739
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123"
5740
integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==
5741
5742
+estree-walker@^2.0.2:
5743
+ version "2.0.2"
5744
+ resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac"
5745
+ integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==
5746
+
5747
esutils@^2.0.2:
5748
version "2.0.3"
5749
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
@@ -6188,6 +6263,17 @@ glob@^7.1.3, glob@^7.1.4, glob@^7.1.6:
6263
once "^1.3.0"
6264
path-is-absolute "^1.0.0"
6265
6266
+glob@^8.0.3:
6267
+ version "8.1.0"
6268
+ resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e"
6269
+ integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==
6270
+ dependencies:
6271
+ fs.realpath "^1.0.0"
6272
+ inflight "^1.0.4"
6273
+ inherits "2"
6274
+ minimatch "^5.0.1"
6275
+ once "^1.3.0"
6276
+
6277
globals@^10.1.0:
6278
version "10.4.0"
6279
resolved "https://registry.yarnpkg.com/globals/-/globals-10.4.0.tgz#5c477388b128a9e4c5c5d01c7a2aca68c68b2da7"
@@ -6679,6 +6765,13 @@ is-boolean-object@^1.1.0:
6765
call-bind "^1.0.2"
6766
has-tostringtag "^1.0.0"
6767
6768
+is-builtin-module@^3.2.1:
6769
+ version "3.2.1"
6770
+ resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.1.tgz#f03271717d8654cfcaf07ab0463faa3571581169"
6771
+ integrity sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==
6772
+ dependencies:
6773
+ builtin-modules "^3.3.0"
6774
+
6775
is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7:
6776
version "1.2.7"
6777
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055"
@@ -6768,6 +6861,11 @@ is-map@^2.0.1, is-map@^2.0.2:
6861
resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127"
6862
integrity sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==
6863
6864
+is-module@^1.0.0:
6865
+ version "1.0.0"
6866
+ resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591"
6867
+ integrity sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==
6868
+
6869
is-nan@^1.2.1:
6870
version "1.3.2"
6871
resolved "https://registry.yarnpkg.com/is-nan/-/is-nan-1.3.2.tgz#043a54adea31748b55b6cd4e09aadafa69bd9e1d"
@@ -6810,6 +6908,13 @@ is-potential-custom-element-name@^1.0.1:
6908
resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5"
6909
integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==
6910
6911
+is-reference@1.2.1:
6912
+ version "1.2.1"
6913
+ resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7"
6914
+ integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==
6915
+ dependencies:
6916
+ "@types/estree" "*"
6917
+
6918
is-regex@^1.1.4:
6919
version "1.1.4"
6920
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958"
@@ -8520,6 +8625,13 @@ lz-string@^1.4.4:
8625
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26"
8626
integrity sha512-0ckx7ZHRPqb0oUm8zNr+90mtf9DQB60H1wMCjBtfi62Kl3a7JbHob6gA2bC+xRvZoOL+1hzUK8jeuEIQE8svEQ==
8627
8628
+magic-string@^0.27.0:
8629
+ version "0.27.0"
8630
+ resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.27.0.tgz#e4a3413b4bab6d98d2becffd48b4a257effdbbf3"
8631
+ integrity sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==
8632
+ dependencies:
8633
+ "@jridgewell/sourcemap-codec" "^1.4.13"
8634
+
8635
make-dir@^2.0.0, make-dir@^2.1.0:
8636
version "2.1.0"
8637
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5"
@@ -8636,6 +8748,13 @@ minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatc
8748
dependencies:
8749
brace-expansion "^1.1.7"
8750
8751
+minimatch@^5.0.1:
8752
+ version "5.1.6"
8753
+ resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96"
8754
+ integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==
8755
+ dependencies:
8756
+ brace-expansion "^2.0.1"
8757
+
8758
minimist@0.0.8:
8759
version "0.0.8"
8760
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
@@ -10005,6 +10124,13 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
10124
hash-base "^3.0.0"
10125
inherits "^2.0.1"
10126
10127
+rollup@^3.28.1:
10128
+ version "3.28.1"
10129
+ resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.28.1.tgz#fb44aa6d5e65c7e13fd5bcfff266d0c4ea9ba433"
10130
+ integrity sha512-R9OMQmIHJm9znrU3m3cpE8uhN0fGdXiawME7aZIpQqvpS/85+Vt1Hq1/yVIcYfOmaQiHjvXkQAoJukvLpau6Yw==
10131
+ optionalDependencies:
10132
+ fsevents "~2.3.2"
10133
+
10134
rrweb-cssom@^0.6.0:
10135
version "0.6.0"
10136
resolved "https://registry.yarnpkg.com/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz#ed298055b97cbddcdeb278f904857629dec5e0e1"