Skip to content

Commit

Permalink
chore: use prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
westeezy committed Apr 20, 2022
1 parent 3c5e5d0 commit df97f87
Show file tree
Hide file tree
Showing 14 changed files with 203 additions and 162 deletions.
12 changes: 6 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* @flow */

module.exports = {
'extends': './node_modules/@krakenjs/grumbler-scripts/config/.eslintrc-node.js',
'rules': {
// legacy rule settings
'prefer-const': 'off',
'flowtype/require-exact-type': 'off'
}
extends: "./node_modules/@krakenjs/grumbler-scripts/config/.eslintrc-node.js",
rules: {
// legacy rule settings
"prefer-const": "off",
"flowtype/require-exact-type": "off",
},
};
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- name: ⎔ Setup node
uses: actions/setup-node@v2
with:
node-version: '14'
registry-url: 'https://registry.npmjs.org'
node-version: "14"
registry-url: "https://registry.npmjs.org"

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
dist
coverage
flow-typed
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
express-promisified
-------------------
## express-promisified

Express with promises

Expand Down Expand Up @@ -42,4 +41,4 @@ const certificate = fs.readFileSync('./creds/localhost.crt');
...

server.listenHTTPS({ port, privateKey, certificate })
```
```
6 changes: 3 additions & 3 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@krakenjs/grumbler-scripts/config/.babelrc-node"
}
{
"extends": "@krakenjs/grumbler-scripts/config/.babelrc-node"
}
18 changes: 12 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import express from 'express';
import express from "express";

export interface AppServerType {
EVENT: { SHUTDOWN: 'shutdown' };
EVENT: { SHUTDOWN: "shutdown" };
close: () => Promise<void>;
on: (event: string, handler: () => void) => { cancel: () => void; } ;
listen: (options: {port: number}) => Promise<AppServerType>;
get: (url: string, handler: (req: express.Request, res: express.Response) => Promise<void> | void) => AppServerType;
on: (event: string, handler: () => void) => { cancel: () => void };
listen: (options: { port: number }) => Promise<AppServerType>;
get: (
url: string,
handler: (
req: express.Request,
res: express.Response
) => Promise<void> | void
) => AppServerType;
}

export function server(): AppServerType;
export function server(): AppServerType;
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* @flow */

// eslint-disable-next-line import/no-commonjs
module.exports = require('./src');
module.exports = require("./src");
5 changes: 2 additions & 3 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expectType } from 'tsd';

import {AppServerType, server} from '.';
import { expectType } from "tsd";

import { AppServerType, server } from ".";

const appServer: AppServerType = server();
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
"flow-typed": "flow-typed install",
"flow:build": "flow gen-flow-files ./src/index.js --out-dir ./src",
"babel": "babel ./src --ignore=node_modules --out-dir ./src --source-maps inline",
"test": "npm run flow-typed && npm run lint && npm run flow && npm run tsd",
"test": "npm run format:check && npm run flow-typed && npm run lint && npm run flow && npm run tsd",
"tsd": "tsd",
"flow": "flow",
"format": "prettier --write --ignore-unknown .",
"format:check": "prettier --check .",
"lint": "eslint src/ *.js",
"prepublish": "in-publish && npm run babel || not-in-publish",
"postpublish": "git checkout ./src"
"postpublish": "git checkout ./src",
"prepare": "husky install"
},
"repository": {
"type": "git",
Expand All @@ -31,14 +34,20 @@
},
"homepage": "https://github.com/krakenjs/express-promisified#readme",
"devDependencies": {
"@krakenjs/grumbler-scripts": "^6.0.2",
"@krakenjs/grumbler-scripts": "^7.0.0-alpha.1",
"@types/express": "^4.17.13",
"flow-bin": "^0.69.0",
"husky": "^7.0.4",
"in-publish": "^2.0.1",
"lint-staged": "^12.4.0",
"prettier": "^2.6.2",
"tsd": "^0.19.1",
"yargs-parser": "^10.0.0"
},
"peerDependencies": {
"express": "^4"
},
"lint-staged": {
"*": "prettier --write --ignore-unknown"
}
}
Loading

0 comments on commit df97f87

Please sign in to comment.