chore(core): Linter fixes
This commit is contained in:
parent
a76af50900
commit
56427cc4bd
10 changed files with 43 additions and 91 deletions
|
@ -31,7 +31,7 @@ export function Part() {
|
|||
return this
|
||||
}
|
||||
|
||||
Part.prototype.macroClosure = function (args) {
|
||||
Part.prototype.macroClosure = function () {
|
||||
let self = this
|
||||
let method = function (key, args) {
|
||||
let macro = utils.macroName(key)
|
||||
|
@ -59,7 +59,7 @@ Part.prototype.getId = function (prefix = '') {
|
|||
}
|
||||
|
||||
/** Returns a value formatted for units provided in settings */
|
||||
Part.prototype.unitsClosure = function (value) {
|
||||
Part.prototype.unitsClosure = function () {
|
||||
const self = this
|
||||
const method = function (value) {
|
||||
if (typeof value !== 'number')
|
||||
|
@ -267,8 +267,8 @@ Part.prototype.shorthand = function () {
|
|||
shorthand.paths = new Proxy(this.paths || {}, pathsProxy)
|
||||
// Proxy the snippets object
|
||||
const snippetsProxy = {
|
||||
get: function (target, prop, receiver) {
|
||||
return Reflect.get(...arguments)
|
||||
get: function (...args) {
|
||||
return Reflect.get(...args)
|
||||
},
|
||||
set: (snippets, name, value) => {
|
||||
// Constructor checks
|
||||
|
@ -340,12 +340,12 @@ Part.prototype.isEmpty = function () {
|
|||
if (Object.keys(this.snippets).length > 0) return false
|
||||
|
||||
if (Object.keys(this.paths).length > 0) {
|
||||
for (var p in this.paths) {
|
||||
for (const p in this.paths) {
|
||||
if (this.paths[p].render && this.paths[p].length()) return false
|
||||
}
|
||||
}
|
||||
|
||||
for (var p in this.points) {
|
||||
for (const p in this.points) {
|
||||
if (this.points[p].attributes.get('data-text')) return false
|
||||
if (this.points[p].attributes.get('data-circle')) return false
|
||||
}
|
||||
|
|
|
@ -393,7 +393,7 @@ function asPath(bezier, debug = false, log = false) {
|
|||
}
|
||||
|
||||
/** Joins path segments together into one path */
|
||||
function joinPaths(paths, closed = false, log = false) {
|
||||
function joinPaths(paths, closed = false) {
|
||||
let joint = new Path(paths[0].debug).withLog(paths[0].log).move(paths[0].ops[0].to)
|
||||
let current
|
||||
for (let p of paths) {
|
||||
|
|
|
@ -310,7 +310,6 @@ Pattern.prototype.sampleParts = function () {
|
|||
Pattern.prototype.sampleRun = function (parts, anchors, run, runs, extraClass = false) {
|
||||
this.draft()
|
||||
for (let i in this.parts) {
|
||||
let anchor = false
|
||||
let dx = 0
|
||||
let dy = 0
|
||||
if (this.parts[i].points.anchor) {
|
||||
|
@ -474,7 +473,7 @@ Pattern.prototype.__loadPlugins = function () {
|
|||
return this
|
||||
}
|
||||
|
||||
Pattern.prototype.__loadPlugin = function (plugin, data, explicit = false) {
|
||||
Pattern.prototype.__loadPlugin = function (plugin, data) {
|
||||
this.plugins[plugin.name] = plugin
|
||||
if (plugin.hooks) this.__loadPluginHooks(plugin, data)
|
||||
if (plugin.macros) this.__loadPluginMacros(plugin)
|
||||
|
@ -711,7 +710,7 @@ Pattern.prototype.__resolveParts = function (count = 0) {
|
|||
// If so, resolve recursively
|
||||
if (len > count) return this.__resolveParts(len)
|
||||
|
||||
for (const [name, part] of Object.entries(this.__parts)) {
|
||||
for (const part of Object.values(this.__parts)) {
|
||||
this.config = addPartConfig(part, this.config, this.store)
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,12 @@ Stack.prototype.addPart = function (part) {
|
|||
}
|
||||
|
||||
/* Returns a list of parts in this stack */
|
||||
Stack.prototype.getPartList = function (part) {
|
||||
Stack.prototype.getPartList = function () {
|
||||
return [...this.parts]
|
||||
}
|
||||
|
||||
/* Returns a list of names of parts in this stack */
|
||||
Stack.prototype.getPartNames = function (part) {
|
||||
Stack.prototype.getPartNames = function () {
|
||||
return [...this.parts].map((p) => p.name)
|
||||
}
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ Svg.prototype.renderText = function (point) {
|
|||
}
|
||||
|
||||
Svg.prototype.escapeText = function (text) {
|
||||
return text.replace(/\"/g, '“')
|
||||
return text.replace(/"/g, '“')
|
||||
}
|
||||
|
||||
Svg.prototype.renderCircle = function (point) {
|
||||
|
@ -234,7 +234,7 @@ Svg.prototype.renderCircle = function (point) {
|
|||
}
|
||||
|
||||
/** Returns SVG code for a snippet */
|
||||
Svg.prototype.renderSnippet = function (snippet, part) {
|
||||
Svg.prototype.renderSnippet = function (snippet) {
|
||||
let x = round(snippet.anchor.x)
|
||||
let y = round(snippet.anchor.y)
|
||||
let scale = snippet.attributes.get('data-scale') || 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue