Skip to content

Commit b010ab7

Browse files
authored
Switched to tslint:recommended and fixed resulting conflicts and improved examples within the readme file (#29)
* Fixed example code * Enabled tslind recommended, refactored map, removed equals by using Array.includes, added .editorconfig, added prettier config, added vscode launch config and improved examples within the readme
1 parent 2835b15 commit b010ab7

File tree

84 files changed

+398
-387
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+398
-387
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
max_line_length = 80
10+
trim_trailing_whitespace = true
11+
12+
[*.md]
13+
max_line_length = 0
14+
trim_trailing_whitespace = false

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ node_modules/
66
# Editors & OS
77
.DS_Store
88
.idea/
9-
.vscode/
109

1110
# Logs
1211
*.log
@@ -19,4 +18,4 @@ junit.xml
1918
# Output
2019
*.js
2120
*.js.map
22-
*.d.ts
21+
*.d.ts

.prettierrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"trailingComma": "all",
8+
"bracketSpacing": false,
9+
"jsxBracketSameLine": false,
10+
"arrowParens": "always"
11+
}

.vscode/launch.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Jest Current File",
11+
"args": [
12+
"--inspect-brk",
13+
"${workspaceRoot}/node_modules/jest/bin/jest.js",
14+
"--runInBand",
15+
"--config",
16+
"\"${workspaceRoot}/jest.config.json\"",
17+
"${relativeFile}"
18+
],
19+
"protocol": "inspector",
20+
"console": "integratedTerminal",
21+
"internalConsoleOptions": "neverOpen"
22+
}
23+
]
24+
}

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ _React Rasta_ depends on the following packages which need to be installed manua
4242
### Code Examples
4343

4444
```tsx
45-
import { Component } from "react";
46-
import { Column, Container, Row } from "react-rasta";
45+
import React, {Component} from "react";
46+
import {Column, Container, Row} from "react-rasta";
4747

4848
export default class App extends Component {
4949
render() {
5050
return (
5151
<Container>
5252
<Row>
5353
<Column size={3}>Left</Column>
54-
<Column size={{ xs: 9, md: 3 }}>Middle 1</Column>
55-
<Column size={{ xs: 9, md: 3 }}>Middle 2</Column>
54+
<Column size={{xs: 9, md: 3}}>Middle 1</Column>
55+
<Column size={{xs: 9, md: 3}}>Middle 2</Column>
5656
<Column size={3}>Right</Column>
5757
</Row>
5858
</Container>
@@ -64,30 +64,30 @@ export default class App extends Component {
6464
Breakpoints (which will end up in media queries) could be redefined via `ThemeProvider`.
6565

6666
```tsx
67-
import { Component } from "react";
68-
import { Column, Container, Row, ThemeProvider } from "react-rasta";
67+
import React, {Component} from "react";
68+
import {Column, Container, Row, ThemeProvider} from "react-rasta";
6969

7070
const breakpoints = {
7171
phone: 0,
7272
tablet: 600,
73-
desktop: 800
73+
desktop: 800,
7474
};
7575

7676
const containerWidth = {
7777
// do not specify phone here
7878
tablet: 560,
79-
desktop: 760
79+
desktop: 760,
8080
};
8181

