Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator name with hyphen throws an error #334

Closed
daeteck opened this issue Mar 5, 2024 · 4 comments
Closed

Generator name with hyphen throws an error #334

daeteck opened this issue Mar 5, 2024 · 4 comments

Comments

@daeteck
Copy link

daeteck commented Mar 5, 2024

When a hyphen is added to the name of the generator the linting throws an error.

Example:

generator markdown-something {
provider = "prisma-markdown"
}

Error:

MismatchedTokenException: Expecting --> '{' <-- but found --> 'something' <--
    at RecognizerEngine.consumeInternalError (/Users/diegoesteves/Documents/BGS2/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js:500:31)
    at RecognizerEngine.consumeInternal (/Users/diegoesteves/Documents/BGS2/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js:475:22)
    at RecognizerApi.CONSUME (/Users/diegoesteves/Documents/BGS2/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js:47:21)
    at PrismaParser.<anonymous> (/Users/diegoesteves/Documents/BGS2/node_modules/@mrleebo/prisma-ast/dist/prisma-ast.cjs.development.js:395:13)
    at PrismaParser.invokeRuleWithTry [as block] (/Users/diegoesteves/Documents/BGS2/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js:133:26)
    at RecognizerEngine.subruleInternal (/Users/diegoesteves/Documents/BGS2/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js:447:37)
    at RecognizerApi.SUBRULE (/Users/diegoesteves/Documents/BGS2/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js:77:21)
    at PrismaParser.<anonymous> (/Users/diegoesteves/Documents/BGS2/node_modules/@mrleebo/prisma-ast/dist/prisma-ast.cjs.development.js:576:13)
    at PrismaParser.invokeRuleWithTry [as component] (/Users/diegoesteves/Documents/BGS2/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js:133:26)
    at RecognizerEngine.subruleInternal (/Users/diegoesteves/Documents/BGS2/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js:447:37) {
  token: {
    image: 'something',
    startOffset: 810,
    endOffset: 818,
    startLine: 25,
    endLine: 25,
    startColumn: 19,
    endColumn: 27,
    tokenTypeIdx: 3,
    tokenType: {
      name: 'Identifier',
      PATTERN: /[a-zA-Z]\w*/,
      tokenTypeIdx: 3,
      CATEGORIES: [],
      categoryMatches: [],
      categoryMatchesMap: {},
      isParent: false
    }
  },
  resyncedTokens: [],
  previousToken: {
    image: 'markdown',
    startOffset: 801,
    endOffset: 808,
    startLine: 25,
    endLine: 25,
    startColumn: 11,
    endColumn: 18,
    tokenTypeIdx: 3,
    tokenType: {
      name: 'Identifier',
      PATTERN: /[a-zA-Z]\w*/,
      tokenTypeIdx: 3,
      CATEGORIES: [],
      categoryMatches: [],
      categoryMatchesMap: {},
      isParent: false
    }
  },
  context: {
    ruleStack: [ 'schema', 'component', 'block' ],
    ruleOccurrenceStack: [ 0, 0, 0 ]
  }
}
@maxh
Copy link
Collaborator

maxh commented Mar 8, 2024

Interesting. Thanks for reporting. This looks like it might be an issue with https://github.com/MrLeebo/prisma-ast.

@maxh
Copy link
Collaborator

maxh commented Mar 8, 2024

Filed MrLeebo/prisma-ast#39

@MrLeebo
Copy link

MrLeebo commented Mar 9, 2024

This issue is already fixed in prisma-ast v0.10.1, which prisma-lint is using in the main branch.

@maxh
Copy link
Collaborator

maxh commented Mar 13, 2024

Thanks @MrLeebo! @daeteck, this should be resolved in 0.1.1 #335

@maxh maxh closed this as completed Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants