Skip to content

Commit

Permalink
Merge pull request #38346 from callstack-internal/jbroma/perf/date-fn…
Browse files Browse the repository at this point in the history
…s-locale-imports

[NoQA] [Audit][Implementation] Bundle size: use submodule imports for `date-fns/locale`
  • Loading branch information
mountiny authored Mar 18, 2024
2 parents 896f40c + defbde3 commit 984d7f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ const restrictedImportPaths = [
name: '@styles/theme/illustrations',
message: 'Do not import theme illustrations directly. Please use the `useThemeIllustrations` hook instead.',
},
{
name: 'date-fns/locale',
message: "Do not import 'date-fns/locale' directly. Please use the submodule import instead, like 'date-fns/locale/en-GB'.",
},
];

const restrictedImportPatterns = [
Expand Down
3 changes: 2 additions & 1 deletion src/libs/DateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import {
subMinutes,
} from 'date-fns';
import {formatInTimeZone, format as tzFormat, utcToZonedTime, zonedTimeToUtc} from 'date-fns-tz';
import {enGB, es} from 'date-fns/locale';
import enGB from 'date-fns/locale/en-GB';
import es from 'date-fns/locale/es';
import throttle from 'lodash/throttle';
import Onyx from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
Expand Down

0 comments on commit 984d7f6

Please sign in to comment.