Skip to content

Commit

Permalink
chore(structure): init library structure using create-react-library
Browse files Browse the repository at this point in the history
- add .env in example folder for absolute path use
- update ExampleComponent to be SuperTimer
- configure code quality tools: eslint, lintstaged, commitlint
- remove .editorconfig
  • Loading branch information
yassinedoghri committed Jun 2, 2018
1 parent 7231531 commit 2518fac
Show file tree
Hide file tree
Showing 22 changed files with 18,287 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .babelrc
@@ -0,0 +1,12 @@
{
"presets": [
["env", {
"modules": false
}],
"stage-0",
"react"
],
"plugins": [
"external-helpers"
]
}
3 changes: 3 additions & 0 deletions .commitlintrc.json
@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}
84 changes: 84 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,84 @@
module.exports = {
parser: "babel-eslint",
extends: ["airbnb", "prettier", "prettier/react"],
env: {
es6: true,
browser: true,
node: true,
jest: true
},
plugins: ["react", "prettier"],
parserOptions: {
sourceType: "module",
allowImportExportEverywhere: true
},
rules: {
// don't force es6 functions to include space before parenthesis
"space-before-function-paren": 0,

// allow specifying true explicitly for boolean props
"react/jsx-boolean-value": 0,

// allow imports mixed with non-import statements at top of file
"import/first": 0,

// Forbid the use of extraneous packages
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
"import/no-extraneous-dependencies": ["error", { packageDir: "." }],

// Prefer destructuring from arrays and objects
// http://eslint.org/docs/rules/prefer-destructuring
"prefer-destructuring": [
"error",
{
VariableDeclarator: {
array: false,
object: true
},
AssignmentExpression: {
array: false,
object: false
}
},
{
enforceForRenamedProperties: false
}
],

// Allow .js files to use JSX syntax
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
"react/jsx-filename-extension": [1, { extensions: [".js", ".jsx"] }],

// Functional and class components are equivalent from React’s point of view
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
"react/prefer-stateless-function": "off",

// Ensure <a> tags are valid
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md
"jsx-a11y/anchor-is-valid": [
"error",
{
components: ["Link"],
specialLink: ["to"],
aspects: ["noHref", "invalidHref", "preferButton"]
}
],

// ESLint plugin for prettier formatting
// https://github.com/prettier/eslint-plugin-prettier
"prettier/prettier": "error",

// Disable no-param-reassign only for param properties
// https://stackoverflow.com/a/35637900
"no-param-reassign": [2, { props: false }]
},
settings: {
// Allow absolute paths in imports, e.g. import Button from 'components/Button'
// https://github.com/benmosher/eslint-plugin-import/tree/master/resolvers
"import/resolver": {
node: {
moduleDirectory: ["node_modules", "src"]
}
}
}
};
22 changes: 22 additions & 0 deletions .gitignore
@@ -0,0 +1,22 @@

# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
node_modules

# builds
build
dist

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

.idea
6 changes: 6 additions & 0 deletions .lintstagedrc.json
@@ -0,0 +1,6 @@
{
"*.{js,jsx}": [
"prettier --write",
"git add"
]
}
33 changes: 32 additions & 1 deletion README.md
@@ -1,2 +1,33 @@
# react-super-timer
Super Timer is a fully controllable and customizable timer component for react

> Super Timer is a fully controllable and customizable timer component for react
[![NPM](https://img.shields.io/npm/v/react-super-timer.svg)](https://www.npmjs.com/package/react-super-timer) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save react-super-timer
or
yarn react-super-timer
```

## Usage

```jsx
import React, { Component } from 'react'

import SuperTimer from 'react-super-timer'

class Example extends Component {
render () {
return (
<SuperTimer />
)
}
}
```

## License

MIT © [yassinedoghri](https://github.com/yassinedoghri)
1 change: 1 addition & 0 deletions example/.env
@@ -0,0 +1 @@
NODE_PATH=src/

0 comments on commit 2518fac

Please sign in to comment.