Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75ee515

Browse files
committed
eslint fixes for unresolved module(imports)
1 parent 1e80f3e commit 75ee515

File tree

4 files changed

+30
-21
lines changed

4 files changed

+30
-21
lines changed

.eslintrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ module.exports = {
77
'plugin:react/recommended',
88
'airbnb',
99
],
10+
settings: {
11+
"import/resolver": {
12+
node: {
13+
extensions: ['.js', '.jsx', '.scss', '.css'],
14+
moduleDirectory: ['node_modules', 'src/'],
15+
},
16+
},
17+
},
1018
globals: {
1119
Atomics: 'readonly',
1220
SharedArrayBuffer: 'readonly',

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"build": "npm run build:css && webpack ---config ./config/webpack.prod.config.js",
88
"dev": "npm run watch:css && webpack-dev-server --config ./config/webpack.dev.config.js --open",
99
"lint": "./node_modules/.bin/eslint --ext .js,.jsx src/",
10-
"build:css": "postcss src/assets/css/styles.css -o src/assets/css/main.css",
10+
"lint: fix": "./node_modules/.bin/eslint --ext .js,.jsx src/ --fix",
11+
"build:css": "postcss src/assets/css/styles.css -o src/assets/css/main.css",
1112
"watch:css": "postcss src/assets/css/styles.css -o src/assets/css/main.css",
1213
"test": "jest --collect-coverage",
1314
"test:watch": "jest --watch"
@@ -30,6 +31,7 @@
3031
"autoprefixer": "^9.7.6",
3132
"babel-loader": "^8.1.0",
3233
"postcss-cli": "^7.1.0",
34+
"prop-types": "^15.7.2",
3335
"react": "^16.13.1",
3436
"react-dom": "^16.13.1",
3537
"tailwindcss": "^1.3.4",

src/app.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import React from 'react';
2-
import logo from './logo.png';
32
import Button from 'uielements/button/button.component';
3+
import logo from './logo.png';
44
import 'assets/css/main.css';
55
import './app.scss';
66

7-
87
export default function App() {
98
return (
109
<div className="bg-blue-900 flex flex-col justify-center items-center p-20">
11-
<p className="text-4xl text-blue-100">Welcom To React Boilerplate!</p>
12-
<img src={logo} className="app--image" />
13-
<Button buttonText="Get Started!" />
10+
<p className="text-4xl text-blue-100">Welcom To React Boilerplate!</p>
11+
<img src={logo} className="app--image" alt="logo" />
12+
<Button buttonText="Get Started!" />
1413
</div>
1514
);
1615
}
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
3+
44
function Button(props) {
5-
const { buttonText, primary } = props;
6-
let btnClass = '';
5+
const { buttonText, primary } = props;
6+
let btnClass = '';
77

8-
if (primary) {
9-
btnClass = "bg-transparent hover:bg-blue-500 text-indigo-100 font-semibold hover:text-white py-2 px-4 border border-indigo-100 hover:border-transparent rounded";
10-
}
11-
return (
12-
<button className={`${btnClass}`}>
13-
{buttonText}
14-
</button>
15-
)
8+
if (primary) {
9+
btnClass = 'bg-transparent hover:bg-blue-500 text-indigo-100 font-semibold hover:text-white py-2 px-4 border border-indigo-100 hover:border-transparent rounded';
10+
}
11+
return (
12+
<button type="button" className={`${btnClass}`}>
13+
{buttonText}
14+
</button>
15+
);
1616
}
1717

1818
Button.propTypes = {
19-
buttonText: PropTypes.string.isRequired,
20-
primary: PropTypes.bool,
19+
buttonText: PropTypes.string.isRequired,
20+
primary: PropTypes.bool,
2121
};
2222

2323
Button.defaultProps = {
24-
primary: true,
24+
primary: true,
2525
};
2626

2727

28-
export default Button;
28+
export default Button;

0 commit comments

Comments
 (0)