Skip to content

Commit

Permalink
use prettier for formatting rules
Browse files Browse the repository at this point in the history
texample README.md
  • Loading branch information
paed01 committed May 20, 2024
1 parent 68ec055 commit 4d4cdd9
Show file tree
Hide file tree
Showing 16 changed files with 195 additions and 197 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

122 changes: 0 additions & 122 deletions .eslintrc.json

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 14, 16, 18, latest ]
node-version: [18, 20, latest]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm i
- run: npm run test:lcov
- name: Coveralls
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.node-version }}
Expand All @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
9 changes: 0 additions & 9 deletions .mocharc.cjs

This file was deleted.

5 changes: 5 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"reporter": "spec",
"recursive": true,
"require": ["chai/register-expect.js"]
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
18
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tabWidth": 2,
"printWidth": 140,
"singleQuote": true
}
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
chronokinesis
=============
# chronokinesis

[![Build](https://github.com/paed01/chronokinesis/actions/workflows/build.yaml/badge.svg)](https://github.com/paed01/chronokinesis/actions/workflows/build.yaml) [![Coverage Status](https://coveralls.io/repos/github/paed01/chronokinesis/badge.svg?branch=master)](https://coveralls.io/github/paed01/chronokinesis?branch=master)

Mock time and date for traveling and freezing. Inspired and borrowed from [timekeeper](https://github.com/vesln/timekeeper).
Expand Down Expand Up @@ -92,7 +92,7 @@ let date = new Date(2018, 0, 31);

ck.travel(date);

setTimeout(function() {
setTimeout(function () {
console.log(new Date());
ck.reset();
}, 1500);
Expand All @@ -110,7 +110,7 @@ ck.freeze(date);

ck.travel(moment().add(1, 'year'));

setTimeout(function() {
setTimeout(function () {
console.log(`Still frozen but one year ahead ${new Date()}`);

ck.reset();
Expand Down Expand Up @@ -148,12 +148,12 @@ Resets Date to current glory.
import * as ck from 'chronokinesis';

ck.freeze(2060, 0, 1);
console.log(`end of time is reached at ${new Date()} according to Newton`)
console.log(`end of time is reached at ${new Date()} according to Newton`);

ck.reset();

// Today
console.log(new Date())
console.log(new Date());
```

## `isKeepingTime()`
Expand Down Expand Up @@ -183,7 +183,7 @@ import * as ck from 'chronokinesis';
const tz = ck.timezone('Asia/Shanghai');

// Now in Shanghai
console.log(new Date())
console.log(new Date());

tz.freeze();
```
Expand All @@ -193,7 +193,7 @@ tz.freeze();
Time zone traveller api.

```javascript
import {TimeZoneTraveller} from 'chronokinesis';
import { TimeZoneTraveller } from 'chronokinesis';

const timezone = new TimeZoneTraveller('Asia/Shanghai');

Expand Down
6 changes: 3 additions & 3 deletions dist/chronokinesis.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@
}

function useFakeDate() {
Date = FakeDate; // eslint-disable-line no-global-assign
Date = FakeDate;
}

function useNativeDate() {
Date = NativeDate; // eslint-disable-line no-global-assign
Date = NativeDate;
}

function time() {
Expand All @@ -166,7 +166,7 @@
function toUTC(formatter, dt) {
let year, month, day, hour, minute, second;

for (const {type, value} of formatter.formatToParts(dt)) {
for (const { type, value } of formatter.formatToParts(dt)) {
switch (type) {
case 'year':
year = parseInt(value);
Expand Down
6 changes: 3 additions & 3 deletions dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ function timezone(timeZone, ...args) {
}

function useFakeDate() {
Date = FakeDate; // eslint-disable-line no-global-assign
Date = FakeDate;
}

function useNativeDate() {
Date = NativeDate; // eslint-disable-line no-global-assign
Date = NativeDate;
}

function time() {
Expand All @@ -162,7 +162,7 @@ function instantiate(type, args) {
function toUTC(formatter, dt) {
let year, month, day, hour, minute, second;

for (const {type, value} of formatter.formatToParts(dt)) {
for (const { type, value } of formatter.formatToParts(dt)) {
switch (type) {
case 'year':
year = parseInt(value);
Expand Down
Loading

0 comments on commit 4d4cdd9

Please sign in to comment.