Skip to content

Commit 9d08c12

Browse files
author
tohosaku
committed
Update "standard" to 14.3.3
* fix eslint errors
1 parent 1ef0b21 commit 9d08c12

File tree

17 files changed

+717
-827
lines changed

17 files changed

+717
-827
lines changed

package-lock.json

Lines changed: 666 additions & 783 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"remove-strict-webpack-plugin": "^0.1.2",
8787
"sceditor": "^2.1.3",
8888
"sinon": "^8.1.1",
89-
"standard": "^11.0.1",
89+
"standard": "^14.3.3",
9090
"style-loader": "^1.1.3",
9191
"webpack": "^4.41.6",
9292
"webpack-cli": "^3.3.11",

src/core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { editors } from './editors/index.js'
55
import { templates } from './templates/index.js'
66
import { iconlibs } from './iconlibs/index.js'
77
import { themes } from './themes/index.js'
8-
import { extend, getShadowParent } from './utilities.js'
8+
import { extend, getShadowParent, hasOwnProperty } from './utilities.js'
99

1010
export class JSONEditor {
1111
constructor (element, options = {}) {
@@ -74,7 +74,7 @@ export class JSONEditor {
7474
this.root.postBuild()
7575

7676
/* Starting data */
77-
if (this.options.hasOwnProperty('startval')) this.root.setValue(this.options.startval)
77+
if (hasOwnProperty(this.options, 'startval')) this.root.setValue(this.options.startval)
7878

7979
this.validation_results = this.validator.validate(this.root.getValue())
8080
this.root.showValidationErrors(this.validation_results)

src/editor.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { extend } from './utilities.js'
1+
import { extend, hasOwnProperty } from './utilities.js'
22

33
/**
44
* All editors should extend from this class
@@ -130,10 +130,10 @@ export class AbstractEditor {
130130
this.dependenciesFulfilled = choices === value
131131
} else {
132132
Object.keys(choices).some(key => {
133-
if (!choices.hasOwnProperty(key)) {
133+
if (!hasOwnProperty(choices, key)) {
134134
return false
135135
}
136-
if (!value.hasOwnProperty(key) || choices[key] !== value[key]) {
136+
if (!hasOwnProperty(value, key) || choices[key] !== value[key]) {
137137
self.dependenciesFulfilled = false
138138
return true
139139
}
@@ -223,7 +223,7 @@ export class AbstractEditor {
223223
}
224224
}
225225

226-
if (this.schema.hasOwnProperty('watch')) {
226+
if (hasOwnProperty(this.schema, 'watch')) {
227227
let path; let pathParts; let first; let root; let adjustedPath
228228
const myPath = self.container.getAttribute('data-schemapath')
229229

@@ -526,12 +526,12 @@ export class AbstractEditor {
526526
}
527527

528528
getDefault () {
529-
if (typeof this.schema['default'] !== 'undefined') {
530-
return this.schema['default']
529+
if (typeof this.schema.default !== 'undefined') {
530+
return this.schema.default
531531
}
532532

533-
if (typeof this.schema['enum'] !== 'undefined') {
534-
return this.schema['enum'][0]
533+
if (typeof this.schema.enum !== 'undefined') {
534+
return this.schema.enum[0]
535535
}
536536

537537
let type = this.schema.type || this.schema.oneOf

src/editors/array/choices.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ export class ArrayChoicesEditor extends MultiSelectEditor {
1818

1919
afterInputReady () {
2020
if (window.Choices && !this.choices_instance) {
21-
let options; const self = this
21+
const self = this
2222
/* Get options, either global options from "this.defaults.options.choices" or */
2323
/* single property options from schema "options.choices" */
24-
options = this.expandCallbacks('choices', extend({}, {
24+
const options = this.expandCallbacks('choices', extend({}, {
2525
removeItems: true,
2626
removeItemButton: true
2727
}, this.defaults.options.choices || {}, this.options.choices || {}, {

src/editors/array/select2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { MultiSelectEditor } from '../multiselect.js'
2-
import { extend } from '../../utilities.js'
2+
import { extend, hasOwnProperty } from '../../utilities.js'
33

44
export class ArraySelect2Editor extends MultiSelectEditor {
55
setValue (value, initial) {
@@ -31,7 +31,7 @@ export class ArraySelect2Editor extends MultiSelectEditor {
3131
this.newEnumAllowed = options.tags = !!options.tags && this.schema.items && this.schema.items.type === 'string'
3232

3333
this.select2_instance = window.jQuery(this.input).select2(options)
34-
this.select2v4 = this.select2_instance.select2.hasOwnProperty('amd')
34+
this.select2v4 = hasOwnProperty(this.select2_instance.select2, 'amd')
3535

3636
this.selectChangeHandler = () => {
3737
const value = self.select2v4 ? self.select2_instance.val() : self.select2_instance.select2('val')

src/editors/choices.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ export class ChoicesEditor extends SelectEditor {
2626

2727
afterInputReady () {
2828
if (window.Choices && !this.choices_instance) {
29-
let options
3029
/* Get options, either global options from "this.defaults.options.choices" or */
3130
/* single property options from schema "options.choices" */
32-
options = this.expandCallbacks('choices', extend({}, this.defaults.options.choices || {}, this.options.choices || {}))
31+
const options = this.expandCallbacks('choices', extend({}, this.defaults.options.choices || {}, this.options.choices || {}))
3332

3433
this.choices_instance = new window.Choices(this.input, options)
3534
}

src/editors/object.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AbstractEditor } from '../editor.js'
2-
import { extend, trigger } from '../utilities.js'
2+
import { extend, trigger, hasOwnProperty } from '../utilities.js'
33

44
export class ObjectEditor extends AbstractEditor {
55
getDefault () {
@@ -891,19 +891,16 @@ export class ObjectEditor extends AbstractEditor {
891891

892892
addPropertyCheckbox (key) {
893893
const self = this
894-
let checkbox
895-
let label
896894
let labelText
897-
let control
898895

899-
checkbox = self.theme.getCheckbox()
896+
const checkbox = self.theme.getCheckbox()
900897
checkbox.style.width = 'auto'
901898

902899
if (this.schema.properties[key] && this.schema.properties[key].title) { labelText = this.schema.properties[key].title } else { labelText = key }
903900

904-
label = self.theme.getCheckboxLabel(labelText)
901+
const label = self.theme.getCheckboxLabel(labelText)
905902

906-
control = self.theme.getFormControl(label, checkbox)
903+
const control = self.theme.getFormControl(label, checkbox)
907904
control.style.paddingBottom = control.style.marginBottom = control.style.paddingTop = control.style.marginTop = 0
908905
control.style.height = 'auto'
909906
/* control.style.overflowY = 'hidden'; */
@@ -1121,7 +1118,7 @@ export class ObjectEditor extends AbstractEditor {
11211118
this.addproperty_checkboxes[i].disabled = this.addproperty_checkboxes[i].checked
11221119
if (!this.addproperty_checkboxes[i].checked) showModal = true
11231120
} else if (!(i in this.editors)) {
1124-
if (!canAdd && !this.schema.properties.hasOwnProperty(i)) {
1121+
if (!canAdd && !hasOwnProperty(this.schema.properties, i)) {
11251122
this.addproperty_checkboxes[i].disabled = true
11261123
} else {
11271124
this.addproperty_checkboxes[i].disabled = false

src/editors/select2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SelectEditor } from './select.js'
2-
import { extend } from '../utilities.js'
2+
import { extend, hasOwnProperty } from '../utilities.js'
33

44
export class Select2Editor extends SelectEditor {
55
setValue (value, initial) {
@@ -28,7 +28,7 @@ export class Select2Editor extends SelectEditor {
2828
this.newEnumAllowed = options.tags = !!options.tags && this.schema.type === 'string'
2929

3030
this.select2_instance = window.jQuery(this.input).select2(options)
31-
this.select2v4 = this.select2_instance.select2.hasOwnProperty('amd')
31+
this.select2v4 = hasOwnProperty(this.select2_instance.select2, 'amd')
3232

3333
/* Create change handler */
3434
this.selectChangeHandler = () => {

src/iconlib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
const defaultMapping = { collapse: '', expand: '', 'delete': '', edit: '', add: '', cancel: '', save: '', moveup: '', movedown: '' }
2+
const defaultMapping = { collapse: '', expand: '', delete: '', edit: '', add: '', cancel: '', save: '', moveup: '', movedown: '' }
33

44
export class AbstractIconLib {
55
constructor (iconPrefix = '', mapping = defaultMapping) {

0 commit comments

Comments
 (0)