Skip to content

Commit

Permalink
Get rid of annoying space after function lint rule
Browse files Browse the repository at this point in the history
Also no longer enforce function expressions
  • Loading branch information
ianobermiller committed Nov 7, 2015
1 parent a004e48 commit 94b73dd
Show file tree
Hide file tree
Showing 26 changed files with 237 additions and 241 deletions.
4 changes: 2 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ rules:
consistent-this: [2, "self"] # enforces consistent naming when capturing the current execution context
eol-last: 2 # enforce newline at the end of file, with no multiple empty lines
func-names: 0 # require function expressions to have a name
func-style: [2, "expression"] # enforces use of function expressions
func-style: [0, "expression"] # enforces use of function expressions
key-spacing: 2 # enforces spacing between keys and values in object literal properties
indent: [2, 2]
max-nested-callbacks: [2, 4] # specify the maximum depth callbacks can be nested
Expand Down Expand Up @@ -218,7 +218,7 @@ rules:
spaced-comment: 2 # require or disallow a space immediately following
# the // in a line comment
wrap-regex: 0 # require regex literals to be wrapped in parentheses
space-before-function-paren: [2, "always"]
space-before-function-paren: [2, "never"]

###########################################################################
# #
Expand Down
4 changes: 2 additions & 2 deletions modules/__tests__/camel-case-props-to-dash-case-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import camelCasePropsToDashCase from 'camel-case-props-to-dash-case.js';

