@wkovacs64/eslint-config 7.2.2 → 7.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +14 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -13,18 +13,21 @@ const ERROR = 'error';
13
13
  const WARN = 'warn';
14
14
  const OFF = 'off';
15
15
 
16
- const has = (pkg) =>
17
- import(pkg).then(
18
- () => true,
19
- () => false,
20
- );
16
+ function has(pkgName) {
17
+ try {
18
+ import.meta.resolve(pkgName, import.meta.url);
19
+ return true;
20
+ } catch {
21
+ return false;
22
+ }
23
+ }
21
24
 
22
- const hasTypeScript = await has('typescript');
23
- const hasReact = await has('react');
24
- const hasTestingLibrary = await has('@testing-library/dom');
25
- const hasJestDom = await has('@testing-library/jest-dom');
26
- const hasVitest = await has('vitest');
27
- const hasPlaywright = await has('@playwright/test');
25
+ const hasTypeScript = has('typescript');
26
+ const hasReact = has('react');
27
+ const hasTestingLibrary = has('@testing-library/dom');
28
+ const hasJestDom = has('@testing-library/jest-dom');
29
+ const hasVitest = has('vitest');
30
+ const hasPlaywright = has('@playwright/test');
28
31
 
29
32
  const vitestFiles = ['**/__tests__/**/*', '**/*.test.*'];
30
33
  const testFiles = ['**/tests/**', '**/#tests/**', ...vitestFiles];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wkovacs64/eslint-config",
3
- "version": "7.2.2",
3
+ "version": "7.2.4",
4
4
  "description": "@wKovacs64 ESLint config",
5
5
  "keywords": [
6
6
  "eslint",