Skip to content

Commit

Permalink
Update dependencies, including new lint rules. Move to simpler tsconf…
Browse files Browse the repository at this point in the history
…ig so that eslint can easily find the correct file. Fix small lint issues with new rules.
  • Loading branch information
hildjj committed Jan 27, 2024
1 parent 2e3cfd4 commit c14e8ae
Show file tree
Hide file tree
Showing 15 changed files with 371 additions and 272 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
"build",
],
parserOptions: {
project: "tsconfig.json",
project: true,
},
overrides: [
{
Expand Down
8 changes: 4 additions & 4 deletions lib/compiler/passes/generate-bytecode.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,10 @@ function generateBytecode(ast, options) {
buildCondition(
SOMETIMES_MATCH,
checkCode, // if (result.length < min) {
/* eslint-disable indent -- Clarity */
/* eslint-disable @stylistic/indent -- Clarity */
[op.POP, op.POP_CURR_POS, // currPos = savedPos; stack:[ ]
op.PUSH_FAILED], // result = peg$FAILED; stack:[ peg$FAILED ]
/* eslint-enable indent */
/* eslint-enable @stylistic/indent */
[op.NIP] // } stack:[ [elem...] ]
)
);
Expand Down Expand Up @@ -623,11 +623,11 @@ function generateBytecode(ast, options) {
-expressionMatch,
[op.IF_ERROR], // if (item === peg$FAILED) {
// If element FAILED, rollback currPos to saved value.
/* eslint-disable indent -- Clarity */
/* eslint-disable @stylistic/indent -- Clarity */
[op.POP, // stack:[ pos ]
op.POP_CURR_POS, // peg$currPos = pos; stack:[ ]
op.PUSH_FAILED], // item = peg$FAILED; stack:[ peg$FAILED ]
/* eslint-enable indent */
/* eslint-enable @stylistic/indent */
// Else, just drop saved currPos.
[op.NIP] // } stack:[ item ]
)
Expand Down
4 changes: 2 additions & 2 deletions lib/compiler/passes/generate-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ function generateJS(ast, options) {

return new SourceNode(
// This expression has a better readability when on two lines
// eslint-disable-next-line function-call-argument-newline
// eslint-disable-next-line @stylistic/function-call-argument-newline
null, null, options.grammarSource,
parts.map(s => (s instanceof SourceNode ? s : s + "\n"))
);
Expand Down Expand Up @@ -1653,7 +1653,7 @@ function generateJS(ast, options) {
const parts = generators[options.format || "bare"]();

return new SourceNode(
// eslint-disable-next-line function-call-argument-newline -- This expression has a better readability when on two lines
// eslint-disable-next-line @stylistic/function-call-argument-newline -- This expression has a better readability when on two lines
null, null, options.grammarSource,
parts.map(s => (s instanceof SourceNode ? s : s + "\n"))
);
Expand Down
24 changes: 12 additions & 12 deletions lib/peg.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ declare namespace ast {
* Added by the `generateBytecode` pass and contain data for
* bytecodes to refer back to via index.
*/
literals?: string[];
classes?: GrammarCharacterClass[];
expectations?: GrammarExpectation[];
importedNames?: string[];
functions?: FunctionConst[];
locations?: LocationRange[];
}
literals?: string[];
classes?: GrammarCharacterClass[];
expectations?: GrammarExpectation[];
importedNames?: string[];
functions?: FunctionConst[];
locations?: LocationRange[];
}

/**
* Base interface for all initializer nodes with the code.
Expand Down Expand Up @@ -222,11 +222,11 @@ declare namespace ast {
interface Action extends CodeBlockExpr<"action"> {
expression: (
Labeled
| Prefixed
| Primary
| Repeated
| Sequence
| Suffixed
| Prefixed
| Primary
| Repeated
| Sequence
| Suffixed
);
}

Expand Down
Loading

0 comments on commit c14e8ae

Please sign in to comment.