typescript.lang.best-practice.moment-deprecated.moment-deprecated
semgrep
Author
unknown
Download Count*
License
Moment is a legacy project in maintenance mode. Consider using libraries that are actively supported, e.g. dayjs
.
Run Locally
Run in CI
Defintion
rules:
- id: moment-deprecated
pattern: |
import 'moment'
message: Moment is a legacy project in maintenance mode. Consider using
libraries that are actively supported, e.g. `dayjs`.
languages:
- typescript
- javascript
severity: INFO
metadata:
category: best-practice
technology:
- moment
- dayjs
references:
- https://momentjs.com/docs/#/-project-status/
- https://day.js.org/
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
Examples
moment-deprecated.tsx
// ruleid: moment-deprecated
import moment from 'moment';
// ruleid: moment-deprecated
import { moment } from 'moment';
// ruleid: moment-deprecated
import { moment, something } from 'moment';
// ruleid: moment-deprecated
import Moment, { moment, something } from 'moment';
// ok: moment-deprecated
import dayjs from 'dayjs';
Short Link: https://sg.run/lWej