diff --git a/.eslintrc.jest.yml b/.eslintrc.jest.yml index 4340ddd..0255384 100644 --- a/.eslintrc.jest.yml +++ b/.eslintrc.jest.yml @@ -8,3 +8,4 @@ rules: react/display-name: off # Disable for convenience react/prop-types: off + '@typescript-eslint/no-require-imports': off diff --git a/.eslintrc.production.yml b/.eslintrc.production.yml index c06268b..b63635d 100644 --- a/.eslintrc.production.yml +++ b/.eslintrc.production.yml @@ -24,13 +24,17 @@ rules: import/exports-last: error import/extensions: - error - - always + - ignorePackages # eslint-plugin-import does not understand named import import/first: error import/newline-after-import: error import/no-anonymous-default-export: error import/no-duplicates: error import/no-namespace: error - import/no-unassigned-import: error + import/no-unassigned-import: + - error + - allow: + - '**/*.css' + - dotenv/config settings: import/extensions: - .cjs @@ -41,3 +45,6 @@ settings: - .mts - .ts - .tsx + import/resolver: + node: true + typescript: true diff --git a/.eslintrc.typescript.yml b/.eslintrc.typescript.yml index 3ea0b00..5de2aeb 100644 --- a/.eslintrc.typescript.yml +++ b/.eslintrc.typescript.yml @@ -4,6 +4,9 @@ parser: '@typescript-eslint/parser' plugins: - '@typescript-eslint' rules: + # Shortening if-statement into &&, ||, or ternary operators. + '@typescript-eslint/no-unused-expressions': off + '@typescript-eslint/no-unused-vars': - error - argsIgnorePattern: ^_ diff --git a/.eslintrc.yml b/.eslintrc.yml index ce54f8a..ddb1c8c 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,5 +1,3 @@ -env: - browser: true extends: - eslint:recommended overrides: diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 53e0965..d36f52f 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -1,7 +1,17 @@ name: Prepare release on: - workflow_dispatch: {} + workflow_dispatch: + inputs: + version-to-bump: + default: patch + description: Version to bump + options: + - major + - minor + - patch + required: true + type: choice jobs: call-workflow: @@ -10,3 +20,5 @@ jobs: id-token: write secrets: inherit uses: compulim/workflows/.github/workflows/prepare-release.yml@main + with: + version-to-bump: ${{ inputs.version-to-bump }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 56d9cf8..32b2f32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,14 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### Breaking changes +### Removed -- Removed named exports, please import the defaults instead +- 💢 Removed named exports, please import the defaults instead - Use `import { useRefFrom } from 'use-ref-from'` instead -- Moved build tools from Babel to tsup/esbuild ### Changed +- 💢 Moved build tools from Babel to tsup/esbuild - Bumped dependencies, in PR [#55](https://github.com/compulim/use-ref-from/pull/55), and [#59](https://github.com/compulim/use-ref-from/pull/59) - Development dependencies - [`@babel/core@7.24.6`](https://npmjs.com/package/@babel/core/v/7.24.6) diff --git a/package-lock.json b/package-lock.json index e859d8b..8f2b14b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,8 @@ "@typescript-eslint/eslint-plugin": "^7.14.1", "@typescript-eslint/parser": "^7.14.1", "eslint": "^8.57.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-import-resolver-typescript": "^3.6.3", "eslint-plugin-import": "^2.31.0", "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-react": "^7.34.3", @@ -3136,6 +3138,15 @@ "node": ">= 8" } }, + "node_modules/@nolyfill/is-core-module": { + "version": "1.0.39", + "resolved": "https://registry.npmjs.org/@nolyfill/is-core-module/-/is-core-module-1.0.39.tgz", + "integrity": "sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==", + "dev": true, + "engines": { + "node": ">=12.4.0" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -4868,12 +4879,12 @@ } }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -5061,6 +5072,19 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "node_modules/enhanced-resolve": { + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/entities": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", @@ -5412,6 +5436,41 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/eslint-import-resolver-typescript": { + "version": "3.6.3", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.3.tgz", + "integrity": "sha512-ud9aw4szY9cCT1EWWdGv1L1XR6hh2PaRWif0j2QjQ0pgTY/69iw+W0Z4qZv5wHahOl8isEr+k/JnyAqNQkLkIA==", + "dev": true, + "dependencies": { + "@nolyfill/is-core-module": "1.0.39", + "debug": "^4.3.5", + "enhanced-resolve": "^5.15.0", + "eslint-module-utils": "^2.8.1", + "fast-glob": "^3.3.2", + "get-tsconfig": "^4.7.5", + "is-bun-module": "^1.0.2", + "is-glob": "^4.0.3" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts/projects/eslint-import-resolver-ts" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*", + "eslint-plugin-import-x": "*" + }, + "peerDependenciesMeta": { + "eslint-plugin-import": { + "optional": true + }, + "eslint-plugin-import-x": { + "optional": true + } + } + }, "node_modules/eslint-module-utils": { "version": "2.12.0", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.0.tgz", @@ -6070,6 +6129,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-tsconfig": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz", + "integrity": "sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==", + "dev": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -6519,6 +6590,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-bun-module": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-bun-module/-/is-bun-module-1.2.1.tgz", + "integrity": "sha512-AmidtEM6D6NmUiLOvvU7+IePxjEjOzra2h0pSrsfSAcXwl/83zLLXDByafUJy9k/rKK0pvXMLdwKwGHlX2Ke6Q==", + "dev": true, + "dependencies": { + "semver": "^7.6.3" + } + }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -7945,9 +8025,9 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "node_modules/mz": { @@ -8950,6 +9030,15 @@ "node": ">=4" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/resolve.exports": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", @@ -9116,9 +9205,9 @@ } }, "node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -9542,6 +9631,15 @@ "url": "https://opencollective.com/unts" } }, + "node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", diff --git a/package.json b/package.json index d4e7906..0958679 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,7 @@ ], "scripts": { "build": "npm run build --if-present --workspaces", - "bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix && npm run bump:packages && npm run bump:eslintrc", - "bump:auditfix": "npm audit fix || exit 0", + "bump": "npm run bump:prod && npm run bump:dev && npm run bump:packages && npm run bump:eslintrc", "bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", "bump:eslintrc": "if [ -f node_modules/react/package.json ]; then docker run -e VERSION=$(cat node_modules/react/package.json | jq -r '.version') -i --rm mikefarah/yq '.settings.react.version = strenv(VERSION)' < ./.eslintrc.react.yml | tee /tmp/output.tmp && mv /tmp/output.tmp ./.eslintrc.react.yml; fi", "bump:packages": "npm run bump --if-present --workspaces", @@ -37,6 +36,8 @@ "@typescript-eslint/eslint-plugin": "^7.14.1", "@typescript-eslint/parser": "^7.14.1", "eslint": "^8.57.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-import-resolver-typescript": "^3.6.3", "eslint-plugin-import": "^2.31.0", "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-react": "^7.34.3", diff --git a/packages/integration-test/.eslintrc.custom.yml b/packages/integration-test/.eslintrc.custom.yml new file mode 100644 index 0000000..5c9fc4c --- /dev/null +++ b/packages/integration-test/.eslintrc.custom.yml @@ -0,0 +1,2 @@ +env: + browser: true diff --git a/packages/integration-test/.eslintrc.yml b/packages/integration-test/.eslintrc.yml index feb2088..54b2959 100644 --- a/packages/integration-test/.eslintrc.yml +++ b/packages/integration-test/.eslintrc.yml @@ -1,3 +1,2 @@ extends: - - ../../.eslintrc.react.yml - - ../../.eslintrc.jest.yml + - ./.eslintrc.custom.yml diff --git a/packages/integration-test/package.json b/packages/integration-test/package.json index 0e37552..7ee4fa0 100644 --- a/packages/integration-test/package.json +++ b/packages/integration-test/package.json @@ -4,11 +4,10 @@ "description": "", "private": true, "scripts": { - "bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix", - "bump:auditfix": "npm audit fix || exit 0", + "bump": "npm run bump:prod && npm run bump:dev", "bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", "bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", - "precommit": "eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts ./", + "precommit": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts ./", "switch": "cat package.json | jq --arg SWITCH_NAME $SWITCH_NAME -r '(.[\"switch:\" + $SWITCH_NAME] // {}) as $TEMPLATE | .devDependencies += ($TEMPLATE.devDependencies // {}) | .dependencies += ($TEMPLATE.dependencies // {})' | tee ./package.json.tmp && mv ./package.json.tmp ./package.json", "test": "jest" }, diff --git a/packages/integration-test/tsconfig.custom.json b/packages/integration-test/tsconfig.custom.json new file mode 100644 index 0000000..7a3b017 --- /dev/null +++ b/packages/integration-test/tsconfig.custom.json @@ -0,0 +1,3 @@ +{ + "extends": "@tsconfig/strictest/tsconfig.json" +} diff --git a/packages/integration-test/tsconfig.json b/packages/integration-test/tsconfig.json index 06cabe3..d910d6b 100644 --- a/packages/integration-test/tsconfig.json +++ b/packages/integration-test/tsconfig.json @@ -2,5 +2,6 @@ { "compilerOptions": { "jsx": "react" - } + }, + "extends": "./tsconfig.custom.json" } diff --git a/packages/pages/.eslintrc.custom.yml b/packages/pages/.eslintrc.custom.yml new file mode 100644 index 0000000..e69de29 diff --git a/packages/pages/.eslintrc.yml b/packages/pages/.eslintrc.yml new file mode 100644 index 0000000..a8f533d --- /dev/null +++ b/packages/pages/.eslintrc.yml @@ -0,0 +1,4 @@ +env: + browser: true +extends: + - ./.eslintrc.custom.yml diff --git a/packages/pages/package.json b/packages/pages/package.json index e2258fa..9c6fba0 100644 --- a/packages/pages/package.json +++ b/packages/pages/package.json @@ -5,11 +5,11 @@ "private": true, "scripts": { "build": "esbuild --bundle --entry-names=[name]/[ext]/main --jsx=automatic --minify --outdir=./public/static/ --sourcemap app=./src/app/index.tsx", - "bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix", - "bump:auditfix": "npm audit fix || exit 0", + "bump": "npm run bump:prod && npm run bump:dev", "bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", "bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", - "precommit": "npm run precommit:typescript", + "precommit": "npm run precommit:eslint && npm run precommit:typescript", + "precommit:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts ./src/", "precommit:typescript": "tsc --project ./src/tsconfig.json", "reinstall": "rm -r node_modules package-lock.json && npm install", "start": "npm run build -- --servedir=./public", diff --git a/packages/pages/src/app/index.tsx b/packages/pages/src/app/index.tsx index eb4ebe8..656ba85 100644 --- a/packages/pages/src/app/index.tsx +++ b/packages/pages/src/app/index.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { render } from 'react-dom'; // import { createRoot } from 'react-dom/client'; -import App from './App'; +import App from './App.tsx'; const rootElement = document.getElementById('root'); diff --git a/packages/pages/src/tsconfig.custom.json b/packages/pages/src/tsconfig.custom.json new file mode 100644 index 0000000..7a3b017 --- /dev/null +++ b/packages/pages/src/tsconfig.custom.json @@ -0,0 +1,3 @@ +{ + "extends": "@tsconfig/strictest/tsconfig.json" +} diff --git a/packages/pages/src/tsconfig.json b/packages/pages/src/tsconfig.json index 4ac3c0b..017f0c9 100644 --- a/packages/pages/src/tsconfig.json +++ b/packages/pages/src/tsconfig.json @@ -1,12 +1,18 @@ { "compilerOptions": { + "allowImportingTsExtensions": true, "esModuleInterop": true, "jsx": "react", - "lib": ["DOM", "ESNext", "WebWorker"], + "lib": [ + "DOM", + "ESNext", + "WebWorker" + ], "moduleResolution": "Bundler", "noEmit": true, "strict": true, - "target": "ESNext" + "target": "ESNext", + "types": [] }, - "extends": "@tsconfig/strictest/tsconfig.json" + "extends": "./tsconfig.custom.json" } diff --git a/packages/use-ref-from/.eslintrc.custom.yml b/packages/use-ref-from/.eslintrc.custom.yml new file mode 100644 index 0000000..e69de29 diff --git a/packages/use-ref-from/.eslintrc.yml b/packages/use-ref-from/.eslintrc.yml new file mode 100644 index 0000000..54b2959 --- /dev/null +++ b/packages/use-ref-from/.eslintrc.yml @@ -0,0 +1,2 @@ +extends: + - ./.eslintrc.custom.yml diff --git a/packages/use-ref-from/__tests__/__setup__/typingTestTransformer.js b/packages/use-ref-from/__tests__/__setup__/typingTestTransformer.js index eb4b6f3..b8d3ed5 100644 --- a/packages/use-ref-from/__tests__/__setup__/typingTestTransformer.js +++ b/packages/use-ref-from/__tests__/__setup__/typingTestTransformer.js @@ -8,6 +8,7 @@ const run = ({ filename }) => { const TS_EXPECT_ERROR = /(\/\/\s+)(@ts-expect-error)[\s+(.*)]/gu; const TSCONFIG = { + allowImportingTsExtensions: true, allowSyntheticDefaultImports: true, jsx: typeScript.JsxEmit.React, noEmit: true, diff --git a/packages/use-ref-from/package.json b/packages/use-ref-from/package.json index b97127a..4f81c6f 100644 --- a/packages/use-ref-from/package.json +++ b/packages/use-ref-from/package.json @@ -21,12 +21,11 @@ "typings": "./dist/use-ref-from.d.ts", "scripts": { "build": "tsup", - "bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix", - "bump:auditfix": "npm audit fix || exit 0", + "bump": "npm run bump:prod && npm run bump:dev", "bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", "bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", "precommit": "npm run precommit:eslint && npm run precommit:publint && npm run precommit:typescript:production && npm run precommit:typescript:test", - "precommit:eslint": "eslint ./src/", + "precommit:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint ./src/", "precommit:publint": "publint", "precommit:typescript:production": "tsc --noEmit --project ./src/tsconfig.precommit.production.json", "precommit:typescript:test": "tsc --noEmit --project ./src/tsconfig.precommit.test.json", diff --git a/packages/use-ref-from/src/tsconfig.custom.json b/packages/use-ref-from/src/tsconfig.custom.json new file mode 100644 index 0000000..7a3b017 --- /dev/null +++ b/packages/use-ref-from/src/tsconfig.custom.json @@ -0,0 +1,3 @@ +{ + "extends": "@tsconfig/strictest/tsconfig.json" +} diff --git a/packages/use-ref-from/src/tsconfig.json b/packages/use-ref-from/src/tsconfig.json index 2221ed4..b4c9c14 100644 --- a/packages/use-ref-from/src/tsconfig.json +++ b/packages/use-ref-from/src/tsconfig.json @@ -8,7 +8,11 @@ "moduleResolution": "Bundler", "noEmit": true, "strict": true, - "target": "ESNext" + "target": "ESNext", + "types": [ + "jest", + "node" + ] }, - "extends": "@tsconfig/strictest/tsconfig.json" + "extends": "./tsconfig.custom.json" } diff --git a/packages/use-ref-from/src/tsconfig.precommit.production.json b/packages/use-ref-from/src/tsconfig.precommit.production.json index da317fd..68f3ff3 100644 --- a/packages/use-ref-from/src/tsconfig.precommit.production.json +++ b/packages/use-ref-from/src/tsconfig.precommit.production.json @@ -7,8 +7,15 @@ "moduleResolution": "Bundler", "noEmit": true, "strict": true, - "target": "ESNext" + "target": "ESNext", + "types": [] }, - "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "__tests__/**/*"], - "extends": "@tsconfig/strictest/tsconfig.json" + "exclude": [ + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.test.ts", + "**/*.test.tsx", + "__tests__/**/*" + ], + "extends": "./tsconfig.custom.json" } diff --git a/packages/use-ref-from/src/tsconfig.precommit.test.json b/packages/use-ref-from/src/tsconfig.precommit.test.json index 7f4ffb7..54576c2 100644 --- a/packages/use-ref-from/src/tsconfig.precommit.test.json +++ b/packages/use-ref-from/src/tsconfig.precommit.test.json @@ -1,13 +1,24 @@ { "compilerOptions": { + "allowImportingTsExtensions": true, "esModuleInterop": true, "jsx": "react", "module": "ESNext", "moduleResolution": "Bundler", "noEmit": true, "strict": true, - "target": "ESNext" + "target": "ESNext", + "types": [ + "jest", + "node" + ] }, "extends": "@tsconfig/recommended/tsconfig.json", - "include": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "__tests__/**/*"] + "include": [ + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.test.ts", + "**/*.test.tsx", + "__tests__/**/*" + ] }