Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
Closes #1081
  • Loading branch information
leebyron committed Dec 4, 2017
1 parent 4a6c8ca commit 688c3a9
Show file tree
Hide file tree
Showing 169 changed files with 11,624 additions and 10,601 deletions.
15 changes: 8 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

"plugins": [
"babel",
"flowtype"
"flowtype",
"prettier"
],

"env": {
Expand Down Expand Up @@ -39,6 +40,8 @@
},

"rules": {
"prettier/prettier": 2,

"flowtype/space-after-type-colon": [2, "always"],
"flowtype/space-before-type-colon": [2, "never"],
"flowtype/space-before-generic-bracket": [2, "never"],
Expand All @@ -48,7 +51,6 @@
"flowtype/use-flow-type": 2,
"flowtype/semi": 2,

"array-bracket-spacing": [2, "always"],
"arrow-parens": [2, "as-needed"],
"arrow-spacing": 2,
"block-scoped-var": 0,
Expand All @@ -70,7 +72,6 @@
"eqeqeq": ["error", "smart"],
"func-names": 0,
"func-style": 0,
"generator-star-spacing": [2, {"before": false, "after": true}],
"guard-for-in": 2,
"handle-callback-err": [2, "error"],
"id-length": 0,
Expand All @@ -82,7 +83,10 @@
"linebreak-style": 2,
"lines-around-comment": 0,
"max-depth": 0,
"max-len": [2, 80, 4],
"max-len": [2, 80, {
"ignoreComments": true,
"ignoreStrings": true
}],
"max-nested-callbacks": 0,
"max-params": 0,
"max-statements": 0,
Expand Down Expand Up @@ -194,20 +198,17 @@
"object-shorthand": [2, "always"],
"one-var": [2, "never"],
"operator-assignment": [2, "always"],
"operator-linebreak": [2, "after"],
"padded-blocks": 0,
"prefer-const": 2,
"prefer-reflect": 0,
"prefer-spread": 0,
"quote-props": [2, "as-needed", {"numbers": true}],
"quotes": [2, "single"],
"radix": 2,
"require-yield": 0,
"semi": [2, "always"],
"semi-spacing": [2, {"before": false, "after": true}],
"sort-vars": 0,
"space-before-blocks": [2, "always"],
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
"space-in-parens": 0,
"space-infix-ops": [2, {"int32Hint": false}],
"space-unary-ops": [2, {"words": true, "nonwords": false}],
Expand Down
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"parser": "flow",
"singleQuote": true,
"trailingComma": "all"
}
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ This will watch the file system run any relevant lint, tests, and type checks au

## Coding Style

This project uses [Prettier](https://prettier.io/) for standard formatting. To
ensure your pull request matches the style guides, run `npm run prettier`.

* 2 spaces for indentation (no tabs)
* 80 character line length strongly preferred.
* Prefer `'` over `"`
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"testonly": "babel-node ./node_modules/.bin/_mocha $npm_package_options_mocha",
"t": "babel-node ./node_modules/.bin/_mocha --require ./resources/mocha-bootload",
"lint": "eslint --rulesdir ./resources/lint src || (printf '\\033[33mTry: \\033[7m npm run lint -- --fix \\033[0m\\n' && exit 1)",
"prettier": "prettier --write 'src/**/*.js'",
"check": "flow check",
"check-cover": "for file in {src/*.js,src/**/*.js}; do echo $file; flow coverage $file; done",
"build": "npm run build:clean && npm run build:npm && npm run build:npm-flow && npm run build:module && npm run build:module-flow",
Expand Down Expand Up @@ -62,9 +63,11 @@
"eslint": "4.4.1",
"eslint-plugin-babel": "4.1.2",
"eslint-plugin-flowtype": "2.35.0",
"eslint-plugin-prettier": "^2.3.1",
"flow-bin": "^0.58.0",
"isparta": "4.0.0",
"mocha": "3.5.0",
"prettier": "^1.8.2",
"sane": "2.0.0"
}
}
30 changes: 15 additions & 15 deletions src/__tests__/starWarsData.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,43 @@ const luke = {
type: 'Human',
id: '1000',
name: 'Luke Skywalker',
friends: [ '1002', '1003', '2000', '2001' ],
appearsIn: [ 4, 5, 6 ],
friends: ['1002', '1003', '2000', '2001'],
appearsIn: [4, 5, 6],
homePlanet: 'Tatooine',
};

const vader = {
type: 'Human',
id: '1001',
name: 'Darth Vader',
friends: [ '1004' ],
appearsIn: [ 4, 5, 6 ],
friends: ['1004'],
appearsIn: [4, 5, 6],
homePlanet: 'Tatooine',
};

const han = {
type: 'Human',
id: '1002',
name: 'Han Solo',
friends: [ '1000', '1003', '2001' ],
appearsIn: [ 4, 5, 6 ],
friends: ['1000', '1003', '2001'],
appearsIn: [4, 5, 6],
};

const leia = {
type: 'Human',
id: '1003',
name: 'Leia Organa',
friends: [ '1000', '1002', '2000', '2001' ],
appearsIn: [ 4, 5, 6 ],
friends: ['1000', '1002', '2000', '2001'],
appearsIn: [4, 5, 6],
homePlanet: 'Alderaan',
};

const tarkin = {
type: 'Human',
id: '1004',
name: 'Wilhuff Tarkin',
friends: [ '1001' ],
appearsIn: [ 4 ],
friends: ['1001'],
appearsIn: [4],
};

const humanData = {
Expand All @@ -70,17 +70,17 @@ const threepio = {
type: 'Droid',
id: '2000',
name: 'C-3PO',
friends: [ '1000', '1002', '1003', '2001' ],
appearsIn: [ 4, 5, 6 ],
friends: ['1000', '1002', '1003', '2001'],
appearsIn: [4, 5, 6],
primaryFunction: 'Protocol',
};

const artoo = {
type: 'Droid',
id: '2001',
name: 'R2-D2',
friends: [ '1000', '1002', '1003' ],
appearsIn: [ 4, 5, 6 ],
friends: ['1000', '1002', '1003'],
appearsIn: [4, 5, 6],
primaryFunction: 'Astromech',
};

Expand Down Expand Up @@ -115,7 +115,7 @@ export type Droid = {
name: string,
friends: Array<string>,
appearsIn: Array<number>,
primaryFunction: string
primaryFunction: string,
};

/**
Expand Down
Loading

0 comments on commit 688c3a9

Please sign in to comment.