mirror of
https://github.com/zhigang1992/connect.git
synced 2026-04-26 14:15:47 +08:00
ci: use top-level lint command
This commit is contained in:
2
.github/workflows/codecheck.yml
vendored
2
.github/workflows/codecheck.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
- name: Lerna Bootstrap
|
||||
run: yarn lerna bootstrap
|
||||
- name: Lint
|
||||
run: yarn lerna run lint --parallel
|
||||
run: yarn lint
|
||||
- name: Depcheck
|
||||
run: yarn lerna run depcheck --parallel
|
||||
- name: Typecheck
|
||||
|
||||
2
.prettierignore
Normal file
2
.prettierignore
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
*.d.ts
|
||||
@@ -1 +1 @@
|
||||
module.exports = {extends: ['@commitlint/config-conventional']}
|
||||
module.exports = { extends: ['@commitlint/config-conventional'] };
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
"build:ui": "lerna run build --scope @blockstack/ui",
|
||||
"build:keychain": "lerna run build --scope @blockstack/keychain",
|
||||
"build:connect": "lerna run build --scope @blockstack/connect",
|
||||
"lint": "yarn lint:eslint && yarn lint:prettier",
|
||||
"lint:eslint": "eslint --ext .ts,.tsx . -f unix",
|
||||
"lint:fix": "eslint --ext .ts,.tsx . -f unix --fix && prettier --write **/*.{ts,tsx} *.js",
|
||||
"lint:prettier": "prettier --check **/*.{ts,tsx} *.js"
|
||||
|
||||
@@ -15,9 +15,7 @@ const isLocalhost = Boolean(
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
// 127.0.0.0/8 are considered localhost for IPv4.
|
||||
window.location.hostname.match(
|
||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||
)
|
||||
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
|
||||
);
|
||||
|
||||
type Config = {
|
||||
@@ -28,10 +26,7 @@ type Config = {
|
||||
export function register(config?: Config) {
|
||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||
// The URL constructor is available in all browsers that support SW.
|
||||
const publicUrl = new URL(
|
||||
process.env.PUBLIC_URL,
|
||||
window.location.href
|
||||
);
|
||||
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
|
||||
if (publicUrl.origin !== window.location.origin) {
|
||||
// Our service worker won't work if PUBLIC_URL is on a different origin
|
||||
// from what our page is served on. This might happen if a CDN is used to
|
||||
@@ -109,15 +104,12 @@ function registerValidSW(swUrl: string, config?: Config) {
|
||||
function checkValidServiceWorker(swUrl: string, config?: Config) {
|
||||
// Check if the service worker can be found. If it can't reload the page.
|
||||
fetch(swUrl, {
|
||||
headers: { 'Service-Worker': 'script' }
|
||||
headers: { 'Service-Worker': 'script' },
|
||||
})
|
||||
.then(response => {
|
||||
// Ensure service worker exists, and that we really are getting a JS file.
|
||||
const contentType = response.headers.get('content-type');
|
||||
if (
|
||||
response.status === 404 ||
|
||||
(contentType != null && contentType.indexOf('javascript') === -1)
|
||||
) {
|
||||
if (response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1)) {
|
||||
// No service worker found. Probably a different app. Reload the page.
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister().then(() => {
|
||||
@@ -130,9 +122,7 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
console.log(
|
||||
'No internet connection found. App is running in offline mode.'
|
||||
);
|
||||
console.log('No internet connection found. App is running in offline mode.');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user