@kyh/eslint-config 1.0.0 → 1.0.2

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/base.js +22 -1
  3. package/package.json +5 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @kyh/eslint-config
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - update gitignore search
8
+
9
+ ## 1.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - update gitignore location
14
+
3
15
  ## 1.0.0
4
16
 
5
17
  ### Major Changes
package/base.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="./types.d.ts" />
2
2
 
3
+ import * as fs from "node:fs";
3
4
  import * as path from "node:path";
4
5
  import { includeIgnoreFile } from "@eslint/compat";
5
6
  import eslint from "@eslint/js";
@@ -7,9 +8,29 @@ import importPlugin from "eslint-plugin-import";
7
8
  import turboPlugin from "eslint-plugin-turbo";
8
9
  import tseslint from "typescript-eslint";
9
10
 
11
+ async function findGitignorePath(startDir) {
12
+ const gitignorePath = path.join(startDir, ".gitignore");
13
+
14
+ try {
15
+ await fs.promises.access(gitignorePath, fs.constants.F_OK);
16
+ return gitignorePath;
17
+ } catch {
18
+ // .gitignore not found in current directory
19
+ const parentDir = path.dirname(startDir);
20
+
21
+ // Check if we've reached the root directory
22
+ if (parentDir === startDir) {
23
+ return null; // .gitignore not found
24
+ }
25
+
26
+ // Recursively search in the parent directory
27
+ return findGitignorePath(parentDir);
28
+ }
29
+ }
30
+
10
31
  export default tseslint.config(
11
32
  // Ignore files not tracked by VCS and any config files
12
- includeIgnoreFile(path.join(import.meta.dirname, "../../.gitignore")),
33
+ includeIgnoreFile(await findGitignorePath(import.meta.dirname)),
13
34
  { ignores: ["**/*.config.*"] },
14
35
  {
15
36
  files: ["**/*.js", "**/*.ts", "**/*.tsx"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kyh/eslint-config",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -15,18 +15,17 @@
15
15
  "@next/eslint-plugin-next": "^14.2.5",
16
16
  "eslint-plugin-import": "^2.29.1",
17
17
  "eslint-plugin-jsx-a11y": "^6.9.0",
18
- "eslint-plugin-prefer-arrow-functions": "^3.3.2",
19
18
  "eslint-plugin-react": "^7.35.0",
20
19
  "eslint-plugin-react-hooks": "rc",
21
- "eslint-plugin-turbo": "^2.0.12",
22
- "typescript-eslint": "^8.0.1"
20
+ "eslint-plugin-turbo": "^2.0.13",
21
+ "typescript-eslint": "^8.1.0"
23
22
  },
24
23
  "devDependencies": {
25
24
  "eslint": "^9.9.0",
26
25
  "prettier": "^3.3.3",
27
26
  "typescript": "^5.5.4",
28
- "@kyh/prettier-config": "1.0.0",
29
- "@kyh/tsconfig": "1.0.0"
27
+ "@kyh/prettier-config": "1.0.2",
28
+ "@kyh/tsconfig": "1.0.2"
30
29
  },
31
30
  "prettier": "@kyh/prettier-config",
32
31
  "scripts": {