Skip to content

Commit 47d0d87

Browse files
Aditya Vohradiasbruno
Aditya Vohra
authored andcommitted
[chore] prettier all the things
1 parent c0620e0 commit 47d0d87

17 files changed

+467
-419
lines changed

Diff for: .eslintrc renamed to .eslintrc.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
{
1+
module.exports = {
22
"env": {
33
"es6": true,
44
"browser": true
55
},
6+
67
"parser": "babel-eslint",
8+
79
"parserOptions": {
810
"ecmaVersion": 7,
911
"ecmaFeatures": {
1012
"jsx": true
1113
},
1214
"sourceType": "module"
1315
},
16+
1417
"settings": {
1518
"react": {
1619
"createClass": "createReactClass",
@@ -19,10 +22,15 @@
1922
},
2023
"propWrapperFunctions": [ "forbidExtraProps" ]
2124
},
22-
"extends": ["eslint:recommended", "plugin:react/recommended"],
25+
26+
"extends": ["eslint:recommended", "plugin:react/recommended", "prettier"],
27+
28+
"plugins": ["prettier"],
29+
2330
"globals": {
2431
"process": true
2532
},
33+
2634
"rules": {
2735
"quotes": [0],
2836
"comma-dangle": [2, "only-multiline"],
@@ -34,6 +42,7 @@
3442
"arrow-parens": [0],
3543
"space-before-function-paren": [0],
3644
"jsx-a11y/no-static-element-interactions": [0],
45+
"prettier/prettier": "error",
3746
"react/no-find-dom-node": [0],
3847
"react/jsx-closing-bracket-location": [0],
3948
"react/require-default-props": 0

Diff for: package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"scripts": {
1616
"start": "./node_modules/.bin/webpack-dev-server --inline --host 127.0.0.1 --content-base examples/",
1717
"test": "cross-env NODE_ENV=test karma start",
18-
"lint": "eslint src/ spec/"
18+
"lint": "eslint src/ specs/"
1919
},
2020
"authors": [
2121
"Ryan Florence"
@@ -33,7 +33,9 @@
3333
"coveralls": "^2.13.1",
3434
"cross-env": "^5.0.1",
3535
"eslint": "^4.8.0",
36+
"eslint-config-prettier": "^2.6.0",
3637
"eslint-plugin-jsx-a11y": "^6.0.2",
38+
"eslint-plugin-prettier": "^2.3.1",
3739
"eslint-plugin-react": "^7.4.0",
3840
"gitbook-cli": "^2.3.0",
3941
"istanbul-instrumenter-loader": "^3.0.0",
@@ -47,6 +49,7 @@
4749
"karma-webpack": "^2.0.4",
4850
"mocha": "3.5.3",
4951
"npm-run-all": "^4.1.1",
52+
"prettier": "^1.7.4",
5053
"react": "^16.0.0",
5154
"react-dom": "^16.0.0",
5255
"react-router": "^4.2.0",

Diff for: specs/Modal.events.spec.js

+32-28
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,48 @@
11
/* eslint-env mocha */
2-
import 'should';
3-
import sinon from 'sinon';
4-
import React from 'react';
5-
import ReactDOM from 'react-dom';
6-
import TestUtils from 'react-dom/test-utils';
7-
import Modal from '../src/components/Modal.js';
2+
import "should";
3+
import sinon from "sinon";
84
import {
9-
moverlay, mcontent,
10-
clickAt, mouseDownAt, mouseUpAt, escKeyDown, tabKeyDown,
11-
renderModal, emptyDOM
12-
} from './helper';
5+
moverlay,
6+
mcontent,
7+
clickAt,
8+
mouseDownAt,
9+
mouseUpAt,
10+
escKeyDown,
11+
tabKeyDown,
12+
renderModal,
13+
emptyDOM
14+
} from "./helper";
1315

1416
export default () => {
15-
afterEach('Unmount modal', emptyDOM);
17+
afterEach("Unmount modal", emptyDOM);
1618

17-
it('should trigger the onAfterOpen callback', () => {
19+
it("should trigger the onAfterOpen callback", () => {
1820
const afterOpenCallback = sinon.spy();
1921
renderModal({ isOpen: true, onAfterOpen: afterOpenCallback });
2022
afterOpenCallback.called.should.be.ok();
2123
});
2224

23-
it('keeps focus inside the modal when child has no tabbable elements', () => {
25+
it("keeps focus inside the modal when child has no tabbable elements", () => {
2426
let tabPrevented = false;
25-
const modal = renderModal({ isOpen: true }, 'hello');
27+
const modal = renderModal({ isOpen: true }, "hello");
2628
const content = mcontent(modal);
2729
document.activeElement.should.be.eql(content);
2830
tabKeyDown(content, {
29-
preventDefault() { tabPrevented = true; }
31+
preventDefault() {
32+
tabPrevented = true;
33+
}
3034
});
3135
tabPrevented.should.be.eql(true);
3236
});
3337

34-
it('handles case when child has no tabbable elements', () => {
35-
const modal = renderModal({ isOpen: true }, 'hello');
38+
it("handles case when child has no tabbable elements", () => {
39+
const modal = renderModal({ isOpen: true }, "hello");
3640
const content = mcontent(modal);
3741
tabKeyDown(content);
3842
document.activeElement.should.be.eql(content);
3943
});
4044

41-
it('should close on Esc key event', () => {
45+
it("should close on Esc key event", () => {
4246
const requestCloseCallback = sinon.spy();
4347
const modal = renderModal({
4448
isOpen: true,
@@ -52,8 +56,8 @@ export default () => {
5256
ev.should.be.ok();
5357
});
5458

55-
describe('shouldCloseOnoverlayClick', () => {
56-
it('when false, click on overlay should not close', () => {
59+
describe("shouldCloseOnoverlayClick", () => {
60+
it("when false, click on overlay should not close", () => {
5761
const requestCloseCallback = sinon.spy();
5862
const modal = renderModal({
5963
isOpen: true,
@@ -64,7 +68,7 @@ export default () => {
6468
requestCloseCallback.called.should.not.be.ok();
6569
});
6670

67-
it('when true, click on overlay must close', () => {
71+
it("when true, click on overlay must close", () => {
6872
const requestCloseCallback = sinon.spy();
6973
const modal = renderModal({
7074
isOpen: true,
@@ -75,7 +79,7 @@ export default () => {
7579
requestCloseCallback.called.should.be.ok();
7680
});
7781

78-
it('overlay mouse down and content mouse up, should not close', () => {
82+
it("overlay mouse down and content mouse up, should not close", () => {
7983
const requestCloseCallback = sinon.spy();
8084
const modal = renderModal({
8185
isOpen: true,
@@ -87,7 +91,7 @@ export default () => {
8791
requestCloseCallback.called.should.not.be.ok();
8892
});
8993

90-
it('content mouse down and overlay mouse up, should not close', () => {
94+
it("content mouse down and overlay mouse up, should not close", () => {
9195
const requestCloseCallback = sinon.spy();
9296
const modal = renderModal({
9397
isOpen: true,
@@ -100,20 +104,20 @@ export default () => {
100104
});
101105
});
102106

103-
it('should not stop event propagation', () => {
107+
it("should not stop event propagation", () => {
104108
let hasPropagated = false;
105109
const modal = renderModal({
106110
isOpen: true,
107111
shouldCloseOnOverlayClick: true
108112
});
109-
window.addEventListener('click', () => {
113+
window.addEventListener("click", () => {
110114
hasPropagated = true;
111115
});
112-
moverlay(modal).dispatchEvent(new MouseEvent('click', { bubbles: true }));
116+
moverlay(modal).dispatchEvent(new MouseEvent("click", { bubbles: true }));
113117
hasPropagated.should.be.ok();
114118
});
115119

116-
it('verify event passing on overlay click', () => {
120+
it("verify event passing on overlay click", () => {
117121
const requestCloseCallback = sinon.spy();
118122
const modal = renderModal({
119123
isOpen: true,
@@ -123,7 +127,7 @@ export default () => {
123127
// click the overlay
124128
clickAt(moverlay(modal), {
125129
// Used to test that this was the event received
126-
fakeData: 'ABC'
130+
fakeData: "ABC"
127131
});
128132
requestCloseCallback.called.should.be.ok();
129133
// Check if event is passed to onRequestClose callback.

0 commit comments

Comments
 (0)