npm init private
npm install @now/node
curl -o .prettierrc https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.prettierrc
curl -o .prettierignore https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.prettierignore
mkdir .vscode
curl -o .vscode/extensions.json https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.vscode_extensions.json
curl -o .vscode/settings.json https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.vscode_settings.json
curl -o .editorconfig https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.editorconfig
npm install --save-dev eslint eslint-plugin-flowtype@3
./node_modules/.bin/eslint --init
Reply as follow:
- How would you like to use ESLint?
To check syntax, find problems, and enforce code style
- What type of modules does your project use?
JavaScript modules (import/export)
- Which framework does your project use?
None of these
- Does your project use TypeScript?
Yes
- Where does your code run?
Node
- How would you like to define a style for your project?
Use a popular style guide
- Which style guide do you want to follow?
Airbnb: https://github.com/airbnb/javascript
- What format do you want your config file to be in?
JSON
Then install the prettier plugin
npm install --save-dev eslint-config-airbnb-typescript prettier eslint-config-prettier eslint-plugin-prettier
Add the Rules for prettier to the .eslintrc.json
curl -o .eslintrc.json https://gist.githubusercontent.com/vdelacou/d6a880059777451a913acd962b8e43a8/raw/.eslintrc.json
curl -o .eslintignore https://gist.githubusercontent.com/vdelacou/58484f1c11af70aaa457f4e5c289e893/raw/.eslintignore
npm install --save-dev husky
Add to you package.json
"husky": {
"hooks": {
"pre-commit": "npm run lint",
"pre-push": "npm run lint"
}
}
Add to your script in package.json
"scripts": {
...
"lint": "eslint . --ext .js,.ts",
...
}
npm install --save typescript
curl -o tsconfig.json https://gist.githubusercontent.com/vdelacou/d6a880059777451a913acd962b8e43a8/raw/tsconfig.json
mkdir api
curl -o api/user.ts https://gist.githubusercontent.com/vdelacou/d6a880059777451a913acd962b8e43a8/raw/user.ts
now dev
(need deploy one time first with now
)
curl --request GET http://localhost:3000/api/user