-
-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into upgrade-testing-library-jest-dom
- Loading branch information
Showing
22 changed files
with
1,828 additions
and
129 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import fs from 'fs/promises'; // Import fs.promises for async operations | ||
import path from 'path'; | ||
|
||
// List of files to skip | ||
const filesToSkip = [ | ||
'index.tsx', | ||
'EventActionItems.tsx', | ||
'OrgPostCard.tsx', | ||
'UsersTableItem.tsx', | ||
'FundCampaignPledge.tsx' | ||
]; | ||
|
||
// Recursively find all .tsx files, excluding files listed in filesToSkip | ||
async function findTsxFiles(dir) { | ||
let results = []; | ||
try { | ||
const list = await fs.readdir(dir); | ||
for (const file of list) { | ||
const filePath = path.join(dir, file); | ||
const stat = await fs.stat(filePath); | ||
if (stat.isDirectory()) { | ||
results = results.concat(await findTsxFiles(filePath)); | ||
} else if ( | ||
filePath.endsWith('.tsx') && | ||
!filePath.endsWith('.test.tsx') && | ||
!filesToSkip.includes(path.relative(dir, filePath)) | ||
) { | ||
results.push(filePath); | ||
} | ||
} | ||
} catch (err) { | ||
console.error(`Error reading directory ${dir}: ${err.message}`); | ||
} | ||
return results; | ||
} | ||
|
||
// Check if a file contains at least one TSDoc comment | ||
async function containsTsDocComment(filePath) { | ||
try { | ||
const content = await fs.readFile(filePath, 'utf8'); | ||
return /\/\*\*[\s\S]*?\*\//.test(content); | ||
} catch (err) { | ||
console.error(`Error reading file ${filePath}: ${err.message}`); | ||
return false; | ||
} | ||
} | ||
|
||
// Main function to run the validation | ||
async function run() { | ||
const dir = process.argv[2] || './src'; // Allow directory path as a command-line argument | ||
const files = await findTsxFiles(dir); | ||
const filesWithoutTsDoc = []; | ||
|
||
for (const file of files) { | ||
if (!await containsTsDocComment(file)) { | ||
filesWithoutTsDoc.push(file); | ||
} | ||
} | ||
|
||
if (filesWithoutTsDoc.length > 0) { | ||
filesWithoutTsDoc.forEach(file => { | ||
console.error(`No TSDoc comment found in file: ${file}`); | ||
}); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
run(); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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 |
---|---|---|
|
@@ -134,3 +134,8 @@ | |
.subTagsLink:hover i { | ||
visibility: visible; | ||
} | ||
|
||
.tagsBreadCrumbs { | ||
color: var(--bs-gray); | ||
cursor: pointer; | ||
} |
Oops, something went wrong.