Skip to content

Commit

Permalink
Fix Eslint and Prettier suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-cz committed Mar 24, 2021
1 parent e80ae84 commit 1c33a5c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/preact-iso/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Router.Provider = LocationProvider;
LocationProvider.ctx = createContext(/** @type {{ url: string, path: string, query: object, route }} */ ({}));
const RouteContext = createContext({});

export const Route = (props) => h(props.component, props);
export const Route = props => h(props.component, props);

export const useLocation = () => useContext(LocationProvider.ctx);
export const useRoute = () => useContext(RouteContext);
11 changes: 6 additions & 5 deletions packages/sw-plugin/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function swPlugin(options) {

const wmrProxyPlugin = {
resolveId(id) {
const normalizedId = (id[1] + id[2] === ':\\') ? pathToPosix(id.slice(2)) : id;
const normalizedId = id[1] + id[2] === ':\\' ? pathToPosix(id.slice(2)) : id;
if (id.startsWith('/@npm/')) return id;
if (!/^\.*\//.test(normalizedId)) return '/@npm/' + id;
},
Expand Down Expand Up @@ -69,10 +69,11 @@ export default function swPlugin(options) {
id = path.resolve(options.cwd, id.slice(4));

try {
var { rollup } = await import('rollup');
} catch (e) {
console.error((e = 'Error: Service Worker compilation requires that you install Rollup:\n npm i --save-dev rollup'));
return `export default null; throw ${JSON.stringify(e)};`;
var { rollup } = await import('rollup'); // eslint-disable-line no-var
} catch {
const error = 'Error: Service Worker compilation requires that you install Rollup:\n npm i --save-dev rollup';
console.error(error);
return `export default null; throw ${JSON.stringify(error)};`;
}

const bundle = await rollup({
Expand Down
2 changes: 1 addition & 1 deletion packages/wmr/src/lib/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function parseEnvFile(str) {
* Load additional environment variables from .env files.
* @param {string} cwd
* @param {string[]} envFiles
* @returns {Promise<Record<string, string>}>}
* @returns {Promise<Record<string, string>>}
*/
export async function readEnvFiles(cwd, envFiles) {
const envs = await Promise.all(
Expand Down

0 comments on commit 1c33a5c

Please sign in to comment.