Skip to content

Commit d3ec5ca

Browse files
author
David Zukowski
committed
fix(blueprints): lint and layout cleanup
1 parent 1879171 commit d3ec5ca

File tree

26 files changed

+152
-130
lines changed

26 files changed

+152
-130
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
blueprints/**/files/**
12
coverage/**
23
node_modules/**
34
dist/**

blueprints/.eslintrc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends" : "../.eslintrc",
3+
"env" : {
4+
"mocha" : true
5+
},
6+
"globals" : {
7+
"expect" : false,
8+
"should" : false,
9+
"sinon" : false
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1+
const path = require('path')
2+
13
module.exports = {
2-
locals: function(options) {
4+
locals: function (options) {
35
// Return custom template variables here.
4-
return {};
6+
return {}
57
},
68

7-
fileMapTokens: function(options) (
9+
fileMapTokens: function (options) {
810
// Return custom tokens to be replaced in your files
911
return {
10-
__token__: function(options){
12+
__token__: function (options) {
1113
// logic to determine value goes here
12-
return 'value';
14+
return 'value'
1315
}
1416
}
1517
},
1618

1719
// Should probably never need to be overriden
1820

19-
filesPath: function() {
20-
return path.join(this.path, 'files');
21+
filesPath: function () {
22+
return path.join(this.path, 'files')
2123
},
2224

23-
beforeInstall: function(options) {},
24-
afterInstall: function(options) {},
25-
};
25+
beforeInstall: function (options) {},
26+
afterInstall: function (options) {}
27+
}

blueprints/blueprint/index.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module.exports = {
2-
description() {
3-
return 'generates a blueprint and definition';
2+
description () {
3+
return 'generates a blueprint and definition'
44
},
55

6-
beforeInstall() {
7-
console.log('Before installation hook!');
6+
beforeInstall () {
7+
console.log('Before installation hook!')
88
},
99

10-
afterInstall() {
11-
console.log('After installation hook!');
10+
afterInstall () {
11+
console.log('After installation hook!')
1212
}
13-
};
13+
}
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
// Constants
2-
3-
// export const constants = { };
2+
// export const constants = { }
43

54
// Action Creators
6-
7-
// export const actions = { };
5+
// export const actions = { }
86

97
// Reducer
10-
export const defaultState = {
11-
};
12-
13-
export default function(state = defaultState, action) {
8+
export const initialState = {}
9+
export default function (state = initialState, action) {
1410
switch (action.type) {
1511
default:
16-
return state;
12+
return state
1713
}
1814
}
19-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import reducer, { initialState } from 'redux/modules/<%= pascalEntityName %>'
2+
3+
describe('(Redux) <%= pascalEntityName %>', () => {
4+
describe('(Reducer)', () => {
5+
it('sets up initial state', () => {
6+
expect(reducer(undefined, {})).to.eql(initialState)
7+
})
8+
})
9+
})

blueprints/duck/files/__test__/redux/modules/__name__.test.js

-10
This file was deleted.

blueprints/duck/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
description() {
3-
return 'generates a redux duck';
2+
description () {
3+
return 'generates a redux duck'
44
}
5-
};
5+
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import React, { Component, PropTypes } from 'react';
1+
import React from 'react'
2+
3+
type Props = {
24

3-
const propTypes = {
45
};
6+
export class <%= pascalEntityName %> extends React.Component {
7+
props: Props;
58

6-
class <%= pascalEntityName %> extends Component {
7-
render() {
9+
render () {
810
return (
11+
<div></div>
912
)
1013
}
1114
}
1215

13-
<%= pascalEntityName %>.propTypes = propTypes;
14-
export default <%= pascalEntityName %>;
16+
export default <%= pascalEntityName %>
1517

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import React from 'react'
2+
import <%= pascalEntityName %> from 'components/<%= pascalEntityName %>'
3+
4+
describe('(Component) <%= pascalEntityName %>', () => {
5+
it('should exist', () => {
6+
7+
})
8+
})

blueprints/dumb/files/__test__/components/__name__.test.js

-7
This file was deleted.

blueprints/dumb/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
description() {
3-
return 'generates a dumb (pure) component';
2+
description () {
3+
return 'generates a dumb (pure) component'
44
}
5-
};
5+
}
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
1-
import React, { Component, PropTypes } from 'react';
2-
import { reduxForm } from 'redux-form';
1+
import React from 'react'
2+
import { reduxForm } from 'redux-form'
33

4-
export const fields = [];
4+
export const fields = []
55

66
const validate = (values) => {
7-
const errors = {};
8-
return errors;
9-
};
7+
const errors = {}
8+
return errors
9+
}
10+
11+
type Props = {
12+
handleSubmit: Function,
13+
fields: Object,
14+
}
15+
export class <%= pascalEntityName %> extends React.Component {
16+
props: Props;
1017

11-
const propTypes = {
12-
handleSubmit: PropTypes.func.isRequired,
13-
fields: PropTypes.object.isRequired
14-
};
18+
defaultProps = {
19+
fields: {},
20+
}
1521

16-
export class <%= pascalEntityName %> extends Component {
1722
render() {
18-
const {
19-
fields: {},
20-
handleSubmit
21-
} = this.props;
23+
const { fields, handleSubmit } = this.props
2224

2325
return (
2426
<form onSubmit={handleSubmit}>
2527
</form>
26-
);
28+
)
2729
}
2830
}
2931

30-
<%= pascalEntityName %>.propTypes = propTypes;
3132
<%= pascalEntityName %> = reduxForm({
3233
form: '<%= pascalEntityName %>',
3334
fields,
3435
validate
35-
})(<%= pascalEntityName %>);
36+
})(<%= pascalEntityName %>)
3637

37-
export default <%= pascalEntityName %>;
38+
export default <%= pascalEntityName %>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
describe('(Form) <%= pascalEntityName %>', () => {
22
it('exists', () => {
33

4-
});
5-
});
4+
})
5+
})

blueprints/form/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
description() {
3-
return 'generates a connected redux-form form component';
2+
description () {
3+
return 'generates a connected redux-form form component'
44
}
5-
};
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react'
2+
3+
describe('(Layout) <%= pascalEntityName %>', () => {
4+
it('should exist', () => {
5+
6+
})
7+
})

blueprints/layout/files/__test__/layouts/__name__Layout.test.js

-7
This file was deleted.

blueprints/layout/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
description() {
3-
return 'generates a functional layout component';
2+
description () {
3+
return 'generates a functional layout component'
44
}
5-
};
5+
}
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
import React, { Component, PropTypes } from 'react';
2-
import { connect } from 'react-redux';
3-
import { bindActionCreators } from 'redux';
1+
import React from 'react'
2+
import { connect } from 'react-redux'
3+
import { bindActionCreators } from 'redux'
44

5-
const propTypes = {
6-
};
5+
type Props = {
6+
7+
}
8+
export class <%= pascalEntityName %> extends React.Component {
9+
props: Props;
710

8-
class <%= pascalEntityName %> extends Component {
911
render() {
1012
return (
11-
13+
<div></div>
1214
)
1315
}
1416
}
1517

1618
const mapStateToProps = (state) => {
17-
return {};
19+
return {}
1820
}
1921
const mapDispatchToProps = (dispatch) => {
20-
return {};
22+
return {}
2123
}
2224

23-
<%= pascalEntityName %>.propTypes = propTypes;
2425
export default connect(
2526
mapStateToProps,
2627
mapDispatchToProps
27-
)(<%= pascalEntityName %>);
28-
28+
)(<%= pascalEntityName %>)
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
describe('(Component) <%= pascalEntityName %>', () => {
22
it('exists', () => {
33

4-
});
5-
});
4+
})
5+
})

blueprints/smart/index.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
module.exports = {
2-
description() {
3-
return 'generates a smart (container) component';
2+
description () {
3+
return 'generates a smart (container) component'
44
},
5-
fileMapTokens() {
5+
6+
fileMapTokens () {
67
return {
78
__smart__: (options) => {
8-
return options.settings.getSetting('smartPath');
9+
return options.settings.getSetting('smartPath')
910
}
1011
}
1112
}
12-
};
13+
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import React, { PropTypes } from 'react'
2-
3-
function <%= pascalEntityName %> ({ children }) {
4-
return (
5-
<div className='<%= snakeEntityName %>-layout'>
6-
{children}
7-
</div>
8-
)
9-
}
1+
import React from 'react'
2+
3+
type Props = {
4+
5+
};
6+
export class <%= pascalEntityName %> extends React.Component {
7+
props: Props;
108

11-
<%= pascalEntityName %>.propTypes = {
12-
children: PropTypes.element
9+
render () {
10+
return (
11+
<div></div>
12+
)
13+
}
1314
}
1415

1516
export default <%= pascalEntityName %>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react'
2+
3+
describe('(View) <%= pascalEntityName %>', () => {
4+
it('should exist', () => {
5+
6+
})
7+
})

blueprints/view/files/__test__/views/__name__View.test.js

-7
This file was deleted.

0 commit comments

Comments
 (0)