mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 11:28:51 +01:00
632ae0b7c3
* Prevent new JS files in shared folder * migrate to typescript * fix types * cleanup
19 lines
578 B
TypeScript
19 lines
578 B
TypeScript
import { SHARED_FOLDER_JS_REGEX } from '../common/constants';
|
|
import {
|
|
filterDiffByFilePath,
|
|
filterDiffFileCreations,
|
|
} from '../common/shared';
|
|
|
|
function preventJavaScriptFileAdditions(diff: string): boolean {
|
|
const sharedFolderDiff = filterDiffByFilePath(diff, SHARED_FOLDER_JS_REGEX);
|
|
const sharedFolderCreationDiff = filterDiffFileCreations(sharedFolderDiff);
|
|
|
|
const hasCreatedAtLeastOneJSFileInShared = sharedFolderCreationDiff !== '';
|
|
if (hasCreatedAtLeastOneJSFileInShared) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
export { preventJavaScriptFileAdditions };
|