Skip to content

Configure module-resolver plugin #1246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"@typescript-eslint/parser": "^2.13.0",
"@welldone-software/why-did-you-render": "^3.2.1",
"babel-jest": "^25.2.4",
"babel-plugin-module-resolver": "^4.1.0",
"babel-plugin-typescript-to-proptypes": "^1.3.2",
"babel-preset-react-native": "*",
"eslint": "^5.16.0",
Expand Down
14 changes: 13 additions & 1 deletion src/.babelrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"presets": ["@babel/preset-typescript" /* , "@babel/preset-react" */],
"plugins": [["babel-plugin-typescript-to-proptypes", {"comments": true}]],
"plugins": [
["babel-plugin-typescript-to-proptypes", {"comments": true}],
[
"module-resolver",
{
"root": ["./src"],
"alias": {
"style": "./src/style",
"helpers": "./src/helpers"
}
}
]
],
"compact": false,
"minified": false
}
4 changes: 2 additions & 2 deletions src/components/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import _ from 'lodash';
import React, {PureComponent} from 'react';
import {Platform, StyleSheet, LayoutAnimation, LayoutChangeEvent, ImageStyle} from 'react-native';
import {asBaseComponent, forwardRef} from '../../commons/new';
import {Constants} from '../../helpers';
import {Colors, Typography, BorderRadiuses} from '../../style';
import {Constants} from 'helpers';
import {Colors, Typography, BorderRadiuses} from 'style';
import {extractColorValue, extractTypographyValue} from '../../commons/modifiers';
import TouchableOpacity from '../touchableOpacity';
import Text from '../text';
Expand Down
3 changes: 1 addition & 2 deletions src/components/textField/__tests__/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import TextField from '..';
import TextField from '../index';
import {Colors} from '../../../style';

describe('TextField', () => {
// beforeEach(() => {});

describe('shouldFakePlaceholder', () => {
it('should shouldFakePlaceholder', () => {
Expand Down
27 changes: 2 additions & 25 deletions tsconfig.dev.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
{
"compilerOptions": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need the compilerOptoins anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope,
You can see that I now extends our base tsconfig.json file that already contains the relevant compilerOptions
"extends": "./tsconfig",

"target": "ESNext",
"module": "ESNext",
// "outDir": "dist",
"esModuleInterop": true,
"moduleResolution": "node",
"jsx": "react-native",
"skipLibCheck": true,
// "resolveJsonModule": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
// "noEmit": true,
// "checkJs": true,
"allowJs": false,
"emitDeclarationOnly": true,
// "noImplicitAny": false
"declaration": true,
"declarationDir": "./generatedTypes",
"baseUrl": ".",
"paths": {
"react-native-ui-lib": ["index.d.ts"]
}
},
"extends": "./tsconfig",
"include": ["src/**/*", "typings/**/*"],
"exclude": [ "node_modules", "src/index.ts"]
"exclude": ["node_modules", "src/index.ts"]
}
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"declarationDir": "./generatedTypes",
"baseUrl": ".",
"paths": {
"react-native-ui-lib": ["index.d.ts"]
"react-native-ui-lib": ["index.d.ts"],
"style": ["./src/style"],
"helpers": ["./src/helpers"],
}
},
"include": ["src/**/*", "typings/**/*", "demo/**/*"],
Expand Down