Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

The 'quotemark' rule threw an error #4181

Closed
alexfung888 opened this issue Sep 21, 2018 · 3 comments
Closed

The 'quotemark' rule threw an error #4181

alexfung888 opened this issue Sep 21, 2018 · 3 comments

Comments

@alexfung888
Copy link

Bug Report

  • TSLint version: 5.11.0
  • TypeScript version: 2.9.2
  • Running TSLint via: Visual Studio

TypeScript code being linted

// code snippet

with tslint.json configuration:

{
  "rulesDirectory": [
    "node_modules/codelyzer"
  ],
  "rules": {
    "arrow-return-shorthand": true,
    "callable-types": true,
    "class-name": true,
    "comment-format": [
      true,
      "check-space"
    ],
    "curly": false,
    "eofline": true,
    "forin": true,
    "import-blacklist": [
      true
    ],
    "import-spacing": true,
    "indent": [
      true,
      "spaces"
    ],
    "interface-over-type-literal": true,
    "label-position": true,
    "max-line-length": [
      true,
      140
    ],
    "member-access": false,
    "member-ordering": [
      true,
      {
        "order": [
          "static-field",
          "instance-field",
          "static-method",
          "instance-method"
        ]
      }
    ],
    "no-arg": true,
    "no-bitwise": true,
    "no-console": [
      true,
      "debug",
      "info",
      "time",
      "timeEnd",
      "trace"
    ],
    "no-construct": true,
    "no-debugger": true,
    "no-duplicate-super": true,
    "no-empty": false,
    "no-empty-interface": true,
    "no-eval": true,
    "no-inferrable-types": [
      true,
      "ignore-params"
    ],
    "no-misused-new": true,
    "no-non-null-assertion": true,
    "no-shadowed-variable": true,
    "no-string-literal": false,
    "no-string-throw": true,
    "no-switch-case-fall-through": true,
    "no-trailing-whitespace": true,
    "no-unnecessary-initializer": true,
    "no-unused-expression": true,
    "no-use-before-declare": false,
    "no-var-keyword": true,
    "object-literal-sort-keys": false,
    "one-line": [
      true,
      "check-open-brace",
      "check-catch",
      "check-else",
      "check-whitespace"
    ],
    "prefer-const": true,
    "quotemark": [
      true,
      "single"
    ],
    "radix": true,
    "semicolon": [
      true,
      "always"
    ],
    "triple-equals": [
      true,
      "allow-null-check"
    ],
    "typedef-whitespace": [
      true,
      {
        "call-signature": "nospace",
        "index-signature": "nospace",
        "parameter": "nospace",
        "property-declaration": "nospace",
        "variable-declaration": "nospace"
      }
    ],
    "unified-signatures": true,
    "variable-name": false,
    "whitespace": [
      true,
      "check-branch",
      "check-decl",
      "check-operator",
      "check-separator",
      "check-type"
    ],
    "directive-selector": [
      true,
      "attribute",
      "app",
      "camelCase"
    ],
    "component-selector": [
      false,
      "element",
      "kebab-case"
    ],
    "use-input-property-decorator": true,
    "use-output-property-decorator": true,
    "use-host-property-decorator": true,
    "no-input-rename": true,
    "no-output-rename": true,
    "use-life-cycle-interface": true,
    "use-pipe-transform-interface": true,
    "component-class-suffix": true,
    "directive-class-suffix": true
  }
}

Actual behavior

[Info - 4:31:01 PM] Linter is running.
The 'quotemark' rule threw an error in '<<my .ts file>>':
SyntaxError: Invalid regular expression: /\)/: Unmatched ')'
at new RegExp ()
at cb (d:\authoring\angular\mysite epg\node_modules\tslint\lib\rules\quotemarkRule.js:106:33)
at visitNode (d:\authoring\angular\mysite epg\node_modules\typescript\lib\typescript.js:14800:24)
at Object.forEachChild (d:\authoring\angular\mysite epg\node_modules\typescript\lib\typescript.js:14978:24)
at cb (d:\authoring\angular\mysite epg\node_modules\tslint\lib\rules\quotemarkRule.js:109:12)
at visitNode (d:\authoring\angular\mysite epg\node_modules\typescript\lib\typescript.js:14800:24)
at Object.forEachChild (d:\authoring\angular\mysite epg\node_modules\typescript\lib\typescript.js:14985:24)
at cb (d:\authoring\angular\mysite epg\node_modules\tslint\lib\rules\quotemarkRule.js:109:12)
at visitNode (d:\authoring\angular\mysite epg\node_modules\typescript\lib\typescript.js:14800:24)
at Object.forEachChild (d:\authoring\angular\mysite epg\node_modules\typescript\lib\typescript.js:14978:24)
[Warn - 2:10:31 PM] The 'quotemark' rule threw an error in '<<my .ts file>>':
SyntaxError: Invalid regular expression: /\)/: Unmatched ')'
at new RegExp ()
at cb (d:\authoring\angular\mysite epg\node_modules\tslint\lib\rules\quotemarkRule.js:106:33)
at visitNode (d:\authoring\angular\mysite epg\node_modules\typescript\lib\typescript.js:14800:24)
at Object.forEachChild (d:\authoring\angular\mysite epg\node_modules\typescript\lib\typescript.js:14978:24)
at cb (d:\authoring\angular\mysite epg\node_modules\tslint\lib\rules\quotemarkRule.js:109:12)
at visitNode (d:\authoring\angular\mysite epg\node_modules\typescript\lib\typescript.js:14800:24)
at Object.forEachChild (d:\authoring\angular\mysite epg\node_modules\typescript\lib\typescript.js:14985:24)
at cb (d:\authoring\angular\mysite epg\node_modules\tslint\lib\rules\quotemarkRule.js:109:12)
at visitNode (d:\authoring\angular\mysite epg\node_modules\typescript\lib\typescript.js:14800:24)
at Object.forEachChild (d:\authoring\angular\mysite epg\node_modules\typescript\lib\typescript.js:14978:24)

Expected behavior

shouldn't throw
I have no idea what in my TS caused the problem.
npm start compiles ok without any warning/error.

@JoshuaKGoldberg
Copy link
Contributor

Invalid regular expression: /)/: Unmatched ')'

Well that's an odd one. I can't reproduce this locally. @alexfung888 could you please provide a source file that this bug shows up for? There's not much that can be done to help otherwise.

@alexfung888
Copy link
Author

alexfung888 commented Nov 6, 2018

It was so long ago. I thought the trace already had the information needed.

I rolled back my source to that time and branch, and rebuild node modules to that package.json and yarn.lock, but I cannot reproduce the error now.

Things not rolled back: Node (was 8 now 10), VSCode (I always upgrade when prompted, so cannot tell what version was then) and any VSCode extensions.

I guess it was complaining about these two lines, but they are no longer flagged now:

    const ep01 = /E0?0?1( |$)/;
    const ep01328 = /(^.*-E\d{4})-001/;

@JoshuaKGoldberg
Copy link
Contributor

Awesome, glad it's fixed! 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants