@bonniernews/eslint-config 2.0.4 → 2.0.5
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/base-config.js +15 -9
- package/package.json +1 -1
package/base-config.js
CHANGED
|
@@ -9,22 +9,28 @@ const eslintPluginN = require("eslint-plugin-n");
|
|
|
9
9
|
const eslintPluginImport = require("eslint-plugin-import");
|
|
10
10
|
const eslintPluginTypescriptRules = require("@bonniernews/eslint-plugin-typescript-rules");
|
|
11
11
|
|
|
12
|
-
function findPackageJson(
|
|
13
|
-
let dir =
|
|
12
|
+
function findPackageJson() {
|
|
13
|
+
let dir = process.cwd();
|
|
14
|
+
const root = path.parse(dir).root;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
while (dir !== root) {
|
|
16
17
|
const pkgfile = path.join(dir, "package.json");
|
|
17
18
|
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
continue;
|
|
19
|
+
if (fs.existsSync(pkgfile)) {
|
|
20
|
+
return pkgfile;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
|
|
23
|
+
if (fs.existsSync(path.join(dir, ".git"))) {
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
dir = path.join(dir, "..");
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
return null;
|
|
25
31
|
}
|
|
26
32
|
|
|
27
|
-
const isModuleProject = require(findPackageJson(
|
|
33
|
+
const isModuleProject = require(findPackageJson()).type === "module";
|
|
28
34
|
const hasES2022Support = parseInt(process.versions.node.split(".").shift(), 10) >= 16;
|
|
29
35
|
|
|
30
36
|
const moduleConfig = {
|