Skip to content

Commit 2f150cb

Browse files
committed
update
1 parent fc70d07 commit 2f150cb

File tree

6 files changed

+195
-32
lines changed

6 files changed

+195
-32
lines changed

.eslintignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# service-center/src/views/ServiceAgreement.vue
2+
# service-landing/src/views/ServiceAgreement.vue
3+
# service-landing/src/views/RealName.vue
4+
*.test.js
5+
src/page/echartBox/index.js
6+
src/page/heightEchart/index.js
7+
src/page/chinaMap/index.js
8+
src/page/useCallBack/index.js
9+
src/serviceWorker.js

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
extends: "airbnb",
2+
extends: ["airbnb", "plugin:prettier/recommended"],
33
rules: {
44
"react/jsx-filename-extension": "off",
55
"react/forbid-prop-types": "off",
@@ -14,5 +14,5 @@ module.exports = {
1414
},
1515
env: {
1616
browser: true
17-
},
17+
}
1818
};

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"husky": {
1818
"hooks": {
19-
"pre-commit": "npm run lint"
19+
"pre-commit": "npm run lint && pretty-quick --staged"
2020
}
2121
},
2222
"eslintConfig": {
@@ -41,6 +41,9 @@
4141
"eslint-plugin-import": "^2.18.2",
4242
"eslint-plugin-jsx-a11y": "^6.2.3",
4343
"eslint-plugin-react": "^7.14.3",
44-
"eslint-plugin-react-hooks": "^1.7.0"
44+
"eslint-plugin-react-hooks": "^1.7.0",
45+
"prettier": "1.19.1",
46+
"pretty-quick": "^2.0.1",
47+
"eslint-plugin-prettier": "^3.1.1"
4548
}
4649
}

src/App.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
import React from "react";
2-
import logo from "./logo.svg";
3-
import "./App.css";
1+
import React from 'react';
2+
import logo from './logo.svg';
3+
import './App.css';
44

55
function App() {
66
return (
77
<div className="App">
88
<header className="App-header">
99
<img src={logo} className="App-logo" alt="logo" />
1010
<p>
11-
Edit <code>src/App.js</code> and save to reload.
11+
Edit
12+
{' '}
13+
<code>src/App.js</code>
14+
{' '}
15+
and save to reload.
1216
</p>
1317
{/* <a
1418
className="App-link"

src/serviceWorker.js

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@
1111
// opt-in, read https://bit.ly/CRA-PWA
1212

1313
const isLocalhost = Boolean(
14-
window.location.hostname === 'localhost' ||
14+
window.location.hostname === "localhost" ||
1515
// [::1] is the IPv6 localhost address.
16-
window.location.hostname === '[::1]' ||
16+
window.location.hostname === "[::1]" ||
1717
// 127.0.0.1/8 is considered localhost for IPv4.
18-
window.location.hostname.match(
19-
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
20-
)
18+
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
2119
);
2220

2321
export function register(config) {
24-
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
22+
if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) {
2523
// The URL constructor is available in all browsers that support SW.
2624
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
2725
if (publicUrl.origin !== window.location.origin) {
@@ -31,7 +29,7 @@ export function register(config) {
3129
return;
3230
}
3331

34-
window.addEventListener('load', () => {
32+
window.addEventListener("load", () => {
3533
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
3634

3735
if (isLocalhost) {
@@ -42,8 +40,8 @@ export function register(config) {
4240
// service worker/PWA documentation.
4341
navigator.serviceWorker.ready.then(() => {
4442
console.log(
45-
'This web app is being served cache-first by a service ' +
46-
'worker. To learn more, visit https://bit.ly/CRA-PWA'
43+
"This web app is being served cache-first by a service " +
44+
"worker. To learn more, visit https://bit.ly/CRA-PWA"
4745
);
4846
});
4947
} else {
@@ -64,14 +62,14 @@ function registerValidSW(swUrl, config) {
6462
return;
6563
}
6664
installingWorker.onstatechange = () => {
67-
if (installingWorker.state === 'installed') {
65+
if (installingWorker.state === "installed") {
6866
if (navigator.serviceWorker.controller) {
6967
// At this point, the updated precached content has been fetched,
7068
// but the previous service worker will still serve the older
7169
// content until all client tabs are closed.
7270
console.log(
73-
'New content is available and will be used when all ' +
74-
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
71+
"New content is available and will be used when all " +
72+
"tabs for this page are closed. See https://bit.ly/CRA-PWA."
7573
);
7674

7775
// Execute callback
@@ -82,7 +80,7 @@ function registerValidSW(swUrl, config) {
8280
// At this point, everything has been precached.
8381
// It's the perfect time to display a
8482
// "Content is cached for offline use." message.
85-
console.log('Content is cached for offline use.');
83+
console.log("Content is cached for offline use.");
8684

8785
// Execute callback
8886
if (config && config.onSuccess) {
@@ -94,7 +92,7 @@ function registerValidSW(swUrl, config) {
9492
};
9593
})
9694
.catch(error => {
97-
console.error('Error during service worker registration:', error);
95+
console.error("Error during service worker registration:", error);
9896
});
9997
}
10098

@@ -103,11 +101,8 @@ function checkValidServiceWorker(swUrl, config) {
103101
fetch(swUrl)
104102
.then(response => {
105103
// Ensure service worker exists, and that we really are getting a JS file.
106-
const contentType = response.headers.get('content-type');
107-
if (
108-
response.status === 404 ||
109-
(contentType != null && contentType.indexOf('javascript') === -1)
110-
) {
104+
const contentType = response.headers.get("content-type");
105+
if (response.status === 404 || (contentType != null && contentType.indexOf("javascript") === -1)) {
111106
// No service worker found. Probably a different app. Reload the page.
112107
navigator.serviceWorker.ready.then(registration => {
113108
registration.unregister().then(() => {
@@ -120,14 +115,12 @@ function checkValidServiceWorker(swUrl, config) {
120115
}
121116
})
122117
.catch(() => {
123-
console.log(
124-
'No internet connection found. App is running in offline mode.'
125-
);
118+
console.log("No internet connection found. App is running in offline mode.");
126119
});
127120
}
128121

129122
export function unregister() {
130-
if ('serviceWorker' in navigator) {
123+
if ("serviceWorker" in navigator) {
131124
navigator.serviceWorker.ready.then(registration => {
132125
registration.unregister();
133126
});

0 commit comments

Comments
 (0)