Skip to content

Commit

Permalink
style: fix style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Nov 28, 2016
1 parent 9f1ccb8 commit c383048
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 86 deletions.
4 changes: 2 additions & 2 deletions src/extendReactClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import renderNothing from './renderNothing';
export default (Component: Object, defaultStyles: Object, options: Object) => {
const WrappedComponent = class extends Component {
render () {
let propsChanged,
styles;
let propsChanged;
let styles;

propsChanged = false;

Expand Down
14 changes: 8 additions & 6 deletions src/generateAppendClassName.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import Map from './simple-map';
import SimpleMap from './SimpleMap';

const stylesIndex = new Map();
const CustomMap = typeof Map === 'undefined' ? SimpleMap : Map;

const stylesIndex = new CustomMap();

export default (styles, styleNames: Array<string>, errorWhenNotFound: boolean): string => {
let appendClassName,
stylesIndexMap;
let appendClassName;
let stylesIndexMap;

stylesIndexMap = stylesIndex.get(styles);

Expand All @@ -15,8 +17,8 @@ export default (styles, styleNames: Array<string>, errorWhenNotFound: boolean):
return styleNameIndex;
}
} else {
stylesIndexMap = new Map();
stylesIndex.set(styles, new Map());
stylesIndexMap = new CustomMap();
stylesIndex.set(styles, new CustomMap());
}

appendClassName = '';
Expand Down
6 changes: 3 additions & 3 deletions src/linkClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import parseStyleName from './parseStyleName';
import generateAppendClassName from './generateAppendClassName';

const linkElement = (element: ReactElement, styles: Object, configuration: Object): ReactElement => {
let appendClassName,
elementIsFrozen,
elementShallowCopy;
let appendClassName;
let elementIsFrozen;
let elementShallowCopy;

elementShallowCopy = element;

Expand Down
25 changes: 0 additions & 25 deletions src/simple-map.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/wrapStatelessFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import renderNothing from './renderNothing';
*/
export default (Component: Function, defaultStyles: Object, options: Object): Function => {
const WrappedComponent = (props = {}, ...args) => {
let styles,
useProps;
let styles;
let useProps;

if (props.styles) {
useProps = props;
Expand Down
4 changes: 2 additions & 2 deletions tests/extendReactClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ describe('extendReactClass', () => {
TestUtils.renderIntoDocument(<Component bar='baz' />);
});
it('does not affect pure-render logic', (done) => {
let Component,
rendered;
let Component;
let rendered;

rendered = false;

Expand Down
4 changes: 2 additions & 2 deletions tests/linkClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ describe('linkClass', () => {
});

context('when ReactElement includes ReactComponent', () => {
let Foo,
nodeList;
let Foo;
let nodeList;

beforeEach(() => {
global.document = jsdom.jsdom('<!DOCTYPE html><html><head></head><body></body></html>');
Expand Down
14 changes: 7 additions & 7 deletions tests/reactCssModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ describe('reactCssModules', () => {
});
context('a ReactComponent renders an element with the styleName prop', () => {
context('the component is a class that extends React.Component', () => {
let Foo,
component;
let Foo;
let component;

beforeEach(() => {
const shallowRenderer = TestUtils.createRenderer();
Expand All @@ -65,8 +65,8 @@ describe('reactCssModules', () => {
});
});
context('the component is a stateless function component', () => {
let Foo,
component;
let Foo;
let component;

beforeEach(() => {
const shallowRenderer = TestUtils.createRenderer();
Expand Down Expand Up @@ -146,9 +146,9 @@ describe('reactCssModules', () => {
context('parent component is using react-css-modules and interpolates props.children', () => {
// @see https://github.com/gajus/react-css-modules/issues/76
it('unsets the styleName property', () => {
let Bar,
Foo,
subject;
let Bar;
let Foo;
let subject;

Foo = class extends React.Component {
render () {
Expand Down
37 changes: 0 additions & 37 deletions tests/simple-map.js

This file was deleted.

0 comments on commit c383048

Please sign in to comment.