-
-
Notifications
You must be signed in to change notification settings - Fork 557
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test that ensure all files in source directory use
.d.ts
extens…
…ion (#264)
- Loading branch information
Hirotaka Tagawa
authored
Sep 17, 2021
1 parent
6b18d3a
commit 50a7d55
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-disable unicorn/prefer-module */ | ||
const fs = require('fs'); | ||
const process = require('process'); | ||
|
||
const checkSourceFilesExtension = async () => { | ||
try { | ||
const files = await fs.promises.readdir('source'); | ||
|
||
let hasIncorrectFileExtension = false; | ||
for (const file of files) { | ||
if (!file.endsWith('.d.ts')) { | ||
hasIncorrectFileExtension = true; | ||
console.error(`source/${file} extension should be \`.d.ts\`.`); | ||
} | ||
} | ||
|
||
if (hasIncorrectFileExtension) { | ||
process.exitCode = 1; | ||
} | ||
} catch (error) { | ||
console.error(error); | ||
process.exitCode = 1; | ||
} | ||
}; | ||
|
||
checkSourceFilesExtension(); |