Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanblock committed Apr 29, 2024
1 parent 6fe80a9 commit 1c0aaa7
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 45 deletions.
20 changes: 10 additions & 10 deletions src/lexer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let {
COMMENT,
STRING,
NUMBER,
BOOLEAN
BOOLEAN,
} = require('./regexp')

let peek = require('./peek')
Expand Down Expand Up @@ -42,7 +42,7 @@ module.exports = function lex (code) {
type: 'pragma',
value: token.substring(1),
line,
column
column,
})
cursor += token.length
column += token.length
Expand All @@ -55,7 +55,7 @@ module.exports = function lex (code) {
type: 'comment',
value: token,
line,
column
column,
})
cursor += token.length
column += token.length
Expand All @@ -67,7 +67,7 @@ module.exports = function lex (code) {
type: 'space',
value: ' ',
line,
column
column,
})
cursor += 1
column += 1
Expand All @@ -80,13 +80,13 @@ module.exports = function lex (code) {
type: 'space',
value: ' ',
line,
column
column,
})
tokens.push({
type: 'space',
value: ' ',
line,
column
column,
})
cursor += 1
column += 1
Expand All @@ -98,7 +98,7 @@ module.exports = function lex (code) {
type: 'newline',
value: '\n',
line,
column
column,
})
// special lookahead to see if we got \r\n
let twochars = code[cursor] + code[cursor + 1]
Expand All @@ -117,7 +117,7 @@ module.exports = function lex (code) {
type: 'boolean',
value: tmp === 'false' ? false : true, // questionable
line,
column
column,
})
cursor += tmp.length
column += tmp.length
Expand All @@ -133,7 +133,7 @@ module.exports = function lex (code) {
type: 'number',
value: Number(token),
line,
column
column,
})
cursor += token.length
column += token.length
Expand All @@ -151,7 +151,7 @@ module.exports = function lex (code) {
type: 'string',
value: token,
line,
column
column,
}
let quote = singleQuote || doubleQuote || backtick
if (quote) {
Expand Down
4 changes: 2 additions & 2 deletions src/lexer/peek.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const {
DASHERIZED,
SPACE,
NEWLINE,
STRING
STRING,
} = require('./regexp')

const PragmaSyntaxError = require('../errors/lex-pragma-syntax')
Expand Down Expand Up @@ -91,5 +91,5 @@ module.exports = {
}
return token
}
}
},
}
2 changes: 1 addition & 1 deletion src/parser/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function array (lines) {
type: 'array',
line: copy[0][0].line,
column: copy[0][0].column,
values: copy[0].slice(0)
values: copy[0].slice(0),
}

return { end, value }
Expand Down
2 changes: 1 addition & 1 deletion src/parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = function parse (tokens) {
raw: token.value,
line: token.line,
column: token.column,
values: []
values: [],
}
arcfile.values.push(pragma)
index += 1
Expand Down
2 changes: 1 addition & 1 deletion src/parser/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ module.exports = function map (tokens) {

return {
end,
value: { type: 'map', name, raw, values }
value: { type: 'map', name, raw, values },
}
}
2 changes: 1 addition & 1 deletion src/parser/vector.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ module.exports = function vector (tokens) {

return {
end: first.length + values.length,
value: { type: 'vector', name, raw, values }
value: { type: 'vector', name, raw, values },
}
}
30 changes: 15 additions & 15 deletions test/01-ast-scalar-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ test('ast empty', t => {
{ type: 'newline', value: '\n', line: 3, column: 18 },
{ type: 'space', value: ' ', line: 4, column: 1 },
{ type: 'space', value: ' ', line: 4, column: 2 },
{ type: 'comment', value: '# comment3', line: 4, column: 3 }
]
}
]
{ type: 'comment', value: '# comment3', line: 4, column: 3 },
],
},
],
}

let parsed = parse.parser(parse.lexer(mock))
Expand Down Expand Up @@ -67,10 +67,10 @@ true`
{ type: 'newline', value: '\n', line: 5, column: 4 },
{ type: 'number', value: 2, line: 6, column: 1 },
{ type: 'newline', value: '\n', line: 6, column: 2 },
{ type: 'boolean', value: true, line: 7, column: 1 }
]
}
]
{ type: 'boolean', value: true, line: 7, column: 1 },
],
},
],
}

let parsed = parse.parser(parse.lexer(mock))
Expand Down Expand Up @@ -116,13 +116,13 @@ one true 3 # comment2`
type: 'comment',
value: '# comment2',
line: 5,
column: 12
}
]
}
]
}
]
column: 12,
},
],
},
],
},
],
}

let tokens = parse.lexer(mock)
Expand Down
18 changes: 9 additions & 9 deletions test/02-ast-complex-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ this should be ignored`
type: 'comment',
value: '# comment4',
line: 8,
column: 3
column: 3,
},
{ type: 'newline', value: '\n', line: 8, column: 13 },
{ type: 'space', value: ' ', line: 9, column: 1 },
{ type: 'space', value: ' ', line: 9, column: 2 },
{ type: 'string', value: 'values', line: 9, column: 3 },
{ type: 'newline', value: '\n', line: 9, column: 9 }
]
{ type: 'newline', value: '\n', line: 9, column: 9 },
],
},
{
type: 'array',
Expand All @@ -98,12 +98,12 @@ this should be ignored`
{ type: 'space', value: ' ', line: 10, column: 12 },
{ type: 'string', value: 'be', line: 10, column: 13 },
{ type: 'space', value: ' ', line: 10, column: 15 },
{ type: 'string', value: 'ignored', line: 10, column: 16 }
]
}
]
}
]
{ type: 'string', value: 'ignored', line: 10, column: 16 },
],
},
],
},
],
}
let parsed = parse.parser(parse.lexer(mock))
console.dir(parsed, { depth: null })
Expand Down
6 changes: 3 additions & 3 deletions test/04-compiler-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ssr "node_modules/@enhance/ssr"`
t.same(arc, { bundles: [
[ 'my-package', 'node_modules/my-package' ],
[ 'store', 'node_modules/@enhance/store' ],
[ 'ssr', 'node_modules/@enhance/ssr' ]
[ 'ssr', 'node_modules/@enhance/ssr' ],
] })
console.log(arc)
})
Expand Down Expand Up @@ -133,8 +133,8 @@ cat
let arc = parse.compiler(ast)
t.same(arc, {
pets: [
{ cat: { names: [ 'sutr0', 'tux3d0' ] } }
]
{ cat: { names: [ 'sutr0', 'tux3d0' ] } },
],
})
console.dir(arc, { depth: null })
})
Expand Down
4 changes: 2 additions & 2 deletions test/09-architect-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test('Test full Architect project manifest mock', t => {
'scheduled',
'queues',
'tables',
'indexes'
'indexes',
]
let pragmaConfig = {
app: 1,
Expand All @@ -69,7 +69,7 @@ test('Test full Architect project manifest mock', t => {
scheduled: 1,
queues: 3,
tables: 2,
indexes: 2
indexes: 2,
}
t.plan(1 + (pragmas.length * 2))
let isArray = i => Array.isArray(i)
Expand Down

0 comments on commit 1c0aaa7

Please sign in to comment.