describe('camelCasePropsToDashCase', function () {
it('converts to dash case correctly', function () {
describe('camelCasePropsToDashCase', function() {
it('converts to dash case correctly', function() {
const result = camelCasePropsToDashCase({
borderLeft: '1px solid black',
WebkitBoxSizing: 'border-box'
Expand Down
39 changes: 19 additions & 20 deletions modules/__tests__/enhancer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,27 @@ describe('Enhancer', () => {

it('merges with existing state', () => {
class Composed extends Component {
constructor () {
constructor() {
super();
this.state = {foo: 'bar'};
}
render () {}
render() {}
}
const Enhanced = Enhancer(Composed);

const instance = new Enhanced();


expect(instance.state).to.deep.equal(
{foo: 'bar', _radiumStyleState: {}}
);
});

it('receives the given props', () => {
class Composed extends Component {
constructor (props) {
constructor(props) {
super(props);
}
render () {}
render() {}
}
const Enhanced = Enhancer(Composed);

Expand All @@ -50,7 +49,7 @@ describe('Enhancer', () => {
it('calls existing render function, then resolveStyles', () => {
const renderMock = sinon.spy();
class Composed extends Component {
render () {
render() {
renderMock();
return null;
}
Expand All @@ -67,11 +66,11 @@ describe('Enhancer', () => {
it('calls existing constructor only once', () => {
const constructorMock = sinon.spy();
class Composed extends Component {
constructor () {
constructor() {
super();
constructorMock();
}
render () {}
render() {}
}
const Enhanced = Enhancer(Composed);

Expand All @@ -91,7 +90,7 @@ describe('Enhancer', () => {

it('sets up classNames on for printStyles have a copy', () => {
class Composed extends Component {
render () {}
render() {}
}
Composed.displayName = 'PrintStyleTest';
Composed.printStyles = {
Expand All @@ -109,10 +108,10 @@ describe('Enhancer', () => {
it('calls existing componentWillUnmount function', () => {
const existingComponentWillUnmount = sinon.spy();
class Composed extends Component {
componentWillUnmount () {
componentWillUnmount() {
existingComponentWillUnmount();
}
render () {}
render() {}
}
const Enhanced = Enhancer(Composed);

Expand All @@ -125,11 +124,11 @@ describe('Enhancer', () => {
it('removes mouse up listener on componentWillUnmount', () => {
const removeMouseUpListener = sinon.spy();
class Composed extends Component {
constructor () {
constructor() {
super();
this._radiumMouseUpListener = { remove: removeMouseUpListener };
}
render () {}
render() {}
}
const Enhanced = Enhancer(Composed);

Expand All @@ -146,28 +145,28 @@ describe('Enhancer', () => {
'(min-resolution: 2dppx)': { remove: sinon.spy() }
};
class Composed extends Component {
constructor () {
constructor() {
super();
this._radiumMediaQueryListenersByQuery = mediaQueryListenersByQuery;
}
render () {}
render() {}
}
const Enhanced = Enhancer(Composed);

const instance = new Enhanced();
instance.componentWillUnmount();

Object.keys(mediaQueryListenersByQuery).forEach(function (key) {
Object.keys(mediaQueryListenersByQuery).forEach(function(key) {
expect(mediaQueryListenersByQuery[key].remove).to.have.been.called;
});
});

it('manually populates all static properties for IE <10', () => {
class Composed extends Component {
static staticMethod () {
static staticMethod() {
return { bar: 'foo' };
}
render () {}
render() {}
}

Composed.defaultProps = { foo: 'bar' };
Expand All @@ -181,11 +180,11 @@ describe('Enhancer', () => {
it('copies methods across to top level prototype', () => {
const Composed = React.createClass({

getStyles: function () {
getStyles: function() {
return [{ color: 'black' }];
},

render: function () {
render: function() {
return (
<div style={this.getStyles()}>
Hello World!
Expand Down
4 changes: 2 additions & 2 deletions modules/__tests__/get-state-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import getState from 'get-state.js';

describe('getState', function () {
it('successfully gets the state if passed number zero', function () {
describe('getState', function() {
it('successfully gets the state if passed number zero', function() {
const result = getState(
{_radiumStyleState: {'0': {':hover': true}}},
0,
Expand Down
22 changes: 11 additions & 11 deletions modules/__tests__/prefixer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ describe('Prefixer', () => {
browserPrefix = '-webkit-';
const transformGetter = sinon.stub().returns('foo');
mockStyle = {
get transform () { return transformGetter(); },
set transform (value) { }
get transform() { return transformGetter(); },
set transform(value) { }
};
const Prefixer = require('inject!prefixer.js')({'exenv': exenv});
Prefixer.getPrefixedStyle({transform: 'foo'});
Expand Down Expand Up @@ -149,8 +149,8 @@ describe('Prefixer', () => {
it('ignores unsupported values', () => {
browserPrefix = '-webkit-';
mockStyle = {
get transform () { return ''; },
set transform (value) { }
get transform() { return ''; },
set transform(value) { }
};
const Prefixer = require('inject!prefixer.js')({'exenv': exenv});
expect(
Expand Down Expand Up @@ -195,8 +195,8 @@ describe('Prefixer', () => {
browserPrefix = '-webkit-';
let flexValue = '';
mockStyle = {
get display () { return flexValue; },
set display (value) {
get display() { return flexValue; },
set display(value) {
if (value === '-webkit-flex') {
flexValue = '-webkit-flex';
} else {
Expand All @@ -214,8 +214,8 @@ describe('Prefixer', () => {
browserPrefix = '-webkit-';
let flexValue = '';
mockStyle = {
get display () { return flexValue; },
set display (value) {
get display() { return flexValue; },
set display(value) {
if (value === '-webkit-box') {
flexValue = '-webkit-box';
} else {
Expand All @@ -233,8 +233,8 @@ describe('Prefixer', () => {
browserPrefix = '-webkit-';
let flexValue = '';
mockStyle = {
get color () { return flexValue; },
set color (value) {
get color() { return flexValue; },
set color(value) {
if (value === '#fff') {
flexValue = '#fff';
} else {
Expand Down Expand Up @@ -282,7 +282,7 @@ describe('Prefixer', () => {
mockStyle = {color: 'inherit'};
const Prefixer = require('inject!prefixer.js')({'exenv': exenv});
const colorHelper = {
toString () {
toString() {
return 'white';
}
};
Expand Down
Loading

0 comments on commit 94b73dd

Please sign in to comment.