Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e579627b7 | ||
|
|
053c5de689 | ||
|
|
d43c846d12 | ||
|
|
437ed30ddb |
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"parser": "babel-eslint",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": "2018"
|
"ecmaVersion": "2018"
|
||||||
},
|
},
|
||||||
|
|||||||
11
.flowconfig
Normal file
11
.flowconfig
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[ignore]
|
||||||
|
|
||||||
|
[include]
|
||||||
|
|
||||||
|
[libs]
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
|
||||||
|
[options]
|
||||||
|
|
||||||
|
[strict]
|
||||||
11
.lintstagedrc
Normal file
11
.lintstagedrc
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"linters": {
|
||||||
|
"*.js": [
|
||||||
|
"eslint"
|
||||||
|
],
|
||||||
|
"*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)": [
|
||||||
|
"prettier --write",
|
||||||
|
"git add"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
1944
package-lock.json
generated
1944
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@@ -5,14 +5,22 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
"format": "prettier --write \"**/*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)\""
|
"flow": "flow",
|
||||||
|
"format": "npm run prettier -- --write",
|
||||||
|
"prettier": "prettier \"**/*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)\"",
|
||||||
|
"validate": "npm run lint && npm run prettier -- --list-different && npm run flow",
|
||||||
|
"precommit": "lint-staged && npm run flow"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
|
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"babel-eslint": "^9.0.0",
|
||||||
"eslint": "^5.5.0",
|
"eslint": "^5.5.0",
|
||||||
"eslint-config-prettier": "^3.0.1",
|
"eslint-config-prettier": "^3.0.1",
|
||||||
|
"flow-bin": "^0.81.0",
|
||||||
|
"husky": "^0.14.3",
|
||||||
|
"lint-staged": "^7.2.2",
|
||||||
"prettier": "^1.14.2"
|
"prettier": "^1.14.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,5 +7,4 @@ if (!('serviceWorker' in navigator)) {
|
|||||||
|
|
||||||
const greeting = 'hello'
|
const greeting = 'hello'
|
||||||
console.log(`${greeting} world!`)
|
console.log(`${greeting} world!`)
|
||||||
|
|
||||||
;[(1, 2, 3)].forEach(x => console.log(x))
|
;[(1, 2, 3)].forEach(x => console.log(x))
|
||||||
|
|||||||
22
src/flow-example.js
Normal file
22
src/flow-example.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// @flow
|
||||||
|
function add(a: number, b: number): number {
|
||||||
|
return a + b
|
||||||
|
}
|
||||||
|
|
||||||
|
type User = {
|
||||||
|
name: {
|
||||||
|
first: string,
|
||||||
|
middle: string,
|
||||||
|
last: string,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
function getFullName(user: User): string {
|
||||||
|
const {
|
||||||
|
name: {first, middle, last},
|
||||||
|
} = user
|
||||||
|
return [first, middle, last].filter(Boolean).join('')
|
||||||
|
}
|
||||||
|
|
||||||
|
add(1, 2)
|
||||||
|
|
||||||
|
getFullName({name: {first: 'Joe', middle: 'Bud', last: 'Matthews'}})
|
||||||
Reference in New Issue
Block a user