1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 11:28:51 +01:00
metamask-extension/development/fitness-functions/rules/javascript-additions.ts

19 lines
578 B
TypeScript
Raw Normal View History

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 };