From 92e0f07fd24d7ee7aac166c0dc171e44429ac298 Mon Sep 17 00:00:00 2001 From: Daniel Esteves Date: Sat, 2 Apr 2022 21:30:45 -0400 Subject: [PATCH 1/4] test: using fetch only for test files --- package.json | 1 + packages/react/.eslintrc | 8 +-- packages/react/__tests__/vimeo-lite.test.tsx | 1 + .../react/__tests__/youtube-lite.test.tsx | 1 + packages/react/package.json | 3 +- packages/utils/.eslintrc | 6 +-- packages/utils/package.json | 3 +- packages/utils/src/get-vimeo-poster-url.ts | 3 -- packages/vue/.eslintrc | 12 +++-- packages/vue/__tests__/vimeo-lite.test.ts | 1 + packages/vue/__tests__/youtube-lite.test.ts | 1 + .../aspect-ratio/aspect-ratio-item.vue | 3 -- .../components/aspect-ratio/aspect-ratio.vue | 3 -- .../src/components/vimeo-lite/vimeo-lite.vue | 7 +-- .../components/youtube-lite/youtube-lite.vue | 7 +-- yarn.lock | 52 +++++-------------- 16 files changed, 39 insertions(+), 73 deletions(-) diff --git a/package.json b/package.json index 26809fc..b126475 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "c8": "^7.11.0", "eslint": "^8.12.0", "eslint-config-prettier": "^8.5.0", + "isomorphic-fetch": "^3.0.0", "jsdom": "^19.0.0", "lerna": "^4.0.0", "npm-run-all": "^4.1.5", diff --git a/packages/react/.eslintrc b/packages/react/.eslintrc index 6251564..c45553e 100644 --- a/packages/react/.eslintrc +++ b/packages/react/.eslintrc @@ -1,14 +1,10 @@ { "env": { "browser": true, + "jest": true, "node": true }, - "extends": [ - "eslint:recommended", - "plugin:react/recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], + "extends": ["eslint:recommended", "plugin:react/recommended", "prettier"], "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaFeatures": { diff --git a/packages/react/__tests__/vimeo-lite.test.tsx b/packages/react/__tests__/vimeo-lite.test.tsx index 3e241db..2feb08a 100644 --- a/packages/react/__tests__/vimeo-lite.test.tsx +++ b/packages/react/__tests__/vimeo-lite.test.tsx @@ -1,5 +1,6 @@ // Dependencies import { render } from '@testing-library/react'; +import 'isomorphic-fetch'; // Internals import { VimeoLite } from '../src'; diff --git a/packages/react/__tests__/youtube-lite.test.tsx b/packages/react/__tests__/youtube-lite.test.tsx index b566c49..cda879a 100644 --- a/packages/react/__tests__/youtube-lite.test.tsx +++ b/packages/react/__tests__/youtube-lite.test.tsx @@ -1,5 +1,6 @@ // Dependencies import { render } from '@testing-library/react'; +import 'isomorphic-fetch'; // Internals import { YoutubeLite } from '../src'; diff --git a/packages/react/package.json b/packages/react/package.json index 386f8a1..b57c149 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -53,8 +53,7 @@ "devDependencies": { "@testing-library/react": "^12.1.4", "eslint-plugin-jsx-a11y": "^6.5.1", - "eslint-plugin-react": "^7.29.4", - "node-fetch": "^3.2.3" + "eslint-plugin-react": "^7.29.4" }, "peerDependencies": { "react": "^16 || ^17 || ^18" diff --git a/packages/utils/.eslintrc b/packages/utils/.eslintrc index e8bcc9c..ccdba83 100644 --- a/packages/utils/.eslintrc +++ b/packages/utils/.eslintrc @@ -4,11 +4,7 @@ "es2021": true, "node": true }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], + "extends": ["eslint:recommended", "prettier"], "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": 13, diff --git a/packages/utils/package.json b/packages/utils/package.json index 08d6ee9..f29e444 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -43,8 +43,7 @@ "test": "vitest run" }, "dependencies": { - "browser-monads-ts": "^2.0.1", - "node-fetch": "^3.2.3" + "browser-monads-ts": "^2.0.1" }, "devDependencies": { "happy-dom": "^2.52.0" diff --git a/packages/utils/src/get-vimeo-poster-url.ts b/packages/utils/src/get-vimeo-poster-url.ts index 816cf68..cf4d990 100644 --- a/packages/utils/src/get-vimeo-poster-url.ts +++ b/packages/utils/src/get-vimeo-poster-url.ts @@ -1,6 +1,3 @@ -// Dependencies -import fetch from 'node-fetch'; - // Internals import canUseWebP from './can-use-webp'; diff --git a/packages/vue/.eslintrc b/packages/vue/.eslintrc index bc91f03..e1bb97f 100644 --- a/packages/vue/.eslintrc +++ b/packages/vue/.eslintrc @@ -1,16 +1,20 @@ { "env": { "browser": true, - "node": true + "es2021": true, + "node": true, + "vue/setup-compiler-macros": true }, "extends": [ - "plugin:vue/vue3-essential", + "plugin:vue/vue3-recommended", "eslint:recommended", "@vue/typescript/recommended", - "plugin:prettier/recommended" + "prettier" ], + "parser": "vue-eslint-parser", "parserOptions": { - "ecmaVersion": 2020 + "ecmaVersion": 2021, + "parser": "@typescript-eslint/parser" }, "plugins": ["vuejs-accessibility"], "rules": { diff --git a/packages/vue/__tests__/vimeo-lite.test.ts b/packages/vue/__tests__/vimeo-lite.test.ts index 0bd9400..f3baaf9 100644 --- a/packages/vue/__tests__/vimeo-lite.test.ts +++ b/packages/vue/__tests__/vimeo-lite.test.ts @@ -1,5 +1,6 @@ // Dependencies import { render, waitFor } from '@testing-library/vue'; +import 'isomorphic-fetch'; // Internals import { VimeoLite } from '../src'; diff --git a/packages/vue/__tests__/youtube-lite.test.ts b/packages/vue/__tests__/youtube-lite.test.ts index a5ccae8..36eb387 100644 --- a/packages/vue/__tests__/youtube-lite.test.ts +++ b/packages/vue/__tests__/youtube-lite.test.ts @@ -1,5 +1,6 @@ // Dependencies import { render, waitFor } from '@testing-library/vue'; +import 'isomorphic-fetch'; // Internals import { YoutubeLite } from '../src'; diff --git a/packages/vue/src/components/aspect-ratio/aspect-ratio-item.vue b/packages/vue/src/components/aspect-ratio/aspect-ratio-item.vue index b3b7088..e6c6821 100644 --- a/packages/vue/src/components/aspect-ratio/aspect-ratio-item.vue +++ b/packages/vue/src/components/aspect-ratio/aspect-ratio-item.vue @@ -1,7 +1,4 @@