@d-zero/lint-staged-config 5.0.0-dev.86 → 5.0.0-dev.90

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 (2) hide show
  1. package/index.mjs +11 -11
  2. package/package.json +2 -2
package/index.mjs CHANGED
@@ -17,24 +17,24 @@ export default function (dir, mapping) {
17
17
  const commandList = [];
18
18
  const cwd = process.cwd();
19
19
 
20
- dir = !dir
21
- ? // 引数がないならカレントディレクトリ
22
- cwd
23
- : // 絶対パスかどうか
20
+ dir = dir
21
+ ? // 絶対パスかどうか
24
22
  path.isAbsolute(dir)
25
23
  ? // 絶対パスならそのまま
26
24
  dir
27
25
  : // 相対パスなら絶対パスに変換
28
- path.resolve(cwd, dir);
26
+ path.resolve(cwd, dir)
27
+ : // 引数がないならカレントディレクトリ
28
+ cwd;
29
29
 
30
30
  mapping = mapping ?? defaultMapping;
31
31
 
32
- Object.entries(mapping).forEach(([ext, commandTypes]) => {
33
- commandTypes.forEach((commandType) => {
32
+ for (const [ext, commandTypes] of Object.entries(mapping)) {
33
+ for (const commandType of commandTypes) {
34
34
  const shell = commands[commandType];
35
35
 
36
36
  if (!shell) {
37
- return;
37
+ continue;
38
38
  }
39
39
 
40
40
  const pattern = path
@@ -46,12 +46,12 @@ export default function (dir, mapping) {
46
46
  const targetFiles = micromatch(files, pattern);
47
47
 
48
48
  if (targetFiles.length <= 0) {
49
- return;
49
+ continue;
50
50
  }
51
51
 
52
52
  commandList.push(shell + ' ' + targetFiles.map((f) => `"${f}"`).join(' '));
53
- });
54
- });
53
+ }
54
+ }
55
55
 
56
56
  return commandList;
57
57
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-zero/lint-staged-config",
3
- "version": "5.0.0-dev.86+2d1131a",
3
+ "version": "5.0.0-dev.90+e25aaa4",
4
4
  "description": "Configurations of lint-staged",
5
5
  "repository": "https://github.com/d-zero-dev/node-dev-env.git",
6
6
  "author": "D-ZERO Co., Ltd.",
@@ -21,5 +21,5 @@
21
21
  "dependencies": {
22
22
  "lint-staged": "15.2.0"
23
23
  },
24
- "gitHead": "2d1131aefa1377e62cafb3a6e58c7c606835d049"
24
+ "gitHead": "e25aaa4561d8d66f839bf3e007cb6c620ef2d115"
25
25
  }