Skip to content

Commit f9a5871

Browse files
authored
Configure module-resolver plugin (#1246)
* Configure module-resolver plugin * Fix import path in TextField tests file * move module-resolver config to inner babelrc file
1 parent da14611 commit f9a5871

File tree

6 files changed

+22
-31
lines changed

6 files changed

+22
-31
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"@typescript-eslint/parser": "^2.13.0",
8181
"@welldone-software/why-did-you-render": "^3.2.1",
8282
"babel-jest": "^25.2.4",
83+
"babel-plugin-module-resolver": "^4.1.0",
8384
"babel-plugin-typescript-to-proptypes": "^1.3.2",
8485
"babel-preset-react-native": "*",
8586
"eslint": "^5.16.0",

src/.babelrc.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
{
22
"presets": ["@babel/preset-typescript" /* , "@babel/preset-react" */],
3-
"plugins": [["babel-plugin-typescript-to-proptypes", {"comments": true}]],
3+
"plugins": [
4+
["babel-plugin-typescript-to-proptypes", {"comments": true}],
5+
[
6+
"module-resolver",
7+
{
8+
"root": ["./src"],
9+
"alias": {
10+
"style": "./src/style",
11+
"helpers": "./src/helpers"
12+
}
13+
}
14+
]
15+
],
416
"compact": false,
517
"minified": false
618
}

src/components/button/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import _ from 'lodash';
22
import React, {PureComponent} from 'react';
33
import {Platform, StyleSheet, LayoutAnimation, LayoutChangeEvent, ImageStyle} from 'react-native';
44
import {asBaseComponent, forwardRef} from '../../commons/new';
5-
import {Constants} from '../../helpers';
6-
import {Colors, Typography, BorderRadiuses} from '../../style';
5+
import {Constants} from 'helpers';
6+
import {Colors, Typography, BorderRadiuses} from 'style';
77
import {extractColorValue, extractTypographyValue} from '../../commons/modifiers';
88
import TouchableOpacity from '../touchableOpacity';
99
import Text from '../text';

src/components/textField/__tests__/index.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import TextField from '..';
1+
import TextField from '../index';
22
import {Colors} from '../../../style';
33

44
describe('TextField', () => {
5-
// beforeEach(() => {});
65

76
describe('shouldFakePlaceholder', () => {
87
it('should shouldFakePlaceholder', () => {

tsconfig.dev.json

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
11
{
2-
"compilerOptions": {
3-
"target": "ESNext",
4-
"module": "ESNext",
5-
// "outDir": "dist",
6-
"esModuleInterop": true,
7-
"moduleResolution": "node",
8-
"jsx": "react-native",
9-
"skipLibCheck": true,
10-
// "resolveJsonModule": true,
11-
"strict": true,
12-
"noUnusedLocals": true,
13-
"noUnusedParameters": true,
14-
// "noEmit": true,
15-
// "checkJs": true,
16-
"allowJs": false,
17-
"emitDeclarationOnly": true,
18-
// "noImplicitAny": false
19-
"declaration": true,
20-
"declarationDir": "./generatedTypes",
21-
"baseUrl": ".",
22-
"paths": {
23-
"react-native-ui-lib": ["index.d.ts"]
24-
}
25-
},
2+
"extends": "./tsconfig",
263
"include": ["src/**/*", "typings/**/*"],
27-
"exclude": [ "node_modules", "src/index.ts"]
4+
"exclude": ["node_modules", "src/index.ts"]
285
}

tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
"declarationDir": "./generatedTypes",
2121
"baseUrl": ".",
2222
"paths": {
23-
"react-native-ui-lib": ["index.d.ts"]
23+
"react-native-ui-lib": ["index.d.ts"],
24+
"style": ["./src/style"],
25+
"helpers": ["./src/helpers"],
2426
}
2527
},
2628
"include": ["src/**/*", "typings/**/*", "demo/**/*"],

0 commit comments

Comments
 (0)