Skip to content

Commit 2c30aba

Browse files
committed
chore: format checking of utils/create-schema.js
1 parent e44e1ac commit 2c30aba

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

utils/create-schema.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const properties = getAllFiles(ecsSchemasDir)
5252
.map(file => fs.readFileSync(file, 'utf8'))
5353
.map(yaml.safeLoad)
5454
.reduce((acc, [val]) => {
55-
var properties = {}
55+
let properties = {}
5656
for (const prop of val.fields) {
5757
properties = set(properties, prop.name, jsonSchemaTypeFromEcsType(prop.type))
5858
}
@@ -68,12 +68,12 @@ const properties = getAllFiles(ecsSchemasDir)
6868
}, {})
6969

7070
// Write out a JSON schema file.
71-
const gitInfo = execSync(`git log -1 --pretty=format:'commit %h%d'`, {
71+
const gitInfo = execSync('git log -1 --pretty=format:\'commit %h%d\'', {
7272
cwd: ecsRepo
7373
})
7474
const comment = `ecs.git ${gitInfo}`
7575
const jsonSchema = JSON.stringify({
76-
'$comment': comment,
76+
$comment: comment,
7777
type: 'object',
7878
properties,
7979
additionalProperties: true
@@ -95,17 +95,17 @@ function set (object, objPath, value, customizer) {
9595
.split('.')
9696
.join('.properties.')
9797
.split('.')
98-
var index = -1
99-
var length = objPath.length
100-
var lastIndex = length - 1
101-
var nested = object
98+
let index = -1
99+
const length = objPath.length
100+
const lastIndex = length - 1
101+
let nested = object
102102

103103
while (nested != null && ++index < length) {
104-
var key = objPath[index]
105-
var newValue = value
104+
const key = objPath[index]
105+
let newValue = value
106106

107107
if (index !== lastIndex) {
108-
var objValue = nested[key]
108+
const objValue = nested[key]
109109
newValue = objValue || {}
110110
}
111111
if (key === 'properties') {
@@ -158,7 +158,7 @@ function jsonSchemaTypeFromEcsType (type) {
158158
}
159159
}
160160

161-
function usageError(msg) {
161+
function usageError (msg) {
162162
const prog = path.basename(process.argv[1])
163163
process.stderr.write(`${prog}: error: ${msg}\n`)
164164
process.stderr.write('usage: node create-schema $ecsRepo\n')

utils/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,5 @@
1212
"devDependencies": {
1313
"js-yaml": "^3.13.1",
1414
"standard": "^16.0.3"
15-
},
16-
"standard": {
17-
"ignore": [
18-
"create-schema.js"
19-
]
2015
}
2116
}

0 commit comments

Comments
 (0)