Skip to content

Commit

Permalink
Merge f668fec into 1512a15
Browse files Browse the repository at this point in the history
  • Loading branch information
patw0929 committed Jun 22, 2016
2 parents 1512a15 + f668fec commit d79e48f
Show file tree
Hide file tree
Showing 40 changed files with 829 additions and 1,036 deletions.
1 change: 0 additions & 1 deletion .auto_mock_off.js

This file was deleted.

3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"stage": 0
presets: ["es2015", "react", "stage-0"],
plugins: ["transform-class-properties"],
}
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repo_token: W36XOZAxyZpBhU24F9iAC9VDVdsajbPJG
92 changes: 5 additions & 87 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,94 +1,12 @@
{
"parser": "babel-eslint",
"stage": 0,
"ecmaFeatures": {
"modules": true,
"jsx": true
"extends": "airbnb",
"rules": {
"no-param-reassign": 0,
"react/sort-comp": 0,
},
"plugins": [
"react"
],
"env": {
"es6": true,
"jasmine": true,
"node": true,
"mocha": true,
"browser": true,
"builtin": true
},
globals: {
"jest": true,
"describe": true,
"it": true,
"expect": true,
"beforeEach": true
"mocha": true,
},
"rules": {
"block-scoped-var": 2,
"camelcase": 0,
"comma-style": 2,
"curly": [2, "all"],
"dot-notation": 0,
"eqeqeq": [2, "allow-null"],
"global-strict": [2, "never"],
"guard-for-in": 2,
"key-spacing": 0,
"new-cap": 2,
"no-bitwise": 2,
"no-caller": 2,
"no-cond-assign": [2, "except-parens"],
"no-debugger": 2,
"no-empty": 2,
"no-eval": 2,
"no-extend-native": 2,
"no-extra-parens": 0,
"no-irregular-whitespace": 2,
"no-iterator": 2,
"no-loop-func": 2,
"no-multi-spaces": 0,
"no-multi-str": 0,
"no-mixed-spaces-and-tabs": 0,
"no-new": 2,
"no-plusplus": 0,
"no-proto": 2,
"no-script-url": 2,
"no-sequences": 2,
"no-shadow": 2,
"no-undef": 2,
"no-underscore-dangle": 0,
"no-unused-vars": 2,
"no-use-before-define": 2,
"no-with": 2,
"quotes": [2, "single"],
"react/display-name": 0,
"react/jsx-boolean-value": 0,
"react/jsx-quotes": 2,
"react/jsx-no-undef": 1,
"react/jsx-sort-props": 0,
"react/jsx-sort-prop-types": 0,
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/no-did-mount-set-state": 2,
"react/no-did-update-set-state": 2,
"react/no-multi-comp": 2,
"react/no-unknown-property": 2,
"react/prop-types": [2, {
ignore: 'children'
}],
"react/react-in-jsx-scope": 2,
"react/self-closing-comp": 2,
"react/sort-comp": [2, {
order: [
'/^constructor$/',
'lifecycle',
'everything-else',
'render'
]
}],
"react/wrap-multilines": 2,
"semi": [2, "always"],
"strict": [2, "global"],
"valid-typeof": 2,
"wrap-iife": [2, "inside"]
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ example/dist

.grunt/
npm-debug.log

coverage
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
language: node_js
node_js:
- "0.10"
- "5.11.1"
after_success: npm run coverage
after_script: npm run coveralls
98 changes: 48 additions & 50 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
const mountFolder = (connect, dir) =>
connect.static(require('path').resolve(dir));

var webpackExampleConfig = require('./webpack.example.config.js'),
webpackDistConfig = require('./webpack.dist.config.js'),
webpackDevConfig = require('./webpack.config.js');
const webpackExampleConfig = require('./webpack.example.config.js');
const webpackDistConfig = require('./webpack.dist.config.js');
const webpackDevConfig = require('./webpack.config.js');

module.exports = function (grunt) {
module.exports = (grunt) => {
// Let *load-grunt-tasks* require everything
require('load-grunt-tasks')(grunt);

// Read configuration from package.json
var folders = {
const folders = {
src: 'src',
test: 'test',
dist: 'dist',
example: 'example'
example: 'example',
};

grunt.initConfig({
folders: folders,
folders,

webpack: {
example: webpackExampleConfig,
dist: webpackDistConfig
dist: webpackDistConfig,
},

'webpack-dev-server': {
Expand All @@ -33,41 +32,39 @@ module.exports = function (grunt) {
host: '0.0.0.0',
webpack: webpackDevConfig,
publicPath: '/assets/',
contentBase: './<%= folders.src %>/'
contentBase: './<%= folders.src %>/',
},

start: {
keepAlive: true
}
keepAlive: true,
},
},

connect: {
options: {
port: 8000
port: 8000,
},

example: {
options: {
keepalive: true,
middleware: function (connect) {
return [
mountFolder(connect, folders.example)
];
}
}
}
middleware: (connect) =>
[mountFolder(connect, folders.example)]
,
},
},
},

open: {
options: {
delay: 500
delay: 500,
},
dev: {
path: 'http://localhost:<%= connect.options.port %>/webpack-dev-server/'
path: 'http://localhost:<%= connect.options.port %>/webpack-dev-server/',
},
example: {
path: 'http://localhost:<%= connect.options.port %>/'
}
path: 'http://localhost:<%= connect.options.port %>/',
},
},

copy: {
Expand All @@ -78,79 +75,80 @@ module.exports = function (grunt) {
flatten: true,
expand: true,
src: [
'<%= folders.src %>/index.html'
'<%= folders.src %>/index.html',
],
dest: '<%= folders.example %>/',
filter: 'isFile'
filter: 'isFile',
},
{
flatten: true,
expand: true,
src: [
'<%= folders.src %>/libphonenumber.js'
'<%= folders.src %>/libphonenumber.js',
],
dest: '<%= folders.dist %>/',
filter: 'isFile'
filter: 'isFile',
},
{
flatten: true,
expand: true,
src: '<%= folders.dist %>/*.png',
dest: '<%= folders.example %>/'
dest: '<%= folders.example %>/',
},
{
flatten: true,
expand: true,
src: '<%= folders.src %>/styles/*',
dest: '<%= folders.dist %>/styles/'
dest: '<%= folders.dist %>/styles/',
},
{
flatten: true,
expand: true,
src: '<%= folders.src %>/images/*',
dest: '<%= folders.dist %>/images/'
}
]
}
dest: '<%= folders.dist %>/images/',
},
],
},
},

