@wkovacs64/eslint-config 7.2.2 → 7.2.3

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 +10 -11
  2. package/package.json +2 -1
package/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  //
3
3
  // Forked from https://github.com/epicweb-dev/config
4
4
  //
5
+ import resolveFrom from 'resolve-from';
5
6
  import globals from 'globals';
6
7
  import eslint from '@eslint/js';
7
8
  import tseslint from 'typescript-eslint';
@@ -13,18 +14,16 @@ const ERROR = 'error';
13
14
  const WARN = 'warn';
14
15
  const OFF = 'off';
15
16
 
16
- const has = (pkg) =>
17
- import(pkg).then(
18
- () => true,
19
- () => false,
20
- );
17
+ function has(pkgName) {
18
+ return Boolean(resolveFrom.silent(process.cwd(), pkgName));
19
+ }
21
20
 
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');
21
+ const hasTypeScript = has('typescript');
22
+ const hasReact = has('react');
23
+ const hasTestingLibrary = has('@testing-library/dom');
24
+ const hasJestDom = has('@testing-library/jest-dom');
25
+ const hasVitest = has('vitest');
26
+ const hasPlaywright = has('@playwright/test');
28
27
 
29
28
  const vitestFiles = ['**/__tests__/**/*', '**/*.test.*'];
30
29
  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.3",
4
4
  "description": "@wKovacs64 ESLint config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -60,6 +60,7 @@
60
60
  "eslint-plugin-testing-library": "^6.2.2",
61
61
  "eslint-plugin-vitest": "^0.5.4",
62
62
  "globals": "^15.3.0",
63
+ "resolve-from": "5.0.0",
63
64
  "typescript-eslint": "^8.0.0-alpha.20"
64
65
  },
65
66
  "devDependencies": {