Speed up lint-deps slightly

This commit is contained in:
Evan Hahn 2021-08-23 09:18:21 -05:00 committed by GitHub
parent 75ea2b0ccb
commit 9a54a8672d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,7 +19,8 @@ const basePath = join(__dirname, '../../..');
const searchPattern = normalizePath(join(basePath, '**/*.{js,ts,tsx}')); const searchPattern = normalizePath(join(basePath, '**/*.{js,ts,tsx}'));
const excludedFilesRegexps = [ const excludedFilesRegexp = RegExp(
[
'^release/', '^release/',
'^preload.bundle.js(LICENSE.txt|map)?', '^preload.bundle.js(LICENSE.txt|map)?',
'^storybook-static/', '^storybook-static/',
@ -57,7 +58,6 @@ const excludedFilesRegexps = [
'^libtextsecure/test/test.js', '^libtextsecure/test/test.js',
'^sticker-creator/dist/bundle.js', '^sticker-creator/dist/bundle.js',
'^test/test.js', '^test/test.js',
'^ts/test[^/]*/.+',
'^ts/workers/heicConverter.bundle.js', '^ts/workers/heicConverter.bundle.js',
'^ts/sql/mainWorker.bundle.js', '^ts/sql/mainWorker.bundle.js',
@ -67,6 +67,7 @@ const excludedFilesRegexps = [
// Test files // Test files
'^libtextsecure/test/.+', '^libtextsecure/test/.+',
'^test/.+', '^test/.+',
'^ts/test[^/]*/.+',
// Github workflows // Github workflows
'^.github/.+', '^.github/.+',
@ -287,7 +288,8 @@ const excludedFilesRegexps = [
'^node_modules/webpack-hot-middleware/.+', '^node_modules/webpack-hot-middleware/.+',
'^node_modules/webpack-merge/.+', '^node_modules/webpack-merge/.+',
'^node_modules/webpack/.+', '^node_modules/webpack/.+',
].map(str => new RegExp(str)); ].join('|')
);
function setupRules(allRules: Array<RuleType>) { function setupRules(allRules: Array<RuleType>) {
allRules.forEach((rule: RuleType, index: number) => { allRules.forEach((rule: RuleType, index: number) => {
@ -321,9 +323,7 @@ async function main(): Promise<void> {
async (file: string) => { async (file: string) => {
const relativePath = relative(basePath, file).replace(/\\/g, '/'); const relativePath = relative(basePath, file).replace(/\\/g, '/');
const isFileExcluded = excludedFilesRegexps.some(excludedRegexp => const isFileExcluded = excludedFilesRegexp.test(relativePath);
excludedRegexp.test(relativePath)
);
if (isFileExcluded) { if (isFileExcluded) {
return; return;
} }