Skip to content

Commit

Permalink
Merge pull request #27 from jaebradley/convert-to-rollup
Browse files Browse the repository at this point in the history
build(rollup): build library using rollup.js
  • Loading branch information
jaebradley authored May 18, 2018
2 parents 9903b50 + 4daddf4 commit 350dc3a
Show file tree
Hide file tree
Showing 7 changed files with 673 additions and 38 deletions.
31 changes: 23 additions & 8 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
{
"presets": [
"@babel/preset-env"
],
"ignore": [
"node_modules/**",
"*.test.js"
]
}
"env": {
"test": {
"presets": [
[
"@babel/preset-env",
{ "modules": "umd" }
]
]
},
"production": {
"presets": [
[
"@babel/preset-env",
{ "modules": false }
]
]
}
},
"ignore": [
"node_modules/**",
"*.test.js"
]
}
19 changes: 13 additions & 6 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
node_modules/**

src/**
test/**
coverage/**

npm-debug.log
commitlint.config.js
*.test.js

.DS_Store
.eslintcache
node_modules
npm-debug.log
.travis.yml
src/
test/
*.test.js
coverage/
.babelrc
.eslintignore
.eslintrc
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
include:
- stage: test
script:
- npm run compile
- npm run build
- npm run lint
- npm run test
before_script: greenkeeper-lockfile-update
Expand Down
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
# `email-prop-type`

[![Greenkeeper badge](https://badges.greenkeeper.io/jaebradley/email-prop-type.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/jaebradley/email-prop-type.svg?branch=master)](https://travis-ci.org/jaebradley/email-prop-type)
[![codecov](https://codecov.io/gh/jaebradley/email-prop-type/branch/master/graph/badge.svg)](https://codecov.io/gh/jaebradley/email-prop-type)
[![npm](https://img.shields.io/npm/dt/email-prop-type.svg)](https://www.npmjs.com/package/email-prop-type)
[![npm](https://img.shields.io/npm/v/email-prop-type.svg)](https://www.npmjs.com/package/email-prop-type)
[![Greenkeeper badge](https://badges.greenkeeper.io/jaebradley/email-prop-type.svg)](https://greenkeeper.io/)

# Email Prop Type

## Introduction
This package is used to validate if a React Prop value is a valid email.

This package is used to validate if a React Prop value is a valid email address.

Currently, there is no email prop type defined by [the `prop-types` package](https://www.npmjs.com/package/prop-types). While using `PropType.string` works, why not be as specific as possible when validating your props?

Additionally, though [it's relatively straightforward to create a custom prop type validator](https://www.ian-thomas.net/custom-proptype-validation-with-react/), if you need to implement similar prop type checking in multiple packages, you might not want to repeat yourself.

Depends on [the `isemail` package](https://www.npmjs.com/package/isemail). While the `isemail` package has options to [specify various error levels](https://github.com/hapijs/isemail#validateemail-options-callback), `email-prop-type` implements the highest level of granularity, i.e. a perfectly granular email address.
Depends on [the `email-validator` package](https://github.com/Sembiance/email-validator).

## Installation
`npm install --save email-prop-type`

```bash
npm install --save email-prop-type
```

As mentioned above, `email-prop-type` depends on the `email-validator` package. You need to install this package as a peer dependency of `email-prop-type`.

## Example Usage

```javascript
import React from 'react';
import PropTypes from 'prop-types';
Expand All @@ -36,6 +43,8 @@ Hyperlink.propTypes = {
```
## Alternatives
I didn't see many alternatives:
* It doesn't look like [the `airbnb/prop-types` project](https://github.com/airbnb/prop-types) has email validation.
* There's also [the `react-validator-prop-types` library](https://www.npmjs.com/package/react-validator-prop-types) but if you just want email validation, it might be too heavyweight.
* It doesn't look like [the `airbnb/prop-types` project](https://github.com/airbnb/prop-types) has email validation.
* There's also [the `react-validator-prop-types` library](https://www.npmjs.com/package/react-validator-prop-types) but if you just want email validation, it might be too heavyweight.
Loading

0 comments on commit 350dc3a

Please sign in to comment.