@cabify/eslint-config 3.0.1-beta-10 → 3.0.1-beta-12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/configs/base.js CHANGED
@@ -19,12 +19,39 @@ import strict from './strict.js';
19
19
  import style from './style.js';
20
20
  import variables from './variables.js';
21
21
 
22
- const isTSAvailable = await isPackageAvailable('typescript');
22
+ async function checkIsTSAvailable() {
23
+ try {
24
+ // Dynamically import the package
25
+ await import('typescript');
26
+ console.log(`Package typescript is available`);
27
+ return true;
28
+ } catch (error) {
29
+ console.log(error);
30
+ console.log(`Package typescript is not available`);
31
+ return false;
32
+ }
33
+ }
34
+
35
+ async function checkJestTSAvailable() {
36
+ try {
37
+ // Dynamically import the package
38
+ await import('jest');
39
+ console.log(`Package jest is available`);
40
+ return true;
41
+ } catch (error) {
42
+ console.log(error);
43
+ console.log(`Package jest is not available`);
44
+ return false;
45
+ }
46
+ }
47
+
48
+ const isTSAvailable = await checkIsTSAvailable();
23
49
  let tsConfigs = [];
24
50
  if (isTSAvailable) {
25
- tsConfigs = await import('./ts.js');
51
+ const { tsLintConfig } = await import('./ts.js');
52
+ tsConfigs = tsLintConfig;
26
53
  }
27
- const isJestAvailable = await isPackageAvailable('jest');
54
+ const isJestAvailable = await checkJestTSAvailable();
28
55
 
29
56
  const configs = [
30
57
  bestPractices,
@@ -54,6 +81,8 @@ const overrides = [
54
81
  },
55
82
  ].filter(Boolean);
56
83
 
84
+ console.log({ tsConfigs });
85
+
57
86
  export default [
58
87
  ...configs,
59
88
  {
package/configs/ts.js CHANGED
@@ -146,9 +146,9 @@ const tsCustomConfig = {
146
146
  };
147
147
 
148
148
  const tsLintConfig = tseslint.config(
149
- ...tseslint.configs.recommended,
150
- ...tseslint.configs.recommendedTypeChecked,
151
- { ...tsCustomConfig },
149
+ tseslint.configs.recommended,
150
+ tseslint.configs.recommendedTypeChecked,
151
+ tsCustomConfig,
152
152
  );
153
153
 
154
154
  if (tsLintConfig.length) {
@@ -158,4 +158,4 @@ if (tsLintConfig.length) {
158
158
  });
159
159
  }
160
160
 
161
- export default tsLintConfig;
161
+ export { tsLintConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabify/eslint-config",
3
- "version": "3.0.1-beta-10",
3
+ "version": "3.0.1-beta-12",
4
4
  "description": "ESLint config for Cabify Javascript projects",
5
5
  "type": "module",
6
6
  "scripts": {