@theholocron/eslint-config 8.4.2 → 8.4.4
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/configs/base.js +28 -11
- package/package.json +3 -3
package/dist/configs/base.js
CHANGED
|
@@ -1,24 +1,41 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
2
|
+
import { dirname, join, parse } from "node:path";
|
|
3
3
|
import { includeIgnoreFile } from "@eslint/compat";
|
|
4
4
|
import js from "@eslint/js";
|
|
5
|
-
import globals from "globals";
|
|
6
5
|
import simpleImportSort from "eslint-plugin-simple-import-sort";
|
|
6
|
+
import globals from "globals";
|
|
7
7
|
//#region configs/base.ts
|
|
8
8
|
/**
|
|
9
9
|
* Ignore whatever the consuming repo's own .gitignore already ignores
|
|
10
10
|
* (dist/, coverage/, node_modules/, …) instead of every repo hand-maintaining
|
|
11
|
-
* its own `ignores:` array in eslint.config.ts.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
11
|
+
* its own `ignores:` array in eslint.config.ts. Walks up from process.cwd()
|
|
12
|
+
* to find it, rather than checking cwd alone — a monorepo package almost
|
|
13
|
+
* never has its own .gitignore (the root one covers the whole tree), and
|
|
14
|
+
* astromech's resolver (config-resolution workstream, #676 in
|
|
15
|
+
* theholocron/holocron) invokes `eslint --config <shared path>` with cwd set
|
|
16
|
+
* to the PACKAGE directory for per-package fan-out, not the repo root. A
|
|
17
|
+
* cwd-only check silently found nothing there and produced no ignores at
|
|
18
|
+
* all — dist/coverage build output got linted for real, discovered when
|
|
19
|
+
* theholocron/clients#348 hit real simple-import-sort errors in generated
|
|
20
|
+
* .d.mts files. Stops at the first .git directory found (the actual repo
|
|
21
|
+
* root) or the filesystem root, whichever comes first — never walks past
|
|
22
|
+
* the repo. A repo without a .gitignore anywhere in that walk (unusual, but
|
|
23
|
+
* not invalid) just gets no extra ignores from this — never throws.
|
|
18
24
|
*/
|
|
25
|
+
function findGitignore(startDir) {
|
|
26
|
+
let dir = startDir;
|
|
27
|
+
for (;;) {
|
|
28
|
+
const candidate = join(dir, ".gitignore");
|
|
29
|
+
if (existsSync(candidate)) return candidate;
|
|
30
|
+
if (existsSync(join(dir, ".git"))) return void 0;
|
|
31
|
+
const parent = dirname(dir);
|
|
32
|
+
if (parent === dir || dir === parse(dir).root) return void 0;
|
|
33
|
+
dir = parent;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
19
36
|
function gitignoreConfig() {
|
|
20
|
-
const gitignorePath =
|
|
21
|
-
if (!
|
|
37
|
+
const gitignorePath = findGitignore(process.cwd());
|
|
38
|
+
if (!gitignorePath) return void 0;
|
|
22
39
|
return includeIgnoreFile(gitignorePath, "@theholocron/gitignore");
|
|
23
40
|
}
|
|
24
41
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/eslint-config",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.4",
|
|
4
4
|
"description": "A ESLint configuration for writing well-formed Javascript within the Galaxy.",
|
|
5
5
|
"homepage": "https://github.com/theholocron/configs/tree/main/packages/eslint-config#readme",
|
|
6
6
|
"bugs": "https://github.com/theholocron/configs/issues",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"typescript": "^5.9.3",
|
|
36
36
|
"typescript-eslint": "^8.67.0",
|
|
37
37
|
"vitest": "^4.1.10",
|
|
38
|
-
"@theholocron/tsconfig": "8.4.
|
|
39
|
-
"@theholocron/vitest-config": "8.4.
|
|
38
|
+
"@theholocron/tsconfig": "8.4.4",
|
|
39
|
+
"@theholocron/vitest-config": "8.4.4"
|
|
40
40
|
},
|
|
41
41
|
"exports": {
|
|
42
42
|
".": {
|