Skip to content

Commit

Permalink
chore(config): integrate with EditorConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Yorsh committed Nov 5, 2018
1 parent 65cf7ef commit 4a14277
Show file tree
Hide file tree
Showing 15 changed files with 149 additions and 37 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
},
},
cacheDirectory: './dist/jest',
modulePathIgnorePatterns:[
modulePathIgnorePatterns: [
'<rootDir>/src/playground/'
],
};
};
12 changes: 9 additions & 3 deletions src/framework/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
export const description = '@rk-kit/theme';
import ThemeProvider from './primitives/themeProvider';
import {withTheme, WithThemeProps} from './primitives/themeConsumer';
import {
withTheme,
WithThemeProps,
} from './primitives/themeConsumer';

export {ThemeProvider, withTheme, WithThemeProps};
export {
ThemeProvider,
withTheme,
WithThemeProps,
};
4 changes: 2 additions & 2 deletions src/framework/theme/primitives/createContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';

const {Consumer, Provider} = React.createContext({});
const { Consumer, Provider } = React.createContext({});

export {Consumer, Provider};
export { Consumer, Provider };
2 changes: 1 addition & 1 deletion src/framework/theme/primitives/themeConsumer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {Consumer} from './createContext';
import { Consumer } from './createContext';

export interface WithThemeProps {
theme: Object;
Expand Down
6 changes: 2 additions & 4 deletions src/framework/theme/primitives/themeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import {Provider} from './createContext';
import { Provider } from './createContext';

interface PropsType {
children: JSX.Element;
theme: Object;
}

class ThemeProvider extends React.PureComponent<PropsType> {
export default class ThemeProvider extends React.PureComponent<PropsType> {

static defaultProps = {
theme: {},
Expand All @@ -20,5 +20,3 @@ class ThemeProvider extends React.PureComponent<PropsType> {
);
}
}

export default ThemeProvider;
13 changes: 8 additions & 5 deletions src/framework/theme/theme.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import * as React from 'react';
import {View} from 'react-native';
import {render} from 'react-native-testing-library';
import {ThemeProvider, withTheme, WithThemeProps} from './index';
import React from 'react';
import { View } from 'react-native';
import { render } from 'react-native-testing-library';
import {
ThemeProvider,
withTheme,
WithThemeProps,
} from './index';

interface TestProps extends WithThemeProps {
testId: string;
}

class TestComponent extends React.Component<TestProps> {
render() {
console.info(`TestComponent theme prop: ${JSON.stringify(this.props.theme)}`);
return (
<View testID={this.props.testId}/>
);
Expand Down
10 changes: 7 additions & 3 deletions src/framework/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
"es2016"
],
"paths": {
"@rk-kit/theme": ["./theme"],
"@rk-kit/ui": ["./ui"]
"@rk-kit/theme": [
"./theme"
],
"@rk-kit/ui": [
"./ui"
]
}
},
"typeRoots": [
"../../node_modules/@types"
]
}
}
2 changes: 1 addition & 1 deletion src/framework/ui/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {Sample} from './sample/sample.component';
export { Sample } from './sample/sample.component';
4 changes: 2 additions & 2 deletions src/framework/ui/sample/sample.component.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import {render} from 'react-native-testing-library';
import {Sample} from './sample.component';
import { render } from 'react-native-testing-library';
import { Sample } from './sample.component';

it('Checks Sample component passes correct text props', async () => {
const text = 'Hello, World!';
Expand Down
3 changes: 2 additions & 1 deletion src/playground/App.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import App from './src/App.component';
export default App;

export default App;
2 changes: 1 addition & 1 deletion src/playground/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function(api) {
module.exports = function (api) {
api.cache(true);
return {
presets: [
Expand Down
105 changes: 95 additions & 10 deletions src/playground/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/playground/src/App.component.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {Sample} from '@rk-kit/ui';
import { Sample } from '@rk-kit/ui';

export default class App extends React.Component {
render() {
Expand Down
4 changes: 3 additions & 1 deletion src/playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"es2016"
],
"paths": {
"@rk-kit/*": ["../framework/*"]
"@rk-kit/*": [
"../framework/*"
]
}
},
"typeRoots": [
Expand Down

0 comments on commit 4a14277

Please sign in to comment.