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

Invalid regular expression in quotemarkRule.js #3073

Closed
reod opened this issue Jul 25, 2017 · 3 comments
Closed

Invalid regular expression in quotemarkRule.js #3073

reod opened this issue Jul 25, 2017 · 3 comments

Comments

@reod
Copy link

reod commented Jul 25, 2017

Bug Report

  • TSLint version: 5.5.0
  • TypeScript version: 2.4.2
  • Running TSLint via: CLI

When I'm executing npx tslint -c tslint.json 'src/**/*.ts I'm getting error:

SyntaxError: Invalid regular expression: /\\)/: Unmatched ')'
    at RegExp (<anonymous>)
    at cb (/Users/someusername/Documents/fun/i18n-manager/node_modules/tslint/lib/rules/quotemarkRule.js:116:33)
    at visitEachNode (/Users/someusername/Documents/fun/i18n-manager/node_modules/typescript/lib/typescript.js:15956:30)
    at Object.forEachChild (/Users/someusername/Documents/fun/i18n-manager/node_modules/typescript/lib/typescript.js:16089:21)
    at cb (/Users/someusername/Documents/fun/i18n-manager/node_modules/tslint/lib/rules/quotemarkRule.js:119:12)
    at visitEachNode (/Users/someusername/Documents/fun/i18n-manager/node_modules/typescript/lib/typescript.js:15956:30)
    at Object.forEachChild (/Users/someusername/Documents/fun/i18n-manager/node_modules/typescript/lib/typescript.js:16089:21)
    at cb (/Users/someusername/Documents/fun/i18n-manager/node_modules/tslint/lib/rules/quotemarkRule.js:119:12)
    at visitNode (/Users/someusername/Documents/fun/i18n-manager/node_modules/typescript/lib/typescript.js:15944:20)
    at Object.forEachChild (/Users/someusername/Documents/fun/i18n-manager/node_modules/typescript/lib/typescript.js:16145:24)

with tslint.json configuration:

{
  "defaultSeverity": "error",
  "extends": ["tslint:recommended", "tslint-eslint-rules"],
  "jsRules": {},
  "rules": {
    "quotemark": [true, "single"],
    "no-empty-interface": false,
    "no-console": [false],
    "no-consecutive-blank-lines": false,
    "ordered-imports": [false],
    "arrow-parens": false,
    "trailing-comma": [false],
    "member-access": [false],
    "object-literal-sort-keys": [false],
    "align": [false],
    "member-ordering": [false],
    "interface-name": [false]
  },
  "rulesDirectory": []
}

Actual behavior

Syntax error.

Expected behavior

Should not throw error.

@IllusionMH
Copy link
Contributor

@reod it can be reproduced now in i18n-manager repo (from your github profile)?

@reod
Copy link
Author

reod commented Aug 2, 2017

@IllusionMH actually this issue disappeared magically during development and now even I can't reproduce it. Feel free to close my report.

@mjomble
Copy link

mjomble commented Sep 10, 2018

I found a minimal reproducible case for this error:

test.ts:

('a)

tslint.json:

{ "rules": { "quotemark": true } }

Running tslint test.ts (using TSLint 5.11.0) gives:

The 'quotemark' rule threw an error in 'test.ts':
SyntaxError: Invalid regular expression: /\\)/: Unmatched ')'
...

Should I create a new issue or will we reopen this one?

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

4 participants