Skip to content

Commit 6ed8075

Browse files
authored
Enforces lint on test (#710)
1 parent f8bbf56 commit 6ed8075

File tree

127 files changed

+411
-553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+411
-553
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"node": true,
55
"browser": true
66
},
7+
"parser": "babel-eslint",
78
"extends": "eslint:recommended",
89
"installedESLint": true,
910
"parserOptions": {

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ PIG/bundles/
55
Parse-Dashboard/public/bundles/
66
Parse-Dashboard/parse-dashboard-config.json
77
npm-debug.log
8+
.eslintcache
89

910
// vim .swp
1011
*.swp
1112
.env
12-
.idea/
13+
.idea/

Parse-Dashboard/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function checkIfIconsExistForApps(apps, iconsFolder) {
3131
var iconName = currentApp.iconName;
3232
var path = iconsFolder + "/" + iconName;
3333

34-
fs.stat(path, function(err, stat) {
34+
fs.stat(path, function(err) {
3535
if (err) {
3636
if ('ENOENT' == err.code) {// file does not exist
3737
console.warn("Icon with file name: " + iconName +" couldn't be found in icons folder!");

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@
4747
},
4848
"devDependencies": {
4949
"babel-core": "~5.8.12",
50+
"babel-eslint": "^7.2.3",
5051
"babel-loader": "~5.3.0",
5152
"babel-plugin-remove-proptypes": "~1.0.0",
5253
"babel-polyfill": "^6.7.2",
5354
"babel-runtime": "~5.8.25",
5455
"css-loader": "~0.18.0",
5556
"eslint": "^3.8.1",
57+
"eslint-plugin-jest": "^20.0.3",
5658
"eslint-plugin-react": "^6.4.1",
5759
"file-loader": "^0.8.5",
5860
"history": "^2.1.2",
@@ -84,7 +86,8 @@
8486
"pig": "http-server ./PIG -p 4041 -s & webpack --config webpack/PIG.config.js --progress --watch",
8587
"build": "NODE_ENV=production webpack --config webpack/production.config.js && webpack --config webpack/PIG.config.js",
8688
"test": "NODE_PATH=./node_modules jest",
87-
"lint": "eslint . --ignore-path .gitignore --ignore-pattern *.test.js",
89+
"lint": "eslint . --ignore-path .gitignore --cache",
90+
"pretest": "npm run lint",
8891
"generate": "node scripts/generate.js",
8992
"prepublish": "webpack --config webpack/publish.config.js",
9093
"start": "node ./Parse-Dashboard/index.js"

scripts/generate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ if (!name) {
131131
'',
132132
' name - The name of the component you wish to create a scaffold for'
133133
].join('\n'));
134-
return;
134+
process.exit(1);
135135
}
136136

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

149149
try {
150150
fs.mkdirSync(path.join(rootDir, name));

src/components/BrowserCell/BrowserCell.react.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
* This source code is licensed under the license found in the LICENSE file in
66
* the root directory of this source tree.
77
*/
8-
import { dateStringUTC, isDate } from 'lib/DateUtils';
8+
import { dateStringUTC } from 'lib/DateUtils';
99
import getFileName from 'lib/getFileName';
1010
import Parse from 'parse';
1111
import Pill from 'components/Pill/Pill.react';
1212
import React from 'react';
1313
import styles from 'components/BrowserCell/BrowserCell.scss';
1414
import { unselectable } from 'stylesheets/base.scss';
1515

16-
let BrowserCell = ({ type, value, hidden, width, current, onSelect, readonly, onEditChange, setRelation, onPointerClick }) => {
16+
let BrowserCell = ({ type, value, hidden, width, current, onSelect, onEditChange, setRelation, onPointerClick }) => {
1717
let content = value;
1818
let classes = [styles.cell, unselectable];
1919
if (hidden) {

src/components/BrowserFilter/BrowserFilter.react.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { List, Map } from 'immutable';
2020
const BLACKLISTED_FILTERS = [ 'containsAny', 'doesNotContainAny' ];
2121

2222
export default class BrowserFilter extends React.Component {
23-
constructor(props) {
23+
constructor() {
2424
super();
2525

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

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

7070
apply() {
7171
let formatted = this.state.filters.map((filter) => {
72-
let type = this.props.schema[filter.get('field')].type;
72+
// TODO: type is unused?
73+
/*let type = this.props.schema[filter.get('field')].type;
7374
if (Filters.Constraints[filter.get('constraint')].hasOwnProperty('field')) {
7475
type = Filters.Constraints[filter.get('constraint')].field;
75-
}
76+
}*/
7677
return filter;
7778
})
7879
this.setState({ open: false }, () => {

src/components/CascadingView/CascadingView.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import React from 'react';
1111
import styles from 'components/CascadingView/CascadingView.scss';
1212

1313
export default class CascadingView extends React.Component {
14-
constructor(props) {
14+
constructor() {
1515
super();
1616
this.state = {
1717
expanded: false

src/components/ChromeDatePicker/ChromeDatePicker.example.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
*/
88
import ChromeDatePicker from 'components/ChromeDatePicker/ChromeDatePicker.react';
99
import { Directions } from 'lib/Constants';
10-
import Field from 'components/Field/Field.react';
11-
import Fieldset from 'components/Fieldset/Fieldset.react';
12-
import Label from 'components/Label/Label.react';
13-
import Option from 'components/Dropdown/Option.react';
1410
import React from 'react';
1511

1612
export const component = ChromeDatePicker;

src/components/ChromeDatePicker/ChromeDatePicker.react.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import Calendar from 'components/Calendar/Calendar.react';
99
import { Directions } from 'lib/Constants';
1010
import Icon from 'components/Icon/Icon.react';
1111
import {
12-
monthDayStringUTC,
13-
monthsFrom,
14-
daysFrom
12+
monthDayStringUTC
1513
} from 'lib/DateUtils';
1614
import Popover from 'components/Popover/Popover.react';
1715
import Position from 'lib/Position';
@@ -21,7 +19,7 @@ import ReactDOM from 'react-dom';
2119
import styles from 'components/ChromeDatePicker/ChromeDatePicker.scss';
2220

2321
export default class ChromeDatePicker extends React.Component {
24-
constructor(props) {
22+
constructor() {
2523
super();
2624

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

3735
toggle() {
38-
this.setState((state) => {
36+
this.setState(() => {
3937
if (this.state.open) {
4038
return { open: false };
4139
}

0 commit comments

Comments
 (0)