Skip to content

Commit

Permalink
Merge pull request #4 from coreui/dev-linter
Browse files Browse the repository at this point in the history
v2.0.0-alpha.5
  • Loading branch information
xidedix authored Apr 9, 2018
2 parents a7a7bc3 + d057f33 commit 37d44c9
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 71 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test/coverage/
es/
lib/
umd/
38 changes: 38 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"arrowFunctions": true,
"blockBindings": true,
"defaultParams": true,
"destructuring": true,
"forOf": true,
"generators": true,
"objectLiteralComputedProperties": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"experimentalObjectRestSpread": true,
"restParams": true,
"spread": true,
"templateStrings": true,
"modules": true,
"classes": true
}
},
"plugins": [
"react"
],
"root": true,
"rules": {
"comma-dangle": 0,
"linebreak-style": 0
}
}
24 changes: 15 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coreui/react",
"version": "2.0.0-alpha.4",
"version": "2.0.0-alpha.5",
"description": "CoreUI React Bootstrap 4 components",
"main": "lib/index.js",
"module": "es/index.js",
Expand All @@ -16,28 +16,34 @@
"start": "nwb serve-react-demo",
"test": "nwb test-react",
"test:coverage": "nwb test-react --coverage",
"test:watch": "nwb test-react --server"
"test:watch": "nwb test-react --server",
"lint": "eslint src"
},
"dependencies": {
"bootstrap": "4.0.0",
"classnames": "^2.2.5",
"prop-types": "^15.6.1",
"flag-icon-css": "^3.0.0",
"font-awesome": "4.7.0",
"react-perfect-scrollbar": "^1.0.0",
"font-awesome": "^4.7.0",
"react-perfect-scrollbar": "^1.0.5",
"react-router-dom": "^4.2.2",
"reactstrap": "5.0.0-beta",
"simple-line-icons": "2.4.1"
"reactstrap": "^5.0.0",
"simple-line-icons": "^2.4.1"
},
"peerDependencies": {
"react": "16.x"
},
"devDependencies": {
"babel-eslint": "^8.2.2",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"eslint": "^4.19.1",
"eslint-plugin-import": "^2.10.0",
"eslint-plugin-react": "^7.7.0",
"nwb": "0.21.x",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"sinon": "^4.4.9"
"react": "^16.3.1",
"react-dom": "^16.3.1",
"sinon": "^4.5.0"
},
"author": "Łukasz Holeczek",
"homepage": "http://coreui.io",
Expand Down
4 changes: 2 additions & 2 deletions src/Aside.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const propTypes = {
hidden: PropTypes.bool,
isOpen: PropTypes.bool,
offCanvas: PropTypes.bool,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
};

