From dbeb95d438028683922592c65b61c920d80b541b Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Tue, 19 Nov 2024 17:57:59 +0530 Subject: [PATCH] wip checkpoint --- web/packages/build-config/eslint.config.mjs | 1 - web/packages/build-config/eslintrc-base.js | 58 ------------------ web/packages/build-config/eslintrc-base.mjs | 67 +++++++++++++++++++++ web/packages/build-config/package.json | 5 +- web/packages/build-config/tsconfig.json | 5 +- web/yarn.lock | 39 +++++++----- 6 files changed, 97 insertions(+), 78 deletions(-) delete mode 100644 web/packages/build-config/eslintrc-base.js create mode 100644 web/packages/build-config/eslintrc-base.mjs diff --git a/web/packages/build-config/eslint.config.mjs b/web/packages/build-config/eslint.config.mjs index 69691eface..879df38ad2 100644 --- a/web/packages/build-config/eslint.config.mjs +++ b/web/packages/build-config/eslint.config.mjs @@ -1,6 +1,5 @@ import js from "@eslint/js"; - export default [ js.configs.recommended, { diff --git a/web/packages/build-config/eslintrc-base.js b/web/packages/build-config/eslintrc-base.js deleted file mode 100644 index e5d43938b0..0000000000 --- a/web/packages/build-config/eslintrc-base.js +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-env node */ -module.exports = { - root: true, - extends: [ - "eslint:recommended", - "plugin:@typescript-eslint/strict-type-checked", - "plugin:@typescript-eslint/stylistic-type-checked", - ], - plugins: ["@typescript-eslint"], - parserOptions: { project: true }, - parser: "@typescript-eslint/parser", - ignorePatterns: [".eslintrc.js"], - rules: { - /* Allow numbers to be used in template literals */ - "@typescript-eslint/restrict-template-expressions": [ - "error", - { - allowNumber: true, - }, - ], - /* Allow void expressions as the entire body of an arrow function */ - "@typescript-eslint/no-confusing-void-expression": [ - "error", - { - ignoreArrowShorthand: true, - }, - ], - /* - Allow async functions to be passed as JSX attributes expected to be - functions that return void (typically onFoo event handlers). - - This should be safe since we have registered global unhandled Promise - handlers. - */ - "@typescript-eslint/no-misused-promises": [ - "error", - { - checksVoidReturn: { - arguments: false, - attributes: false, - }, - }, - ], - /* Allow force unwrapping potentially optional values. - - It is best if these can be avoided by restructuring the code, but - there do arise legitimate scenarios where we know from code logic - that the value should be present. Of course, the surrounding code - might change causing that expectation to be falsified, but in certain - cases there isn't much we can do other than throwing an exception. - - Instead of rolling our own such exception (which we in fact used to - do at one point), rely on the JS's native undefined property access - exception since that conveys more information in the logs. - */ - "@typescript-eslint/no-non-null-assertion": "off", - }, -}; diff --git a/web/packages/build-config/eslintrc-base.mjs b/web/packages/build-config/eslintrc-base.mjs new file mode 100644 index 0000000000..e8d86f0b17 --- /dev/null +++ b/web/packages/build-config/eslintrc-base.mjs @@ -0,0 +1,67 @@ +// @ts-check + +import eslint from "@eslint/js"; +import tseslint from "typescript-eslint"; + +export default tseslint.config( + eslint.configs.recommended, + tseslint.configs.recommended, +); +// /* eslint-env node */ +// module.exports = { +// root: true, +// extends: [ +// "eslint:recommended", +// "plugin:@typescript-eslint/strict-type-checked", +// "plugin:@typescript-eslint/stylistic-type-checked", +// ], +// plugins: ["@typescript-eslint"], +// parserOptions: { project: true }, +// parser: "@typescript-eslint/parser", +// ignorePatterns: [".eslintrc.js"], +// rules: { +// /* Allow numbers to be used in template literals */ +// "@typescript-eslint/restrict-template-expressions": [ +// "error", +// { +// allowNumber: true, +// }, +// ], +// /* Allow void expressions as the entire body of an arrow function */ +// "@typescript-eslint/no-confusing-void-expression": [ +// "error", +// { +// ignoreArrowShorthand: true, +// }, +// ], +// /* +// Allow async functions to be passed as JSX attributes expected to be +// functions that return void (typically onFoo event handlers). + +// This should be safe since we have registered global unhandled Promise +// handlers. +// */ +// "@typescript-eslint/no-misused-promises": [ +// "error", +// { +// checksVoidReturn: { +// arguments: false, +// attributes: false, +// }, +// }, +// ], +// /* Allow force unwrapping potentially optional values. + +// It is best if these can be avoided by restructuring the code, but +// there do arise legitimate scenarios where we know from code logic +// that the value should be present. Of course, the surrounding code +// might change causing that expectation to be falsified, but in certain +// cases there isn't much we can do other than throwing an exception. + +// Instead of rolling our own such exception (which we in fact used to +// do at one point), rely on the JS's native undefined property access +// exception since that conveys more information in the logs. +// */ +// "@typescript-eslint/no-non-null-assertion": "off", +// }, +// }; diff --git a/web/packages/build-config/package.json b/web/packages/build-config/package.json index 11338df6b9..c01ed90fb5 100644 --- a/web/packages/build-config/package.json +++ b/web/packages/build-config/package.json @@ -4,12 +4,11 @@ "private": true, "devDependencies": { "@eslint/js": "^9.15.0", - "@typescript-eslint/eslint-plugin": "^8.15.0", - "@typescript-eslint/parser": "^8.15.0", "eslint-plugin-react": "^7.37.2", "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-refresh": "^0.4.14", "prettier-plugin-organize-imports": "^4.1.0", - "prettier-plugin-packagejson": "^2.5.3" + "prettier-plugin-packagejson": "^2.5.3", + "typescript-eslint": "^8.15.0" } } diff --git a/web/packages/build-config/tsconfig.json b/web/packages/build-config/tsconfig.json index 6fb762d4f9..2f2ab5c97f 100644 --- a/web/packages/build-config/tsconfig.json +++ b/web/packages/build-config/tsconfig.json @@ -3,7 +3,8 @@ itself */ "compilerOptions": { "noEmit": true, - "checkJs": true + "checkJs": true, + "esModuleInterop": true }, - "include": ["*.js"] + "include": ["*.js", "eslintrc-base.mjs"] } diff --git a/web/yarn.lock b/web/yarn.lock index b92166b8b3..0fd4d9642a 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -217,7 +217,7 @@ source-map "^0.5.7" stylis "4.2.0" -"@emotion/cache@11.13.1", "@emotion/cache@^11.11.0", "@emotion/cache@^11.13.0", "@emotion/cache@^11.4.0": +"@emotion/cache@^11.11.0", "@emotion/cache@^11.13.0", "@emotion/cache@^11.4.0": version "11.13.1" resolved "https://registry.yarnpkg.com/@emotion/cache/-/cache-11.13.1.tgz#fecfc54d51810beebf05bf2a161271a1a91895d7" integrity sha512-iqouYkuEblRcXmylXIwwOodiEK5Ifl7JcX7o6V4jI3iW4mLXX3dmt5xwBtIkJiQEXFAI+pC8X0i67yiPkH9Ucw== @@ -245,7 +245,7 @@ resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.9.0.tgz#745969d649977776b43fc7648c556aaa462b4102" integrity sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ== -"@emotion/react@11.13.3", "@emotion/react@^11.13.3", "@emotion/react@^11.8.1": +"@emotion/react@11.13.3", "@emotion/react@^11.8.1": version "11.13.3" resolved "https://registry.yarnpkg.com/@emotion/react/-/react-11.13.3.tgz#a69d0de2a23f5b48e0acf210416638010e4bd2e4" integrity sha512-lIsdU6JNrmYfJ5EbUCf4xW1ovy5wKQ2CkPRM4xogziOxH1nXxBSjpC9YqbFAP7circxMfYp+6x676BqWcEiixg== @@ -422,19 +422,21 @@ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz#acad351d582d157bb145535db2a6ff53dd514b5c" integrity sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw== -"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": +"@eslint-community/eslint-utils@^4.2.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.10.0": - version "4.11.0" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.0.tgz#b0ffd0312b4a3fd2d6f77237e7248a5ad3a680ae" - integrity sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A== +"@eslint-community/eslint-utils@^4.4.0": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz#d1145bf2c20132d6400495d6df4bf59362fd9d56" + integrity sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA== + dependencies: + eslint-visitor-keys "^3.4.3" -"@eslint-community/regexpp@^4.12.1": +"@eslint-community/regexpp@^4.10.0", "@eslint-community/regexpp@^4.12.1": version "4.12.1" resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.1.tgz#cfc6cffe39df390a3841cde2abccf92eaa7ae0e0" integrity sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ== @@ -1033,7 +1035,7 @@ resolved "https://registry.yarnpkg.com/@types/zxcvbn/-/zxcvbn-4.4.5.tgz#8ce8623ed7a36e3a76d1c0b539708dfb2e859bc0" integrity sha512-FZJgC5Bxuqg7Rhsm/bx6gAruHHhDQ55r+s0JhDh8CQ16fD7NsJJ+p8YMMQDhSQoIrSmjpqqYWA96oQVMNkjRyA== -"@typescript-eslint/eslint-plugin@^8.15.0": +"@typescript-eslint/eslint-plugin@8.15.0": version "8.15.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.15.0.tgz#c95c6521e70c8b095a684d884d96c0c1c63747d2" integrity sha512-+zkm9AR1Ds9uLWN3fkoeXgFppaQ+uEVtfOV62dDmsy9QCNqlRHWNEck4yarvRNrvRcHQLGfqBNui3cimoz8XAg== @@ -1048,7 +1050,7 @@ natural-compare "^1.4.0" ts-api-utils "^1.3.0" -"@typescript-eslint/parser@^8.15.0": +"@typescript-eslint/parser@8.15.0": version "8.15.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.15.0.tgz#92610da2b3af702cfbc02a46e2a2daa6260a9045" integrity sha512-7n59qFpghG4uazrF9qtGKBZXn7Oz4sOMm8dwNWDQY96Xlm2oX67eipqcblDj+oY1lLCbf1oltMZFpUso66Kl1A== @@ -1882,7 +1884,7 @@ eslint-scope@^8.2.0: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-visitor-keys@^3.3.0: +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.3: version "3.4.3" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== @@ -3813,9 +3815,9 @@ truncate-utf8-bytes@^1.0.0: utf8-byte-length "^1.0.1" ts-api-utils@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" - integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== + version "1.4.0" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.4.0.tgz#709c6f2076e511a81557f3d07a0cbd566ae8195c" + integrity sha512-032cPxaEKwM+GT3vA5JXNzIaizx388rhsSW79vGRNGXfRRAdEAn2mvk36PvK5HnOchyWZ7afLEXqYCvPCrzuzQ== tslib@^2.0.0, tslib@^2.1.0, tslib@^2.4.0, tslib@^2.6.2: version "2.7.0" @@ -3878,6 +3880,15 @@ typed-array-length@^1.0.6: is-typed-array "^1.1.13" possible-typed-array-names "^1.0.0" +typescript-eslint@^8.15.0: + version "8.15.0" + resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.15.0.tgz#c8a2a0d183c3eb48ae176aa078c1b9daa584cf9d" + integrity sha512-wY4FRGl0ZI+ZU4Jo/yjdBu0lVTSML58pu6PgGtJmCufvzfV565pUF6iACQt092uFOd49iLOTX/sEVmHtbSrS+w== + dependencies: + "@typescript-eslint/eslint-plugin" "8.15.0" + "@typescript-eslint/parser" "8.15.0" + "@typescript-eslint/utils" "8.15.0" + typescript@^5.6.3: version "5.6.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b"