Skip to content

Commit

Permalink
Enforces lint on test (#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
flovilmart authored May 22, 2017
1 parent f8bbf56 commit 6ed8075
Show file tree
Hide file tree
Showing 127 changed files with 411 additions and 553 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"node": true,
"browser": true
},
"parser": "babel-eslint",
"extends": "eslint:recommended",
"installedESLint": true,
"parserOptions": {
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ PIG/bundles/
Parse-Dashboard/public/bundles/
Parse-Dashboard/parse-dashboard-config.json
npm-debug.log
.eslintcache

// vim .swp
*.swp
.env
.idea/
.idea/
2 changes: 1 addition & 1 deletion Parse-Dashboard/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function checkIfIconsExistForApps(apps, iconsFolder) {
var iconName = currentApp.iconName;
var path = iconsFolder + "/" + iconName;

fs.stat(path, function(err, stat) {
fs.stat(path, function(err) {
if (err) {
if ('ENOENT' == err.code) {// file does not exist
console.warn("Icon with file name: " + iconName +" couldn't be found in icons folder!");
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@
},
"devDependencies": {
"babel-core": "~5.8.12",
"babel-eslint": "^7.2.3",
"babel-loader": "~5.3.0",
"babel-plugin-remove-proptypes": "~1.0.0",
"babel-polyfill": "^6.7.2",
"babel-runtime": "~5.8.25",
"css-loader": "~0.18.0",
"eslint": "^3.8.1",
"eslint-plugin-jest": "^20.0.3",
"eslint-plugin-react": "^6.4.1",
"file-loader": "^0.8.5",
"history": "^2.1.2",
Expand Down Expand Up @@ -84,7 +86,8 @@
"pig": "http-server ./PIG -p 4041 -s & webpack --config webpack/PIG.config.js --progress --watch",
"build": "NODE_ENV=production webpack --config webpack/production.config.js && webpack --config webpack/PIG.config.js",
"test": "NODE_PATH=./node_modules jest",
"lint": "eslint . --ignore-path .gitignore --ignore-pattern *.test.js",
"lint": "eslint . --ignore-path .gitignore --cache",
"pretest": "npm run lint",
"generate": "node scripts/generate.js",
"prepublish": "webpack --config webpack/publish.config.js",
"start": "node ./Parse-Dashboard/index.js"
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ if (!name) {
'',
' name - The name of the component you wish to create a scaffold for'
].join('\n'));
return;
process.exit(1);
}

if (name[0] < 'A' || name[0] > 'Z') {
Expand All @@ -144,7 +144,7 @@ try {
// If we don't error, the file exists
console.log('Error: A component with that name already exists!');
process.exit(1);
} catch (e) {}
} catch (e) {/**/}

try {
fs.mkdirSync(path.join(rootDir, name));
Expand Down
4 changes: 2 additions & 2 deletions src/components/BrowserCell/BrowserCell.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/
import { dateStringUTC, isDate } from 'lib/DateUtils';
import { dateStringUTC } from 'lib/DateUtils';
import getFileName from 'lib/getFileName';
import Parse from 'parse';
import Pill from 'components/Pill/Pill.react';
import React from 'react';
import styles from 'components/BrowserCell/BrowserCell.scss';
import { unselectable } from 'stylesheets/base.scss';

let BrowserCell = ({ type, value, hidden, width, current, onSelect, readonly, onEditChange, setRelation, onPointerClick }) => {
let BrowserCell = ({ type, value, hidden, width, current, onSelect, onEditChange, setRelation, onPointerClick }) => {
let content = value;
let classes = [styles.cell, unselectable];
if (hidden) {
Expand Down
9 changes: 5 additions & 4 deletions src/components/BrowserFilter/BrowserFilter.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { List, Map } from 'immutable';
const BLACKLISTED_FILTERS = [ 'containsAny', 'doesNotContainAny' ];

export default class BrowserFilter extends React.Component {
constructor(props) {
constructor() {
super();

this.state = {
Expand All @@ -33,7 +33,7 @@ export default class BrowserFilter extends React.Component {
this.node = ReactDOM.findDOMNode(this);
}

componentWillReceiveProps(props, context) {
componentWillReceiveProps(props) {
if (props.schema !== this.props.schema) {
this.setState({ open: false });
}
Expand Down Expand Up @@ -69,10 +69,11 @@ export default class BrowserFilter extends React.Component {

apply() {
let formatted = this.state.filters.map((filter) => {
let type = this.props.schema[filter.get('field')].type;
// TODO: type is unused?
/*let type = this.props.schema[filter.get('field')].type;
if (Filters.Constraints[filter.get('constraint')].hasOwnProperty('field')) {
type = Filters.Constraints[filter.get('constraint')].field;
}
}*/
return filter;
})
this.setState({ open: false }, () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/CascadingView/CascadingView.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React from 'react';
import styles from 'components/CascadingView/CascadingView.scss';

export default class CascadingView extends React.Component {
constructor(props) {
constructor() {
super();
this.state = {
expanded: false
Expand Down
4 changes: 0 additions & 4 deletions src/components/ChromeDatePicker/ChromeDatePicker.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
*/
import ChromeDatePicker from 'components/ChromeDatePicker/ChromeDatePicker.react';
import { Directions } from 'lib/Constants';
import Field from 'components/Field/Field.react';
import Fieldset from 'components/Fieldset/Fieldset.react';
import Label from 'components/Label/Label.react';
import Option from 'components/Dropdown/Option.react';
import React from 'react';

export const component = ChromeDatePicker;
Expand Down
8 changes: 3 additions & 5 deletions src/components/ChromeDatePicker/ChromeDatePicker.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import Calendar from 'components/Calendar/Calendar.react';
import { Directions } from 'lib/Constants';
import Icon from 'components/Icon/Icon.react';
import {
monthDayStringUTC,
monthsFrom,
daysFrom
monthDayStringUTC
} from 'lib/DateUtils';
import Popover from 'components/Popover/Popover.react';
import Position from 'lib/Position';
Expand All @@ -21,7 +19,7 @@ import ReactDOM from 'react-dom';
import styles from 'components/ChromeDatePicker/ChromeDatePicker.scss';

export default class ChromeDatePicker extends React.Component {
constructor(props) {
constructor() {
super();

this.state = {
Expand All @@ -35,7 +33,7 @@ export default class ChromeDatePicker extends React.Component {
}

toggle() {
this.setState((state) => {
this.setState(() => {
if (this.state.open) {
return { open: false };
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChromeDropdown/ChromeDropdown.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class ChromeDropdown extends React.Component {
};
}

componentWillReceiveProps(nextProps, nextContext) {
componentWillReceiveProps(nextProps) {
this.keyValueMap = {};
nextProps.options.forEach((value) => {
if (value instanceof Object) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/CodeSnippet/CodeSnippet.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const component = CodeSnippet;

export const demos = [
{
render() {
render() {
let source = `// Some comment here
Parse.Cloud.define('hello', function(req, resp) {
let someVariable = "<div>";
Expand Down
1 change: 0 additions & 1 deletion src/components/CreditCardInput/CreditCardInput.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import CreditCardInput from 'components/CreditCardInput/CreditCardInput.react';
import React from 'react';
import Field from 'components/Field/Field.react';
import Fieldset from 'components/Fieldset/Fieldset.react';
import Label from 'components/Label/Label.react';

class Demo extends React.Component {
Expand Down
5 changes: 2 additions & 3 deletions src/components/CreditCardInput/CreditCardInput.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class CreditCardInput extends React.Component {
render() {
let { value, lastFour, onChange } = this.props
let prefilled = false;
let content = '';
if (value == null && lastFour) {
prefilled = true;
value = `\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 ${lastFour}`;
Expand All @@ -37,7 +36,7 @@ class CreditCardInput extends React.Component {
type='text'
className={styles.input}
value={value}
onFocus={e => {
onFocus={ () => {
if (prefilled) {
onChange('');
}
Expand All @@ -54,7 +53,7 @@ class CreditCardInput extends React.Component {
}} />
);
}
};
}

export default CreditCardInput;

Expand Down
5 changes: 2 additions & 3 deletions src/components/DataBrowserHeader/DataBrowserHeader.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
import PropTypes from 'lib/PropTypes';
import React from 'react';
import ReactDOM from 'react-dom';
import styles from 'components/DataBrowserHeader/DataBrowserHeader.scss';
import { unselectable } from 'stylesheets/base.scss';
import { DragSource, DropTarget } from 'react-dnd';
Expand All @@ -17,7 +16,7 @@ const Types = {
};

const dataBrowserHeaderTarget = {
drop(props, monitor, components) {
drop(props, monitor) {
const item = monitor.getItem();

if (!item) {
Expand Down Expand Up @@ -55,7 +54,7 @@ const dataBrowserHeaderSource = {
}))
export default class DataBrowserHeader extends React.Component {
render() {
let { connectDragSource, connectDropTarget, connectDragPreview, name, type, targetClass, order, style, isDragging, isOver, index } = this.props;
let { connectDragSource, connectDropTarget, name, type, targetClass, order, style, isDragging, isOver } = this.props;
let classes = [styles.header, unselectable];
if (order) {
classes.push(styles[order]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { DragDropContext } from 'react-dnd';
@DragDropContext(HTML5Backend)
export default class DataBrowserHeaderBar extends React.Component {
render() {
let { headers, onResize, selected, selectAll, onAddColumn, updateOrdering, readonly, handleDragDrop } = this.props;
let { headers, onResize, selectAll, onAddColumn, updateOrdering, readonly } = this.props;
let elements = [
// Note: bulk checkbox is disabled as all rows are selected (not just visible ones due to current lazy loading implementation)
// TODO: add bulk checking only visible rows
Expand Down
2 changes: 0 additions & 2 deletions src/components/DatePicker/DatePicker.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
*/
import DatePicker from 'components/DatePicker/DatePicker.react';
import Field from 'components/Field/Field.react';
import Fieldset from 'components/Fieldset/Fieldset.react';
import Label from 'components/Label/Label.react';
import Option from 'components/Dropdown/Option.react';
import React from 'react';

export const component = DatePicker;
Expand Down
3 changes: 1 addition & 2 deletions src/components/DatePicker/DatePicker.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { Directions } from 'lib/Constants';
import { MONTHS } from 'lib/DateUtils';
import Popover from 'components/Popover/Popover.react';
import Position from 'lib/Position';
import PropTypes from 'lib/PropTypes';
import React from 'react';
import ReactDOM from 'react-dom';
import SliderWrap from 'components/SliderWrap/SliderWrap.react';
Expand All @@ -30,7 +29,7 @@ export default class DatePicker extends React.Component {
}

toggle() {
this.setState((state) => {
this.setState(() => {
if (this.state.open) {
return { open: false };
}
Expand Down
4 changes: 0 additions & 4 deletions src/components/DateRange/DateRange.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
*/
import DateRange from 'components/DateRange/DateRange.react';
import { Directions } from 'lib/Constants';
import Field from 'components/Field/Field.react';
import Fieldset from 'components/Fieldset/Fieldset.react';
import Label from 'components/Label/Label.react';
import Option from 'components/Dropdown/Option.react';
import React from 'react';

export const component = DateRange;
Expand Down
2 changes: 1 addition & 1 deletion src/components/DateRange/DateRange.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class DateRange extends React.Component {
}

toggle() {
this.setState((state) => {
this.setState(() => {
if (this.state.open) {
return { open: false };
}
Expand Down
4 changes: 0 additions & 4 deletions src/components/DateTimeEditor/DateTimeEditor.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
*/
import DateTimePicker from 'components/DateTimePicker/DateTimePicker.react';
import hasAncestor from 'lib/hasAncestor';
import { MONTHS } from 'lib/DateUtils';
import Popover from 'components/Popover/Popover.react';
import Position from 'lib/Position';
import React from 'react';
import ReactDOM from 'react-dom';
import styles from 'components/DateTimeEditor/DateTimeEditor.scss';

export default class DateTimeEditor extends React.Component {
Expand Down
3 changes: 1 addition & 2 deletions src/components/DateTimeEntry/DateTimeEntry.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* the root directory of this source tree.
*/
import DateTimePicker from 'components/DateTimePicker/DateTimePicker.react';
import { MONTHS } from 'lib/DateUtils';
import Popover from 'components/Popover/Popover.react';
import Position from 'lib/Position';
import React from 'react';
Expand Down Expand Up @@ -34,7 +33,7 @@ export default class DateTimeEntry extends React.Component {
}

toggle() {
this.setState((state) => {
this.setState(() => {
if (this.state.open) {
return { open: false };
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/DateTimeInput/DateTimeInput.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
*/
import DateTimeInput from 'components/DateTimeInput/DateTimeInput.react';
import Field from 'components/Field/Field.react';
import Fieldset from 'components/Fieldset/Fieldset.react';
import Label from 'components/Label/Label.react';
import Option from 'components/Dropdown/Option.react';
import React from 'react';

export const component = DateTimeInput;
Expand Down
4 changes: 2 additions & 2 deletions src/components/DateTimeInput/DateTimeInput.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import ReactDOM from 'react-dom';
import styles from 'components/DateTimeInput/DateTimeInput.scss';

export default class DateTimeInput extends React.Component {
constructor(props) {
constructor() {
super();

this.state = {
Expand All @@ -28,7 +28,7 @@ export default class DateTimeInput extends React.Component {
}

toggle() {
this.setState((state) => {
this.setState(() => {
if (this.state.open) {
return { open: false };
}
Expand Down
4 changes: 1 addition & 3 deletions src/components/DateTimePicker/DateTimePicker.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
*/
import Button from 'components/Button/Button.react';
import Calendar from 'components/Calendar/Calendar.react';
import { Directions } from 'lib/Constants';
import { MONTHS, hoursFrom, getDateMethod } from 'lib/DateUtils';
import { hoursFrom, getDateMethod } from 'lib/DateUtils';
import PropTypes from 'lib/PropTypes';
import React from 'react';
import ReactDOM from 'react-dom';
import styles from 'components/DateTimePicker/DateTimePicker.scss';

export default class DateTimePicker extends React.Component {
Expand Down
10 changes: 0 additions & 10 deletions src/components/DragHandle/DragHandle.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,6 @@ class HeadersDemo extends React.Component {
}

render() {
let handleStyle = {
position: 'relative',
display: 'inline-block',
width: 4,
height: 30,
marginLeft: -2,
marginRight: -2,
cursor: 'ew-resize'
};

return (
<div style={{ height: 30, background: '#66637A', whiteSpace: 'nowrap' }}>
<div style={{ display: 'inline-block', width: this.state.widths[0] }}>
Expand Down
1 change: 0 additions & 1 deletion src/components/Dropdown/Dropdown.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
import Dropdown from 'components/Dropdown/Dropdown.react';
import Field from 'components/Field/Field.react';
import Fieldset from 'components/Fieldset/Fieldset.react';
import Label from 'components/Label/Label.react';
import Option from 'components/Dropdown/Option.react';
import React from 'react';
Expand Down
Loading

0 comments on commit 6ed8075

Please sign in to comment.