const defaultProps = {
Expand All @@ -20,7 +20,7 @@ const defaultProps = {
fixed: false,
hidden: false,
isOpen: false,
offCanvas: true,
offCanvas: true
};

class AppAside extends Component {
Expand Down
12 changes: 6 additions & 6 deletions src/AsideToggler.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ const propTypes = {
display: PropTypes.any,
mobile: PropTypes.bool,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
type: PropTypes.string,
type: PropTypes.string
};

const defaultProps = {
display: 'lg',
mobile: false,
tag: 'button',
type: 'button',
type: 'button'
};

class AppAsideToggler extends Component {
Expand Down Expand Up @@ -51,10 +51,10 @@ class AppAsideToggler extends Component {

return (
<button
type="button"
className={classes}
{...attributes}
onClick={this.asideToggle}
type="button"
className={classes}
{...attributes}
onClick={this.asideToggle}
>
{children || <span className="navbar-toggler-icon" />}
</button>
Expand Down
10 changes: 5 additions & 5 deletions src/Breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ const BreadcrumbsItem = ({ match }) => {
const routeName = findRouteName(match.url);
if (routeName) {
return (
match.isExact ? (
match.isExact ?
<BreadcrumbItem active>{routeName}</BreadcrumbItem>
) : (
:
<BreadcrumbItem>
<Link to={match.url || ''}>
{routeName}
</Link>
</BreadcrumbItem>
)

);
}
return null;
Expand All @@ -65,13 +65,13 @@ const propTypes = {
children: PropTypes.node,
className: PropTypes.string,
appRoutes: PropTypes.any,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
};

const defaultProps = {
tag: 'div',
className: '',
appRoutes: [{ path: '/', exact: true, name: 'Home', component: null }],
appRoutes: [{ path: '/', exact: true, name: 'Home', component: null }]
};

class AppBreadcrumb extends Component {
Expand Down
4 changes: 2 additions & 2 deletions src/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const propTypes = {
children: PropTypes.node,
className: PropTypes.string,
fixed: PropTypes.bool,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
};

const defaultProps = {
tag: 'footer',
fixed: false,
fixed: false
};

class AppFooter extends Component {
Expand Down
4 changes: 2 additions & 2 deletions src/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const propTypes = {
children: PropTypes.node,
className: PropTypes.string,
fixed: PropTypes.bool,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
};

const defaultProps = {
tag: 'header',
fixed: false,
fixed: false
};

class AppHeader extends Component {
Expand Down
13 changes: 7 additions & 6 deletions src/HeaderDropdown.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import React, { Component } from 'react';
import {
Dropdown,
} from 'reactstrap';
import { Dropdown } from 'reactstrap';
import PropTypes from 'prop-types';

const propTypes = {
children: PropTypes.node,
direction: PropTypes.string
};

const defaultProps = {};
const defaultProps = {
direction: 'down'
};

class AppHeaderDropdown extends Component {
constructor(props) {
super(props);

this.toggle = this.toggle.bind(this);
this.state = {
dropdownOpen: false,
dropdownOpen: false
};
}

toggle() {
this.setState({
dropdownOpen: !this.state.dropdownOpen,
dropdownOpen: !this.state.dropdownOpen
});
}

Expand Down
16 changes: 8 additions & 8 deletions src/NavbarBrand.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const propTypes = {
className: PropTypes.string,
brand: PropTypes.any,
full: PropTypes.any,
minimized: PropTypes.any,
minimized: PropTypes.any
};

const defaultProps = {
tag: 'a',
tag: 'a'
};

class AppNavbarBrand extends Component {
Expand All @@ -35,12 +35,12 @@ class AppNavbarBrand extends Component {
navbarBrandImg(props, classBrand, key) {
return (
<img
src={this.imgSrc(props)}
width={this.imgWidth(props)}
height={this.imgHeight(props)}
alt={this.imgAlt(props)}
className={classBrand}
key={key.toString()}
src={this.imgSrc(props)}
width={this.imgWidth(props)}
height={this.imgHeight(props)}
alt={this.imgAlt(props)}
className={classBrand}
key={key.toString()}
/>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Shared/classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ export const sidebarCssClasses = [
'sidebar-sm-show',
'sidebar-md-show',
'sidebar-lg-show',
'sidebar-xl-show',
'sidebar-xl-show'
];

export const asideMenuCssClasses = [
'aside-menu-show',
'aside-menu-sm-show',
'aside-menu-md-show',
'aside-menu-lg-show',
'aside-menu-xl-show',
'aside-menu-xl-show'
];
4 changes: 2 additions & 2 deletions src/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const propTypes = {
isOpen: PropTypes.bool,
offCanvas: PropTypes.bool,
staticContext: PropTypes.any,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
};

const defaultProps = {
Expand All @@ -23,7 +23,7 @@ const defaultProps = {
fixed: false,
minimized: false,
isOpen: false,
offCanvas: false,
offCanvas: false
};

class AppSidebar extends Component {
Expand Down
8 changes: 4 additions & 4 deletions src/SidebarFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ import classNames from 'classnames';
const propTypes = {
children: PropTypes.node,
className: PropTypes.string,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
};

const defaultProps = {
tag: 'div',
tag: 'div'
};

class AppSidebarFooter extends Component {
render() {
const { className, children, tag: Tag, ...attributes } = this.props;

const classes = classNames(className, 'sidebar-footer');
const footer = children ? (
const footer = children ?
<Tag className={classes} {...attributes} >
{children}
</Tag>
) : (null);
: null;

return (
footer
Expand Down
8 changes: 4 additions & 4 deletions src/SidebarForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ import classNames from 'classnames';
const propTypes = {
children: PropTypes.node,
className: PropTypes.string,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
};

const defaultProps = {
tag: 'div',
tag: 'div'
};

class AppSidebarForm extends Component {
render() {
const { className, children, tag: Tag, ...attributes } = this.props;
const classes = classNames(className, 'sidebar-form');
const form = children ? (
const form = children ?
<Tag className={classes} {...attributes} >
{children}
</Tag>
) : (null);
: null;

return (
form
Expand Down
8 changes: 4 additions & 4 deletions src/SidebarHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ import classNames from 'classnames';
const propTypes = {
children: PropTypes.node,
className: PropTypes.string,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
};

const defaultProps = {
tag: 'div',
tag: 'div'
};

class AppSidebarHeader extends Component {
render() {
const { className, children, tag: Tag, ...attributes } = this.props;
const classes = classNames(className, 'sidebar-header');
const header = children ? (
const header = children ?
<Tag className={classes} {...attributes} >
{children}
</Tag>
) : (null);
: null;

return (
header
Expand Down
Loading

0 comments on commit 37d44c9

Please sign in to comment.