clean: {
example: {
files: [{
dot: true,
src: [
'<%= folders.example %>'
]
}]
'<%= folders.example %>',
],
}],
},
dist: {
files: [{
dot: true,
src: [
'<%= folders.dist %>'
]
}]
}
'<%= folders.dist %>',
],
}],
},
},

'gh-pages': {
options: {
base: 'example'
base: 'example',
},
src: ['**']
}
src: ['**'],
},
});

grunt.registerTask('publish:examples', ['gh-pages']);

grunt.registerTask('serve', function (target) {
grunt.registerTask('serve', (target) => {
if (target === 'example') {
return grunt.task.run(['clean:dist', 'webpack:dist', 'build', 'open:example', 'connect:example']);
return grunt.task.run(['clean:dist', 'webpack:dist',
'build', 'open:example', 'connect:example']);
}

grunt.task.run([
return grunt.task.run([
'open:dev',
'webpack-dev-server'
'webpack-dev-server',
]);
});

Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# React-TWzipcode [![Build Status](https://travis-ci.org/patw0929/react-twzipcode.svg)](https://travis-ci.org/patw0929/react-twzipcode)
# React-TWzipcode

[![Build Status](https://travis-ci.org/patw0929/react-twzipcode.svg)](https://travis-ci.org/patw0929/react-twzipcode)
[![npm version](https://badge.fury.io/js/react-twzipcode.svg)](http://badge.fury.io/js/react-twzipcode)
[![Coverage Status](https://coveralls.io/repos/github/patw0929/react-twzipcode/badge.svg?branch=master)](https://coveralls.io/github/patw0929/react-twzipcode?branch=master)
[![npm](https://img.shields.io/npm/l/express.svg?maxAge=2592000)]()

Rewrite [jQuery-TWzipcode](https://github.com/essoduke/jQuery-TWzipcode) in React.js.

Expand Down Expand Up @@ -31,7 +36,7 @@ npm install react-twzipcode --save
## Usage

```
var TWzipcode = require('react-twzipcode');
import TWzipcode from 'react-twzipcode';
<TWzipcode css={['county-sel', 'district-sel', 'zipcode']}>Example</TWzipcode>
```
Expand All @@ -47,6 +52,17 @@ Please see the [Demo Page](http://patw0929.github.io/react-twzipcode/)

To build, watch and serve the examples (which will also watch the component source), run `npm run example`.


## Contributing

To contribute to react-twzipcode, clone this repo locally and commit your code on a separate branch. Please write tests for your code, and run the linter before opening a pull-request:

```bash
npm test
npm run lint
```


## License

MIT
Expand Down
35 changes: 0 additions & 35 deletions __tests__/County-test.js

This file was deleted.

0 comments on commit d79e48f

Please sign in to comment.