Skip to content

Commit 7f75edf

Browse files
n1313sapegin
authored andcommitted
Chore: Fix ESLint errors
PR styleguidist#264
1 parent ca37e15 commit 7f75edf

File tree

22 files changed

+47
-50
lines changed

22 files changed

+47
-50
lines changed

examples/basic/lib/components/Button/Button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function Button({
1010
size,
1111
children,
1212
}) {
13-
let styles = {
13+
const styles = {
1414
color,
1515
fontSize: Button.sizes[size],
1616
};

examples/basic/lib/components/Modal/Modal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export default class Modal extends Component {
1111
};
1212

1313
render() {
14-
let { isOpen, children } = this.props;
15-
let style = {
14+
const { isOpen, children } = this.props;
15+
const style = {
1616
overlay: {
1717
zIndex: 999,
1818
},

examples/basic/lib/components/Placeholder/Placeholder.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export default class Placeholder extends Component {
1919
};
2020

2121
getImageUrl() {
22-
let { type, width, height } = this.props;
23-
let types = {
22+
const { type, width, height } = this.props;
23+
const types = {
2424
animal: `http://placeimg.com/${width}/${height}/animals`,
2525
bacon: `http://baconmockup.com/${width}/${height}`,
2626
bear: `http://www.placebear.com/${width}/${height}`,
@@ -35,7 +35,7 @@ export default class Placeholder extends Component {
3535
}
3636

3737
render() {
38-
let { width, height } = this.props;
38+
const { width, height } = this.props;
3939
return (
4040
<img className={s.root} src={this.getImageUrl()} width={width} height={height} />
4141
);

examples/basic/lib/components/PushButton/PushButton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function PushButton({
1010
size,
1111
children,
1212
}) {
13-
let styles = {
13+
const styles = {
1414
color,
1515
fontSize: PushButton.sizes[size],
1616
};

examples/basic/lib/components/WrappedButton/WrappedButton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const WrappedButton = ({
1010
size,
1111
children,
1212
}) => {
13-
let styles = {
13+
const styles = {
1414
color,
1515
fontSize: WrappedButton.sizes[size],
1616
};

examples/customised/lib/components/Button/Button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function Button({
1010
size,
1111
children,
1212
}) {
13-
let styles = {
13+
const styles = {
1414
color,
1515
fontSize: Button.sizes[size],
1616
};

examples/customised/lib/components/Modal/Modal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export default class Modal extends Component {
1111
};
1212

1313
render() {
14-
let { isOpen, children } = this.props;
15-
let style = {
14+
const { isOpen, children } = this.props;
15+
const style = {
1616
overlay: {
1717
zIndex: 999,
1818
},

examples/customised/lib/components/Placeholder/Placeholder.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export default class Placeholder extends Component {
1919
};
2020

2121
getImageUrl() {
22-
let { type, width, height } = this.props;
23-
let types = {
22+
const { type, width, height } = this.props;
23+
const types = {
2424
animal: `http://placeimg.com/${width}/${height}/animals`,
2525
bacon: `http://baconmockup.com/${width}/${height}`,
2626
bear: `http://www.placebear.com/${width}/${height}`,
@@ -35,7 +35,7 @@ export default class Placeholder extends Component {
3535
}
3636

3737
render() {
38-
let { width, height } = this.props;
38+
const { width, height } = this.props;
3939
return (
4040
<img className={s.root} src={this.getImageUrl()} width={width} height={height} />
4141
);

examples/sections/lib/components/Button/Button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function Button({
1010
size,
1111
children,
1212
}) {
13-
let styles = {
13+
const styles = {
1414
color,
1515
fontSize: Button.sizes[size],
1616
};

examples/sections/lib/components/Modal/Modal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export default class Modal extends Component {
1111
};
1212

1313
render() {
14-
let { isOpen, children } = this.props;
15-
let style = {
14+
const { isOpen, children } = this.props;
15+
const style = {
1616
overlay: {
1717
zIndex: 999,
1818
},

examples/sections/lib/components/Placeholder/Placeholder.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export default class Placeholder extends Component {
1919
};
2020

2121
getImageUrl() {
22-
let { type, width, height } = this.props;
23-
let types = {
22+
const { type, width, height } = this.props;
23+
const types = {
2424
animal: `http://placeimg.com/${width}/${height}/animals`,
2525
bacon: `http://baconmockup.com/${width}/${height}`,
2626
bear: `http://www.placebear.com/${width}/${height}`,
@@ -35,7 +35,7 @@ export default class Placeholder extends Component {
3535
}
3636

3737
render() {
38-
let { width, height } = this.props;
38+
const { width, height } = this.props;
3939
return (
4040
<img className={s.root} src={this.getImageUrl()} width={width} height={height} />
4141
);

loaders/utils/chunkify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const CODE_PLACEHOLDER = '<%{#code#}%>';
1313
* @returns {Array}
1414
*/
1515
module.exports = function chunkify(markdown) {
16-
let codeChunks = [];
16+
const codeChunks = [];
1717

1818
/*
1919
* - Highlight code in fenced code blocks with defined language (```html) if the language is not `example`.
@@ -48,7 +48,7 @@ module.exports = function chunkify(markdown) {
4848
.contents
4949
;
5050

51-
let chunks = [];
51+
const chunks = [];
5252
const textChunks = rendered.split(CODE_PLACEHOLDER);
5353
textChunks.forEach(chunk => {
5454
if (chunk) {

loaders/utils/getRequires.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const SIMPLE_STRING_REGEX = /^"([^"]+)"$|^'([^']+)'$/;
1717
* @returns {Array}
1818
*/
1919
module.exports = function getRequires(code) {
20-
let requires = {};
20+
const requires = {};
2121
code.replace(REQUIRE_ANYTHING_REGEX, function(requireExprMatch, requiredExpr) {
2222
const requireStrMatch = SIMPLE_STRING_REGEX.exec(requiredExpr.trim());
2323
if (!requireStrMatch) {

src/rsg-components/Preview/Preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default class Preview extends Component {
4141
error: null,
4242
});
4343

44-
let { code } = this.props;
44+
const { code } = this.props;
4545
if (!code) {
4646
return;
4747
}

src/rsg-components/Props/Props.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import PropsRenderer from './PropsRenderer';
88
import { unquote, getType } from './util';
99

1010
function render(propTypes, defaultProps = []) {
11-
let props = parse(`
11+
const props = parse(`
1212
import { Component, PropTypes } from 'react';
1313
export default class Cmpnt extends Component {
1414
static propTypes = {

src/rsg-components/Props/PropsRenderer.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import { unquote, getType, showSpaces } from './util';
77
import s from './Props.css';
88

99
function renderRows(props) {
10-
let rows = [];
11-
for (let name in props) {
12-
let prop = props[name];
10+
const rows = [];
11+
for (const name in props) {
12+
const prop = props[name];
1313
rows.push(
1414
<tr key={name}>
1515
<td className={s.cell}><Code className={s.name}>{name}</Code></td>
@@ -27,7 +27,7 @@ function renderType(type) {
2727
return 'unknown';
2828
}
2929

30-
let { name } = type;
30+
const { name } = type;
3131

3232
switch (name) {
3333
case 'arrayOf':
@@ -54,8 +54,8 @@ function renderDefault(prop) {
5454
}
5555

5656
function renderDescription(prop) {
57-
let { description } = prop;
58-
let extra = renderExtra(prop);
57+
const { description } = prop;
58+
const extra = renderExtra(prop);
5959
return (
6060
<Group>
6161
{description && <Markdown text={description} inline />}
@@ -115,11 +115,11 @@ function renderUnion(prop) {
115115
}
116116

117117
function renderShape(props) {
118-
let rows = [];
119-
for (let name in props) {
120-
let prop = props[name];
121-
let defaultValue = renderDefault(prop);
122-
let description = prop.description;
118+
const rows = [];
119+
for (const name in props) {
120+
const prop = props[name];
121+
const defaultValue = renderDefault(prop);
122+
const description = prop.description;
123123
rows.push(
124124
<div key={name}>
125125
<Code className={s.name}>{name}</Code>{': '}

src/utils/markdown-to-jsx.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,6 @@ function coalesceInlineHTML(ast) {
412412
}
413413

414414
export default function markdownToJSX(markdown, { overrides = {} } = {}) {
415-
let definitions;
416-
let footnotes;
417-
418415
function astToJSX(ast, index) { /* `this` is the dictionary of definitions */
419416
if (TEXT_AST_TYPES.indexOf(ast.type) !== -1) {
420417
return ast.value;
@@ -600,8 +597,8 @@ export default function markdownToJSX(markdown, { overrides = {} } = {}) {
600597

601598
const extracted = extractDefinitionsFromASTTree(remarkAST, astToJSX);
602599

603-
definitions = extracted.definitions;
604-
footnotes = extracted.footnotes;
600+
const definitions = extracted.definitions;
601+
const footnotes = extracted.footnotes;
605602

606603
coalesceInlineHTML(remarkAST);
607604

src/utils/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import isNaN from 'lodash/isNaN';
66
export function setComponentsNames(components) {
77
components.map((component) => {
88
// Try to detect component name or fallback to file name or directory name.
9-
let { module } = component;
9+
const { module } = component;
1010
component.name = (component.props && component.props.displayName) || (
1111
module.default
1212
? (module.default.displayName || module.default.name)
@@ -104,7 +104,7 @@ export function filterComponentsByExactName(componens, name) {
104104
* @return {Array}
105105
*/
106106
export function filterComponentsInSectionsByExactName(sections, name) {
107-
let components = [];
107+
const components = [];
108108
sections.forEach(section => {
109109
if (section.components) {
110110
components.push(...filterComponentsByExactName(section.components, name));

test/components/Button/Button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function Button({
88
size,
99
children,
1010
}) {
11-
let styles = {
11+
const styles = {
1212
color,
1313
fontSize: Button.sizes[size],
1414
};

test/components/Placeholder/Placeholder.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export default class Placeholder extends Component {
2121
};
2222

2323
getImageUrl() {
24-
let { type, width, height } = this.props;
25-
let types = {
24+
const { type, width, height } = this.props;
25+
const types = {
2626
animal: `http://placeimg.com/${width}/${height}/animals`,
2727
bacon: `http://baconmockup.com/${width}/${height}`,
2828
bear: `http://www.placebear.com/${width}/${height}`,
@@ -37,7 +37,7 @@ export default class Placeholder extends Component {
3737
}
3838

3939
render() {
40-
let { width, height } = this.props;
40+
const { width, height } = this.props;
4141
return (
4242
<img className={s.root} src={this.getImageUrl()} width={width} height={height} />
4343
);

test/loader.examples.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import test from 'ava';
22
import examplesLoader from '../loaders/examples.loader';
33

44
test('should return valid, parsable JS', t => {
5-
let exampleMarkdown = `
5+
const exampleMarkdown = `
66
# header
77
88
const _ = require('lodash');
@@ -14,7 +14,7 @@ text
1414
<span/>
1515
\`\`\`
1616
`;
17-
let result = examplesLoader.call({}, exampleMarkdown);
17+
const result = examplesLoader.call({}, exampleMarkdown);
1818
t.truthy(result);
1919
t.notThrows(() => new Function(result), SyntaxError); // eslint-disable-line no-new-func
2020
});

test/utils.utils.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ test.afterEach(() => {
5151
// setComponentsNames
5252

5353
test('should set name property to each component', t => {
54-
let result = utils.setComponentsNames([
54+
const result = utils.setComponentsNames([
5555
{
5656
module: {
5757
displayName: 'Foo',

0 commit comments

Comments
 (0)