question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule proposal: `prefer-temporal`

See original GitHub issue

The Temporal proposal is currently stage 3. It massively improves date and time handling in JavaScript.

There’s a lot of potential for linting here.

We could block use of Date completely. Would probably have to be behind an option. But as far as I know, Temporal should cover everything Date currently handles.

Fail

Date.now()

Pass

Temporal.now.instant()

We could also potentially prevent use of popular date libraries like moment, Luzon, date-fns, etc.

More specific ideas for listing here wanted.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:7
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
fregantecommented, Jul 20, 2021

On second thought, why? Why would Temporal.Now.instant().epochMilliseconds be better than Date.now()? It’s just a number in both cases and there are no improvements (unlike the new Number.* methods).

I think such rule would make more sense for every Date method except Date.now()

2reactions
sindresorhuscommented, Jul 28, 2021

Luckily we don’t have to decide this yet. We can make the option false at first and see how we feel about it after having used Temporal for a while.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proposed rule: Order Competition Rule
proposed rule would prohibit a restricted competition trading center from internally executing certain orders of individual investors at a ...
Read more >
SEC's Proposed Preferential Treatment Rule
Notably, the Preferential Treatment Rule would apply to all private fund advisers (including those exempt from registration) and their related ...
Read more >
FCA consultation on availability of information in the IPO process
Investment banks and lawyers responded that simultaneous publication would be unlikely to be deliverable and they would prefer temporal separation between the ...
Read more >
Agenda for the 86th meeting of Ecma TC39 - 2021
Agenda topic rules · Such proposals must link to supporting materials prior to the deadline, or else delegates may object to advancement solely ......
Read more >
draft-jennings-rtcweb-signaling-00
RTCWeb Offer/Answer Protocol (ROAP) (Internet-Draft, 2011) ... The offer answer model specifies rules for the bilateral exchange of Session Description ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found