Skip to content

Commit

Permalink
Add prettier (#182)
Browse files Browse the repository at this point in the history
* Add prettier

* Apply prettier formatting

* Extend linting to include storybook stories

* Merge branch 'master' of https://github.com/joshwcomeau/react-flip-move into feature/181

# Conflicts:
#	src/FlipMove.js
#	src/dom-manipulation.js
#	src/prop-converter.js

* Add paragraph about linting to readme
  • Loading branch information
tobilen authored and Hypnosphi committed Sep 2, 2017
1 parent 5ee1479 commit ca6e2ae
Show file tree
Hide file tree
Showing 25 changed files with 681 additions and 508 deletions.
57 changes: 0 additions & 57 deletions .eslintrc

This file was deleted.

67 changes: 67 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
module.exports = {
extends: [
'airbnb',
'plugin:flowtype/recommended',
'prettier',
'prettier/flowtype',
'prettier/react',
],
plugins: ['prettier', 'flowtype', 'sort-class-members', 'bdd'],
parser: 'babel-eslint',
rules: {
'import/no-unresolved': 0,
'import/no-extraneous-dependencies': 0,
'react/jsx-filename-extension': 0,
'react/no-unused-prop-types': 0,
'react/sort-comp': 0,
'sort-class-members/sort-class-members': [
2,
{
order: [
'[static-properties]',
'[static-methods]',
'[properties]',
'constructor',
'componentWillMount',
'componentDidMount',
'componentWillReceiveProps',
'shouldComponentUpdate',
'componentWillUpdate',
'componentDidUpdate',
'componentWillUnmount',
'[arrow-function-properties]',
'[methods]',
'render',
],
},
],
'no-console': [1, { allow: ['warn', 'error'] }],

'flowtype/delimiter-dangle': [2, 'always-multiline'],
'flowtype/no-dupe-keys': 2,
'flowtype/no-primitive-constructor-types': 2,
'flowtype/no-weak-types': 1,
'flowtype/object-type-delimiter': [2, 'comma'],
'flowtype/semi': 2,

'bdd/focus': 2,
'bdd/exclude': 2,

'prettier/prettier': [
'error',
{
trailingComma: 'all',
singleQuote: true,
},
],
},
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true,
},
},
env: {
browser: true,
node: true,
},
};
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ This project uses [React Storybook](https://github.com/kadirahq/react-storybook)

After installing dependencies, launch the Storybook dev server with `npm run storybook`.

This project adheres to the formatting established by [airbnb's style guide](https://github.com/airbnb/javascript/tree/master/react). When contributing, you can make use of the autoformatter [prettier](https://github.com/prettier/prettier) to apply these rules by running the eslint script `npm run lint:fix`. If there are conflicts, the linter triggered by the prepush hook will inform you of those as well. To check your code by hand, run `npm run lint`.

## Flow support

Flip Move's sources are type-checked with [Flow](https://flow.org/). If your project uses it too, you may want to install typings for our public API from [flow-typed](https://github.com/flowtype/flow-typed) repo.
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"typings"
],
"scripts": {
"lint": "eslint src test",
"lint": "eslint src stories test",
"lint:fix": "npm run lint -- --fix",
"build:lib": "babel src --out-dir lib",
"build:umd": "webpack src/index.js dist/react-flip-move.js --config webpack.config.production.js",
"build:umd:min": "webpack src/index.js dist/react-flip-move.min.js --config webpack.config.production.min.js",
Expand Down Expand Up @@ -70,10 +71,12 @@
"enzyme": "2.8.2",
"eslint": "3.10.0",
"eslint-config-airbnb": "12.0.0",
"eslint-config-prettier": "^2.3.0",
"eslint-plugin-bdd": "2.1.1",
"eslint-plugin-flowtype": "2.32.1",
"eslint-plugin-import": "1.16.0",
"eslint-plugin-jsx-a11y": "2.2.3",
"eslint-plugin-prettier": "^2.2.0",
"eslint-plugin-react": "6.10.3",
"eslint-plugin-sort-class-members": "1.1.1",
"flow-bin": "0.54.0",
Expand All @@ -92,6 +95,7 @@
"mocha": "2.4.5",
"preact": "8.1.0",
"preact-compat": "3.16.0",
"prettier": "^1.6.1",
"prop-types": "15.5.8",
"react": "15.6.1",
"react-dom": "15.6.1",
Expand Down
Loading

0 comments on commit ca6e2ae

Please sign in to comment.