Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Max Einstein
committed
Sep 29, 2017
0 parents
commit c9a637d
Showing
25 changed files
with
8,195 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"presets": [ | ||
["es2015", { "modules": false }], | ||
"react", | ||
"stage-1" | ||
], | ||
"env": { | ||
"test": { | ||
"presets": [ | ||
"es2015", | ||
"react", | ||
"stage-1" | ||
] | ||
}, | ||
"dev":{ | ||
"plugins": [ | ||
"react-hot-loader/babel" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es6": true, | ||
"node": true, | ||
"jest": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:jest/recommended" | ||
], | ||
"parser": "babel-eslint", | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"experimentalObjectRestSpread": true, | ||
"jsx": true | ||
}, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"babel", | ||
"jest", | ||
"react" | ||
], | ||
"rules": { | ||
// Possible Errors not included in recommended list | ||
"no-console": "off", | ||
"no-unsafe-negation": "error", | ||
|
||
// "Best Practices" | ||
"accessor-pairs": "error", | ||
"array-callback-return": "warn", | ||
"curly": "error", | ||
"default-case": "error", | ||
"dot-location": ["error", "property"], | ||
"yoda": "error", | ||
"vars-on-top": "error", | ||
"no-with": "error", | ||
"no-void": "error", | ||
"no-useless-concat": "error", | ||
"no-useless-escape": "error", | ||
"no-unused-expressions": "warn", | ||
"no-unmodified-loop-condition": "error", | ||
"no-throw-literal": "error", | ||
"no-sequences": "error", | ||
"no-self-compare": "error", | ||
"no-script-url": "error", | ||
"no-proto": "error", | ||
"no-param-reassign": "error", | ||
"no-new": "warn", | ||
"no-new-wrappers": "error", | ||
"no-new-func": "error", | ||
"no-multi-str": "error", | ||
"no-multi-spaces": "error", | ||
"no-lone-blocks": "error", | ||
"no-iterator": "error", | ||
"no-implied-eval": "error", | ||
"no-implicit-globals": "error", | ||
"no-implicit-coercion": "warn", | ||
"no-floating-decimal": "error", | ||
"no-extra-label": "error", | ||
"no-extend-native": "error", | ||
"no-eval": "error", | ||
"no-eq-null": "error", | ||
"no-div-regex": "error", | ||
"no-caller": "error", | ||
"no-alert": "warn", | ||
"eqeqeq": "error", | ||
"guard-for-in": "error", | ||
"no-else-return": "error", | ||
|
||
// Strict Mode | ||
"strict": "error", | ||
|
||
// Variables | ||
"no-catch-shadow": "error", | ||
"no-label-var": "error", | ||
"no-shadow-restricted-names": "error", | ||
"no-shadow": "error", | ||
"no-undef-init": "error", | ||
"no-undefined": "error", | ||
"no-use-before-define": "error", | ||
|
||
// Node.js and CommonJS | ||
"global-require": "error", | ||
"handle-callback-err": "error", | ||
"no-new-require": "error", | ||
"no-path-concat": "error", | ||
"no-process-exit": "error", | ||
"no-restricted-modules": "error", | ||
|
||
// Stylistic Issues | ||
"block-spacing": ["error", "always"], | ||
"brace-style": ["error", "1tbs"], | ||
"camelcase": "error", | ||
"comma-spacing": ["error", {"before": false, "after": true}], | ||
"comma-style": ["error", "last"], | ||
"computed-property-spacing": ["error", "never"], | ||
"consistent-this": ["error", "that"], | ||
"eol-last": "error", | ||
"func-call-spacing": ["error", "never"], | ||
"indent": ["error", 2], | ||
"jsx-quotes": ["error", "prefer-double"], | ||
"key-spacing": ["error", { "beforeColon": false }], | ||
"keyword-spacing": ["error", {"before": true, "after": true}], | ||
"linebreak-style": ["error", "unix"], | ||
"max-depth": ["error", 4], | ||
"max-len": ["error", 120], | ||
"max-nested-callbacks": ["error", 4], | ||
"max-statements-per-line": ["error", { "max": 1 }], | ||
"new-parens": "error", | ||
"no-array-constructor": "error", | ||
"no-bitwise": "warn", | ||
"no-lonely-if": "error", | ||
"no-mixed-operators": "error", | ||
"no-multiple-empty-lines": "error", | ||
"no-nested-ternary": "error", | ||
"no-new-object": "error", | ||
"no-plusplus": "error", | ||
"no-tabs": "error", | ||
"no-trailing-spaces": "error", | ||
"no-unneeded-ternary": "error", | ||
"no-whitespace-before-property": "error", | ||
"one-var-declaration-per-line": "error", | ||
"operator-assignment": "error", | ||
"quote-props": ["error", "as-needed"], | ||
"semi-spacing": "error", | ||
"space-before-blocks": "error", | ||
"space-before-function-paren": ["error", "never"], | ||
"space-in-parens": ["error", "never"], | ||
"unicode-bom": "error", | ||
"space-infix-ops": "error", | ||
"space-unary-ops": "error", | ||
"spaced-comment": ["error", "always"], | ||
|
||
// ECMAScript 6 | ||
"arrow-parens": ["error", "as-needed"], | ||
"arrow-spacing": "error", | ||
"no-duplicate-imports": "error", | ||
"no-useless-computed-key": "error", | ||
"no-useless-constructor": "error", | ||
"no-useless-rename": "error", | ||
"object-shorthand": "error", | ||
"prefer-arrow-callback": "error", | ||
"prefer-const": "error", | ||
"prefer-reflect": "error", | ||
"prefer-rest-params": "error", | ||
"prefer-spread": "error", | ||
"prefer-template": "error", | ||
"rest-spread-spacing": ["error"], | ||
"template-curly-spacing": "error", | ||
"yield-star-spacing": ["error", "after"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
npm-debug.log | ||
lib/ | ||
coverage/ | ||
/index.js | ||
/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!lib/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# system setup | ||
sudo: required | ||
dist: trusty | ||
|
||
# language setup | ||
language: node_js | ||
node_js: | ||
- "6" | ||
|
||
# setup yarn | ||
cache: | ||
yarn: true | ||
directories: | ||
- node_modules | ||
|
||
# command to run tests | ||
script: | ||
- npm run test:coverage:report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# react-file-picker | ||
|
||
A simple wrapper around the native file input | ||
|
||
`npm i react-file-picker` | ||
|
||
## Examples | ||
|
||
```js | ||
import { PickFile } from 'react-file-picker' | ||
|
||
const MyComponent = () => ( | ||
<PickFile | ||
extensions={['md']} | ||
onChange={FileObject => (/* do something with File object */)} | ||
onError={errMsg => (/* do something with err msg string */) | ||
> | ||
<button> | ||
Click to upload markdown | ||
</button> | ||
</PickFile> | ||
) | ||
``` | ||
```js | ||
import { PickImage } from 'react-file-picker' | ||
|
||
const MyComponent = () => ( | ||
<PickImage | ||
extensions={['jpg', 'jpeg', 'png']} | ||
dims={{minWidth: 100, maxWidth: 500, minHeight: 100, maxHeight: 500}} | ||
onChange={base64 => (/* do something with base64 encoded string */) | ||
onError={errMsg => (/* do something with err msg string */) | ||
> | ||
<button> | ||
Click to upload image | ||
</button> | ||
</PickImage> | ||
) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'test-file-stub' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// node imports | ||
var path = require('path') | ||
|
||
|
||
// project root directory | ||
var root = path.join(__dirname, '..') | ||
// source directory | ||
var sourceDir = path.join(root, 'src') | ||
// build directory | ||
var buildDir = path.join(root, 'lib') | ||
// configuration directory | ||
var configDir = path.join(root, 'config') | ||
// example directory | ||
var exampleDir = path.join(root, 'example') | ||
|
||
|
||
// export the project paths|globs object | ||
module.exports = { | ||
// directories | ||
rootDir: root, | ||
sourceDir: sourceDir, | ||
buildDir: buildDir, | ||
exampleDir: exampleDir, | ||
// entry points | ||
entry: path.join(sourceDir, 'index.js'), | ||
exampleEntry: path.join(exampleDir, 'index.js'), | ||
// configuration files | ||
babelConfig: path.join(root, '.babelrc'), | ||
eslintConfig: path.join(root, '.eslintrc'), | ||
webpackConfig: path.join(configDir, 'webpack.js'), | ||
} |
Oops, something went wrong.