Skip to content

Commit

Permalink
refactor(eslint): integrated feedback (pattern-lab#1304)
Browse files Browse the repository at this point in the history
* refactor(eslint): integrated feedback

out of auto-fixable stuff

* refactor(eslint): integrated feedback

most likely out of beautification
  • Loading branch information
mfranzke authored Mar 23, 2021
1 parent 04223e7 commit f36d967
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ const defaultOptions = {
* @returns {Function} Koa compatible middleware
*/
const webpackDevServerWaitpage = (server, options) => {
if (!server)
if (!server) {
throw new Error(
`webpack-dev-server's compilers argument must be supplied as first parameter.`
);
}

/** @type {WebpackDevServerWaitpageOptions} */
options = Object.assign({}, defaultOptions, options);
Expand All @@ -55,8 +56,9 @@ const webpackDevServerWaitpage = (server, options) => {
.filter(x => x.endsWith('.ejs'))
.map(x => x.slice(0, -4))
.indexOf(options.theme) < 0
)
) {
throw new Error(`Unknown theme provided: ${options.theme}`);
}
template = fs.readFileSync(
path.resolve(__dirname, options.theme + '.ejs'),
'utf8'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { dashCase, empty, keys } from 'skatejs/dist/esnext/util';

var _extends =
const _extends =
Object.assign ||
function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
for (let i = 1; i < arguments.length; i++) {
const source = arguments[i];
for (const key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
Expand Down Expand Up @@ -50,12 +50,18 @@ export function normalizePropertyDefinition(name, prop) {
const defaultTypesMap = new Map();

function defineProps(constructor) {
if (constructor.hasOwnProperty('_propsNormalized')) return;
if (constructor.hasOwnProperty('_propsNormalized')) {
return;
}
const { props } = constructor;
keys(props).forEach(name => {
let func = props[name] || props.any;
if (defaultTypesMap.has(func)) func = defaultTypesMap.get(func);
if (typeof func !== 'function') func = prop(func);
if (defaultTypesMap.has(func)) {
func = defaultTypesMap.get(func);
}
if (typeof func !== 'function') {
func = prop(func);
}
func({ constructor }, name);
});
}
Expand Down Expand Up @@ -130,7 +136,7 @@ export function prop(definition) {

export class SkateElement extends HTMLElement {
constructor(...args) {
var _temp;
let _temp;
return (
(_temp = super(...args)),
(this._prevProps = {}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var _extends =
const _extends =
Object.assign ||
function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
for (let i = 1; i < arguments.length; i++) {
const source = arguments[i];
for (const key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
Expand All @@ -24,7 +24,7 @@ const preactNodeName = '__preactNodeName';
let oldVnode;

function newVnode(vnode) {
let fn = vnode.nodeName;
const fn = vnode.nodeName;
if (fn && fn.prototype instanceof HTMLElement) {
if (!fn[preactNodeName]) {
const prefix = fn.name;
Expand Down
4 changes: 3 additions & 1 deletion packages/uikit-workshop/src/scripts/components/panels.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ function init(event) {
Panels.add({
id: 'pl-panel-html',
name: 'HTML',
default: window.config.defaultPatternInfoPanelCode && window.config.defaultPatternInfoPanelCode === 'html',
default:
window.config.defaultPatternInfoPanelCode &&
window.config.defaultPatternInfoPanelCode === 'html',
templateID: 'pl-panel-template-code',
httpRequest: true,
httpRequestReplace: fileSuffixMarkup + '.html',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ export const getParents = (elem, selector) => {
Element.prototype.oMatchesSelector ||
Element.prototype.webkitMatchesSelector ||
function(s) {
var matches = (this.document || this.ownerDocument).querySelectorAll(s),
let matches = (this.document || this.ownerDocument).querySelectorAll(s),
i = matches.length;
while (--i >= 0 && matches.item(i) !== this) {}
return i > -1;
};
}

// Set up a parent array
var parents = [];
const parents = [];

// Push each parent element to the array
for (; elem && elem !== document; elem = elem.parentNode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { urlHandler, patternName, iframeMsgDataExtraction } from '../../utils';
import { store } from '../../store'; // redux store
import styles from './pl-tools-menu.scss?external';

let listeningForBodyClicks = false;
const listeningForBodyClicks = false;

import { html } from 'lit-html';
import { BaseLitComponent } from '../../components/base-component';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class IFrame extends BaseLitComponent {
'orientationchange',
function() {
if (window.orientation !== this.origOrientation) {
let newWidth = window.innerWidth;
const newWidth = window.innerWidth;
self.iframeContainer.style.width = newWidth;
self.iframe.style.width = newWidth;
self.updateSizeReading(newWidth);
Expand Down

0 comments on commit f36d967

Please sign in to comment.