8282
export default class App extends Component {
8383
render() {
8484
return (
85-
<ThemeProvider theme={{ breakpoints, containerWidth }}>
85+
<ThemeProvider theme={{breakpoints, containerWidth}}>
8686
<Container>
8787
<Row>
8888
<Column size={3}>Left</Column>
89-
<Column size={{ phone: 9, tablet: 3 }}>Middle 1</Column>
90-
<Column size={{ phone: 9, tablet: 3 }}>Middle 2</Column>
89+
<Column size={{phone: 9, tablet: 3}}>Middle 1</Column>
90+
<Column size={{phone: 9, tablet: 3}}>Middle 2</Column>
9191
<Column size={3}>Right</Column>
9292
</Row>
9393
</Container>

src/__utils__/Story.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import styled from "styled-components";
2-
import StoryProperties from "./StoryProperties";
32
import Column from "../column";
43
import Container from "../container";
54
import Row from "../row";
5+
import StoryProperties from "./StoryProperties";
66

77
const Story = styled.div`
88
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,

src/break/Break.story.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import {action} from "@storybook/addon-actions";
2+
import {storiesOf} from "@storybook/react";
13
import React from "react";
2-
import { storiesOf } from "@storybook/react";
3-
import { action } from "@storybook/addon-actions";
44
import Story from "../__utils__/Story";
55
import Title from "../__utils__/Title";
66

7-
import { Break, Column, Container, Row } from "..";
7+
import {Break, Column, Container, Row} from "..";
88

99
storiesOf("Break", module).add("break", () => (
1010
<Story>

src/break/Break.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import {shallow} from "enzyme";
12
import "jest-styled-components";
2-
import { shallow } from "enzyme";
33
import React from "react";
44
import styled from "styled-components";
55
import Break from "./Break";

src/break/Break.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import {ClassAttributes, HTMLAttributes} from "react";
2+
import {StyledComponentClass} from "styled-components";
3+
import {styled, Theme} from "../theme";
14
import "../utils/bootstrap";
2-
import { ClassAttributes, HTMLAttributes } from "react";
3-
import { StyledComponentClass } from "styled-components";
4-
import { styled, Theme } from "../theme";
55

66
const Break = styled.div`
77
width: 100%;

src/column/Column.test.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import {shallow} from "enzyme";
12
import "jest-styled-components";
2-
import { shallow } from "enzyme";
33
import React from "react";
44
import styled from "styled-components";
55
import Column from "./Column";
@@ -24,7 +24,7 @@ describe("<Column />", () => {
2424
it("should match the snapshot (alignSelf: { xs: 'baseline', sm: 'center', md: 'flex-end' })", () => {
2525
// act
2626
const result = shallow(
27-
<Column alignSelf={{ xs: "baseline", sm: "center", md: "flex-end" }} />
27+
<Column alignSelf={{xs: "baseline", sm: "center", md: "flex-end"}} />,
2828
);
2929

3030
// assert
@@ -44,7 +44,7 @@ describe("<Column />", () => {
4444

4545
it("should match the snapshot (offset: { xs: 3, sm: 4, md: 8 }) ", () => {
4646
// act
47-
const result = shallow(<Column offset={{ xs: 3, sm: 4, md: 8 }} />);
47+
const result = shallow(<Column offset={{xs: 3, sm: 4, md: 8}} />);
4848

4949
// assert
5050
expect(result).toMatchSnapshot();
@@ -60,9 +60,7 @@ describe("<Column />", () => {
6060

6161
it("should match the snapshot (order: { xs: 'first', sm: 3, md: 'last' }) ", () => {
6262
// act
63-
const result = shallow(
64-
<Column order={{ xs: "first", sm: 3, md: "last" }} />
65-
);
63+
const result = shallow(<Column order={{xs: "first", sm: 3, md: "last"}} />);
6664

6765
// assert
6866
expect(result).toMatchSnapshot();
@@ -78,7 +76,7 @@ describe("<Column />", () => {
7876

7977
it("should match the snapshot (size: { xs: 'auto', sm: 7, md: 'none' }) ", () => {
8078
// act
81-
const result = shallow(<Column size={{ xs: "auto", sm: 7, md: "none" }} />);
79+
const result = shallow(<Column size={{xs: "auto", sm: 7, md: "none"}} />);
8280

8381
// assert
8482
expect(result).toMatchSnapshot();
@@ -92,7 +90,12 @@ describe("<Column />", () => {
9290

9391
// act
9492
const result = shallow(
95-
<Column alignSelf={"stretch"} offset={offset} order={order} size={size} />
93+
<Column
94+
alignSelf={"stretch"}
95+
offset={offset}
96+
order={order}
97+
size={size}
98+
/>,
9699
);
97100

98101
// assert

0 commit comments

Comments
 (0)