@cabify/eslint-config 3.0.1-beta-36 → 3.0.1
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/dist/conditionalPackages-CS9m2_zE.js +25 -0
- package/dist/conditionalPackagesLegacy.cjs +45 -0
- package/dist/eslint.config.cjs +191 -0
- package/dist/eslint.config.js +83810 -0
- package/dist/jest.cjs +1 -0
- package/dist/jest.js +11 -0
- package/dist/ts.cjs +1 -0
- package/dist/ts.js +166 -0
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
async function n(t) {
|
|
2
|
+
try {
|
|
3
|
+
return await import(t), !0;
|
|
4
|
+
} catch {
|
|
5
|
+
return !1;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
const l = async () => {
|
|
9
|
+
let t = !1, a = !1, e = [], s = {};
|
|
10
|
+
if (t = await n("typescript"), a = await n("jest"), t) {
|
|
11
|
+
const { tsLintConfig: i } = await import("./ts.js");
|
|
12
|
+
e = i;
|
|
13
|
+
}
|
|
14
|
+
if (a) {
|
|
15
|
+
const { jestConf: i } = await import("./jest.js");
|
|
16
|
+
s = i;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
jestConfigs: s,
|
|
20
|
+
tsConfigs: e
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
l as getConditionalPackages
|
|
25
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
|
2
|
+
|
|
3
|
+
/* eslint-disable global-require */
|
|
4
|
+
function isPackageAvailable(packageName) {
|
|
5
|
+
try {
|
|
6
|
+
// Dynamically require the package
|
|
7
|
+
require.resolve(packageName);
|
|
8
|
+
return true;
|
|
9
|
+
} catch (_) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const getConditionalPackages = () => {
|
|
15
|
+
let isTSAvailable = false;
|
|
16
|
+
let isJestAvailable = false;
|
|
17
|
+
let tsConfigs = [];
|
|
18
|
+
let jestConfigs = {};
|
|
19
|
+
|
|
20
|
+
isTSAvailable = isPackageAvailable('typescript');
|
|
21
|
+
isJestAvailable = isPackageAvailable('jest');
|
|
22
|
+
|
|
23
|
+
if (isTSAvailable) {
|
|
24
|
+
// this file will be included in the build process
|
|
25
|
+
// eslint-disable-next-line import/no-unresolved
|
|
26
|
+
const tsModule = require('./ts.cjs');
|
|
27
|
+
tsConfigs = tsModule.tsLintConfig;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (isJestAvailable) {
|
|
31
|
+
// this file will be included in the build process
|
|
32
|
+
// eslint-disable-next-line import/no-unresolved
|
|
33
|
+
const jestModule = require('./jest.cjs');
|
|
34
|
+
jestConfigs = jestModule.jestConf;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
jestConfigs,
|
|
39
|
+
tsConfigs,
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
getConditionalPackages,
|
|
45
|
+
};
|