Skip to content

Commit

Permalink
chore: lint project and update linting run scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
pmmmwh committed Dec 12, 2019
1 parent 4e831c4 commit 70a3f55
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
6 changes: 1 addition & 5 deletions examples/cra-kitchen-sink/config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
const ReactRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const {
addBabelPlugin,
addWebpackPlugin,
override,
} = require('customize-cra');
const { addBabelPlugin, addWebpackPlugin, override } = require('customize-cra');

module.exports = override(
addBabelPlugin(require.resolve('react-refresh/babel')),
Expand Down
10 changes: 3 additions & 7 deletions examples/cra-kitchen-sink/src/serviceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}$/)
);

export function register(config) {
Expand Down Expand Up @@ -101,7 +99,7 @@ function registerValidSW(swUrl, config) {
function checkValidServiceWorker(swUrl, 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.
Expand All @@ -122,9 +120,7 @@ function checkValidServiceWorker(swUrl, 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.');
});
}

Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@
"src"
],
"scripts": {
"lint": "prettier --check \"**/*.{js,jsx,json,md}\"",
"lint:fix": "prettier --write \"**/*.{js,jsx,json,md}\""
"lint": "yarn run lint:eslint && yarn run lint:prettier",
"lint:fix": "yarn run lint:eslint:fix && yarn run lint:prettier:fix",
"lint:eslint": "eslint --report-unused-disable-directives \"**/*.js\"",
"lint:eslint:fix": "yarn run lint:eslint --fix",
"lint:prettier": "prettier --check \"**/*.{js,jsx,json,md}\"",
"lint:prettier:fix": "prettier --write \"**/*.{js,jsx,json,md}\""
},
"dependencies": {
"ansi-html": "^0.0.7",
Expand Down

0 comments on commit 70a3f55

Please sign in to comment.