Skip to content

Commit f36d967

Browse files
authored
refactor(eslint): integrated feedback (pattern-lab#1304)
* refactor(eslint): integrated feedback out of auto-fixable stuff * refactor(eslint): integrated feedback most likely out of beautification
1 parent 04223e7 commit f36d967

File tree

7 files changed

+30
-20
lines changed

7 files changed

+30
-20
lines changed

packages/uikit-workshop/build/webpack-dev-server-waitpage/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ const defaultOptions = {
3131
* @returns {Function} Koa compatible middleware
3232
*/
3333
const webpackDevServerWaitpage = (server, options) => {
34-
if (!server)
34+
if (!server) {
3535
throw new Error(
3636
`webpack-dev-server's compilers argument must be supplied as first parameter.`
3737
);
38+
}
3839

3940
/** @type {WebpackDevServerWaitpageOptions} */
4041
options = Object.assign({}, defaultOptions, options);
@@ -55,8 +56,9 @@ const webpackDevServerWaitpage = (server, options) => {
5556
.filter(x => x.endsWith('.ejs'))
5657
.map(x => x.slice(0, -4))
5758
.indexOf(options.theme) < 0
58-
)
59+
) {
5960
throw new Error(`Unknown theme provided: ${options.theme}`);
61+
}
6062
template = fs.readFileSync(
6163
path.resolve(__dirname, options.theme + '.ejs'),
6264
'utf8'

packages/uikit-workshop/src/scripts/components/base-skate-element.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { dashCase, empty, keys } from 'skatejs/dist/esnext/util';
22

3-
var _extends =
3+
const _extends =
44
Object.assign ||
55
function(target) {
6-
for (var i = 1; i < arguments.length; i++) {
7-
var source = arguments[i];
8-
for (var key in source) {
6+
for (let i = 1; i < arguments.length; i++) {
7+
const source = arguments[i];
8+
for (const key in source) {
99
if (Object.prototype.hasOwnProperty.call(source, key)) {
1010
target[key] = source[key];
1111
}
@@ -50,12 +50,18 @@ export function normalizePropertyDefinition(name, prop) {
5050
const defaultTypesMap = new Map();
5151

5252
function defineProps(constructor) {
53-
if (constructor.hasOwnProperty('_propsNormalized')) return;
53+
if (constructor.hasOwnProperty('_propsNormalized')) {
54+
return;
55+
}
5456
const { props } = constructor;
5557
keys(props).forEach(name => {
5658
let func = props[name] || props.any;
57-
if (defaultTypesMap.has(func)) func = defaultTypesMap.get(func);
58-
if (typeof func !== 'function') func = prop(func);
59+
if (defaultTypesMap.has(func)) {
60+
func = defaultTypesMap.get(func);
61+
}
62+
if (typeof func !== 'function') {
63+
func = prop(func);
64+
}
5965
func({ constructor }, name);
6066
});
6167
}
@@ -130,7 +136,7 @@ export function prop(definition) {
130136

131137
export class SkateElement extends HTMLElement {
132138
constructor(...args) {
133-
var _temp;
139+
let _temp;
134140
return (
135141
(_temp = super(...args)),
136142
(this._prevProps = {}),

packages/uikit-workshop/src/scripts/components/base-skate-preact-element.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
var _extends =
1+
const _extends =
22
Object.assign ||
33
function(target) {
4-
for (var i = 1; i < arguments.length; i++) {
5-
var source = arguments[i];
6-
for (var key in source) {
4+
for (let i = 1; i < arguments.length; i++) {
5+
const source = arguments[i];
6+
for (const key in source) {
77
if (Object.prototype.hasOwnProperty.call(source, key)) {
88
target[key] = source[key];
99
}
@@ -24,7 +24,7 @@ const preactNodeName = '__preactNodeName';
2424
let oldVnode;
2525

2626
function newVnode(vnode) {
27-
let fn = vnode.nodeName;
27+
const fn = vnode.nodeName;
2828
if (fn && fn.prototype instanceof HTMLElement) {
2929
if (!fn[preactNodeName]) {
3030
const prefix = fn.name;

packages/uikit-workshop/src/scripts/components/panels.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ function init(event) {
8484
Panels.add({
8585
id: 'pl-panel-html',
8686
name: 'HTML',
87-
default: window.config.defaultPatternInfoPanelCode && window.config.defaultPatternInfoPanelCode === 'html',
87+
default:
88+
window.config.defaultPatternInfoPanelCode &&
89+
window.config.defaultPatternInfoPanelCode === 'html',
8890
templateID: 'pl-panel-template-code',
8991
httpRequest: true,
9092
httpRequestReplace: fileSuffixMarkup + '.html',

packages/uikit-workshop/src/scripts/components/pl-nav/get-parents.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ export const getParents = (elem, selector) => {
88
Element.prototype.oMatchesSelector ||
99
Element.prototype.webkitMatchesSelector ||
1010
function(s) {
11-
var matches = (this.document || this.ownerDocument).querySelectorAll(s),
11+
let matches = (this.document || this.ownerDocument).querySelectorAll(s),
1212
i = matches.length;
1313
while (--i >= 0 && matches.item(i) !== this) {}
1414
return i > -1;
1515
};
1616
}
1717

1818
// Set up a parent array
19-
var parents = [];
19+
const parents = [];
2020

2121
// Push each parent element to the array
2222
for (; elem && elem !== document; elem = elem.parentNode) {

packages/uikit-workshop/src/scripts/lit-components/pl-tools-menu/pl-tools-menu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { urlHandler, patternName, iframeMsgDataExtraction } from '../../utils';
66
import { store } from '../../store'; // redux store
77
import styles from './pl-tools-menu.scss?external';
88

9-
let listeningForBodyClicks = false;
9+
const listeningForBodyClicks = false;
1010

1111
import { html } from 'lit-html';
1212
import { BaseLitComponent } from '../../components/base-component';

packages/uikit-workshop/src/scripts/lit-components/pl-viewport/pl-viewport.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class IFrame extends BaseLitComponent {
257257
'orientationchange',
258258
function() {
259259
if (window.orientation !== this.origOrientation) {
260-
let newWidth = window.innerWidth;
260+
const newWidth = window.innerWidth;
261261
self.iframeContainer.style.width = newWidth;
262262
self.iframe.style.width = newWidth;
263263
self.updateSizeReading(newWidth);

0 commit comments

Comments
 (0)