From db751a1d9eca913e52fe2ff21c70e27ed281fe02 Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Sun, 20 Dec 2020 16:09:36 +0530 Subject: [PATCH] Debloat and add eslintrc --- .eslintrc.js | 44 ++++++++++++++++++++++++++++++++++++++++++ src/App.js | 39 ++++++++++++++++++------------------- src/App.test.js | 8 -------- src/index.js | 22 ++++++++------------- src/logo.svg | 1 - src/reportWebVitals.js | 13 ------------- src/setupTests.js | 5 ----- 7 files changed, 71 insertions(+), 61 deletions(-) create mode 100644 .eslintrc.js delete mode 100644 src/App.test.js delete mode 100644 src/logo.svg delete mode 100644 src/reportWebVitals.js delete mode 100644 src/setupTests.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..a393912 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,44 @@ +module.exports = { + "env": { + "browser": true, + "es6": true + }, + "extends": ["eslint:recommended", "plugin:react/recommended"], + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "ecmaVersion": 2018, + "sourceType": "module" + }, + "plugins": [ + "react" + ], + "rules": { + "indent": [ + "error", + "tab" + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "double" + ], + "semi": [ + "error", + "always" + ] + }, + "settings": { + "react": { + "version": "detect" + } + } +}; diff --git a/src/App.js b/src/App.js index 3784575..ff4c275 100644 --- a/src/App.js +++ b/src/App.js @@ -1,25 +1,24 @@ -import logo from './logo.svg'; -import './App.css'; +import React from "React"; +import "./App.css"; function App() { - return ( -
-
- logo -

- Edit src/App.js and save to reload. -

- - Learn React - -
-
- ); + return ( +
+
+

+ Edit src/App.js and save to reload. +

+ + Learn React + +
+
+ ); } export default App; diff --git a/src/App.test.js b/src/App.test.js deleted file mode 100644 index 1f03afe..0000000 --- a/src/App.test.js +++ /dev/null @@ -1,8 +0,0 @@ -import { render, screen } from '@testing-library/react'; -import App from './App'; - -test('renders learn react link', () => { - render(); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); -}); diff --git a/src/index.js b/src/index.js index ef2edf8..e0ba05f 100644 --- a/src/index.js +++ b/src/index.js @@ -1,17 +1,11 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import './index.css'; -import App from './App'; -import reportWebVitals from './reportWebVitals'; +import React from "react"; +import ReactDOM from "react-dom"; +import "./index.css"; +import App from "./App"; ReactDOM.render( - - - , - document.getElementById('root') + + + , + document.getElementById("root") ); - -// If you want to start measuring performance in your app, pass a function -// to log results (for example: reportWebVitals(console.log)) -// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); diff --git a/src/logo.svg b/src/logo.svg deleted file mode 100644 index 9dfc1c0..0000000 --- a/src/logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/reportWebVitals.js b/src/reportWebVitals.js deleted file mode 100644 index 5253d3a..0000000 --- a/src/reportWebVitals.js +++ /dev/null @@ -1,13 +0,0 @@ -const reportWebVitals = onPerfEntry => { - if (onPerfEntry && onPerfEntry instanceof Function) { - import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - }); - } -}; - -export default reportWebVitals; diff --git a/src/setupTests.js b/src/setupTests.js deleted file mode 100644 index 8f2609b..0000000 --- a/src/setupTests.js +++ /dev/null @@ -1,5 +0,0 @@ -// jest-dom adds custom jest matchers for asserting on DOM nodes. -// allows you to do things like: -// expect(element).toHaveTextContent(/react/i) -// learn more: https://github.com/testing-library/jest-dom -import '@testing-library/jest-dom';