Skip to content
This repository was archived by the owner on Aug 19, 2022. It is now read-only.

Commit ef507cd

Browse files
committed
Update Infra #969 - Replace isparta with istanbul
1 parent c88b0f1 commit ef507cd

39 files changed

+1331
-589
lines changed
File renamed without changes.

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ script:
3535
# Output useful info for debugging.
3636
- node --version
3737
- yarn --version
38+
# Make sure prettier has ran on all files.
39+
- yarn format-check
3840
# Make sure we can actually build the examples.
3941
- yarn run build-examples
4042
# Run tests

examples/app.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class HoverMessage extends React.Component {
3030
<button key="button" style={{display: 'flex', ':hover': {}}}>
3131
Hover me!
3232
</button>
33-
{getState(this.state, 'button', ':hover')
34-
? <span>{' '}Hovering!</span>
35-
: null}
33+
{getState(this.state, 'button', ':hover') ? (
34+
<span> Hovering!</span>
35+
) : null}
3636
</div>
3737
);
3838
}
@@ -42,7 +42,8 @@ HoverMessage = Radium(HoverMessage);
4242
//
4343
// Radium with ES7 decorator
4444
//
45-
@Radium class TwoSquares extends React.Component {
45+
@Radium
46+
class TwoSquares extends React.Component {
4647
render() {
4748
return (
4849
<div>
@@ -120,20 +121,26 @@ class App extends React.Component {
120121
<StyleRoot>
121122
<VisitedLink />
122123

123-
<p /><HoverMessage />
124+
<p />
125+
<HoverMessage />
124126

125-
<p /><TwoSquares />
127+
<p />
128+
<TwoSquares />
126129

127-
<p /><Spinner />
130+
<p />
131+
<Spinner />
128132

129-
<p /><MultiSpinner />
133+
<p />
134+
<MultiSpinner />
130135

131136
<p />
132137
<Button onClick={this._remount.bind(this)}>Unmount and remount</Button>
133138

134-
<p /><Button>Button</Button>
139+
<p />
140+
<Button>Button</Button>
135141

136-
<p /><Button color="red">Button</Button>
142+
<p />
143+
<Button color="red">Button</Button>
137144

138145
<p />
139146
<Button

examples/components/button.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import React from 'react';
1717
import PropTypes from 'prop-types';
1818
import Radium from '../../src';
1919

20-
@Radium class Button extends React.Component {
20+
@Radium
21+
class Button extends React.Component {
2122
render() {
2223
return (
2324
<button

interfaces/inline-style-prefixer.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
declare class InlineStylePrefixer {
2-
static prefixAll: typeof prefixAll,
2+
static prefixAll: typeof prefixAll;
33

4-
prefixedKeyframes: string,
4+
prefixedKeyframes: string;
55

6-
constructor(
7-
config: {
8-
keepUnprefixed?: boolean,
9-
userAgent?: ?string
10-
}
11-
): void,
6+
constructor(config: {
7+
keepUnprefixed?: boolean,
8+
userAgent?: ?string
9+
}): void;
1210

13-
prefix(style: Object): Object
11+
prefix(style: Object): Object;
1412
}
1513

1614
declare function prefixAll(style: Object): Object;

karma.conf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
const path = require('path');
22

3+
process.env.BABEL_ENV = 'commonjs';
4+
35
// Note: If we switch to ESM version of babelified files, we'll likely need to
46
// update from the ancient isparta-loader. Likely we'll switch to:
57
// https://github.com/istanbuljs/babel-plugin-istanbul with a `test` BABEL_ENV
68
//
79
// https://github.com/FormidableLabs/radium/issues/969
8-
process.env.BABEL_ENV = 'commonjs';
9-
1010
module.exports = function(config) {
1111
config.set({
1212
basePath: '',

package.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
"examples": "webpack-dev-server --config examples/webpack.config.js --no-info --content-base examples",
3535
"examples-server": "babel-node examples/server.js",
3636
"flow": "flow check",
37+
"format": "prettier --write \"{src,examples}/**/*.js\"",
38+
"format-check": "prettier --list-different \"{src,examples}/**/*.js\"",
3739
"eslint": "eslint .",
3840
"fixlint": "npm run eslint -- --fix",
3941
"lint": "builder concurrent --buffer eslint flow",
@@ -63,7 +65,9 @@
6365
"babel-preset-stage-1": "^6.22.0",
6466
"builder": "^3.2.3",
6567
"exenv": "^1.2.1",
68+
"husky": "^1.2.0",
6669
"inline-style-prefixer": "^4.0.0",
70+
"lint-staged": "^8.1.0",
6771
"prop-types": "^15.5.8",
6872
"publishr": "^1.0.0",
6973
"rimraf": "^2.6.1",
@@ -105,7 +109,7 @@
105109
"node-libs-browser": "^2.0.0",
106110
"nodemon": "^1.11.0",
107111
"object-assign": "^4.1.1",
108-
"prettier": "^0.22.0",
112+
"prettier": "^1.15.3",
109113
"react": "^16.2.0",
110114
"react-dom": "^16.2.0",
111115
"react-test-renderer": "^16.2.0",
@@ -127,5 +131,17 @@
127131
"scripts": {
128132
"postinstall": ""
129133
}
134+
},
135+
"husky": {
136+
"hooks": {
137+
"pre-commit": "lint-staged"
138+
}
139+
},
140+
"lint-staged": {
141+
"*.js": [
142+
"yarn format",
143+
"yarn fixlint",
144+
"git add"
145+
]
130146
}
131147
}

src/__tests__/enhancer-test.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,7 @@ describe('Enhancer', () => {
164164
return [{color: 'black'}];
165165
}
166166
render() {
167-
return (
168-
<div style={this.getStyles()}>
169-
Hello World!
170-
</div>
171-
);
167+
return <div style={this.getStyles()}>Hello World!</div>;
172168
}
173169
}
174170

src/__tests__/get-state-key-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('getStateKey', () => {
1818
it('gets the key if the ref is not a string', () => {
1919
class Test extends React.Component {
2020
render() {
21-
return <div key="myKey" ref={ref => this.ref = ref} />;
21+
return <div key="myKey" ref={ref => (this.ref = ref)} />;
2222
}
2323
}
2424

src/__tests__/keyframes-test.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {expectCSS, getElement} from 'test-helpers';
55
import React, {Component} from 'react';
66
import TestUtils from 'react-dom/test-utils';
77

8-
const CHROME_14_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 ' +
8+
const CHROME_14_USER_AGENT =
9+
'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 ' +
910
'(KHTML, like Gecko) Chrome/14.0.812.0 Safari/535.1';
1011

1112
describe('keyframes', () => {
@@ -243,13 +244,15 @@ describe('keyframes', () => {
243244
'SlideFromLeft'
244245
);
245246

246-
@Radium class ChildComponent extends Component {
247+
@Radium
248+
class ChildComponent extends Component {
247249
render() {
248250
return <div style={{animationName: animation}} />;
249251
}
250252
}
251253

252-
@Radium class TestComponent extends Component {
254+
@Radium
255+
class TestComponent extends Component {
253256
render() {
254257
return (
255258
<StyleRoot>
@@ -294,13 +297,15 @@ describe('keyframes', () => {
294297
'SlideFromTop'
295298
);
296299

297-
@Radium class ChildComponent extends Component {
300+
@Radium
301+
class ChildComponent extends Component {
298302
render() {
299303
return <div style={{animationName: [animation, animation2]}} />;
300304
}
301305
}
302306

303-
@Radium class TestComponent extends Component {
307+
@Radium
308+
class TestComponent extends Component {
304309
render() {
305310
return (
306311
<StyleRoot>

src/__tests__/media-query-test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@ describe('Media query tests', () => {
396396
// we only get called with `(undefined, { componentStack: STUFF })` just accept
397397
// it until we understand more.
398398
expect(catchSpy).to.have.callCount(1);
399-
expect(catchSpy.getCall(0).args[1]).to.have
400-
.property('componentStack')
399+
expect(catchSpy.getCall(0).args[1])
400+
.to.have.property('componentStack')
401401
.that.contains('Component');
402402
});
403403

@@ -409,7 +409,8 @@ describe('Media query tests', () => {
409409
</div>
410410
));
411411
expect(() =>
412-
TestUtils.renderIntoDocument(<TestComponent />)).not.to.throw();
412+
TestUtils.renderIntoDocument(<TestComponent />)
413+
).not.to.throw();
413414
});
414415

415416
it("doesn't try to setState if not mounted", () => {

0 commit comments

Comments
 (0)