Skip to content

no-dupe-characters-character-class: Incompatible flags: The i flag is forbidden to create a literal but required by the options. #189

@AriPerkkio

Description

@AriPerkkio

Hello, no-dupe-characters-character-class rule seems to crash in certain cases. This issue was spotted by automated CI run - it is not blocking my development or anything. https://github.com/AriPerkkio/eslint-remote-tester/actions/runs/795820693

"eslint-plugin-regexp": "^0.9.0",
{
  "root": true,
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 2020,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true
    }
  },
  "plugins": ["regexp"],
  "rules": {
    "regexp/no-dupe-characters-character-class": "error"
  }
}

Minimal repro:

new RegExp(`[^\\w\\s\u00C0-\u00F6\u00F8-\u017E]`, "gi");
Error: Incompatible flags: The i flag is forbidden to create a literal but required by the options.
Occurred while linting <text>:1
    at fl (/home/<removed>/eslint-remote-tester/ci/node_modules/refa/index.js:1:715985)
    at Object.toLiteral (/home/<removed>/eslint-remote-tester/ci/node_modules/refa/index.js:1:733343)
    at Object.toCharSetSource (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:487:22)

Crash reports from real projects

Rule: no-dupe-characters-character-class

  • Message: Incompatible flags: The i flag is forbidden to create a literal but required by the options. Occurred while linting <text>:72
  • Path: aws/aws-northstar/src/components/FormRenderer/index.stories.tsx
  • Link
  70 |                     type: validatorTypes.PATTERN,
  71 |                     message: 'Invalid email address',
> 72 |                     pattern: /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i,
  73 |                 },
  74 |             ],
  75 |         },
Error: Incompatible flags: The i flag is forbidden to create a literal but required by the options.
Occurred while linting <text>:72
    at fl (/home/<removed>/eslint-remote-tester/ci/node_modules/refa/index.js:1:715985)
    at Object.toLiteral (/home/<removed>/eslint-remote-tester/ci/node_modules/refa/index.js:1:733343)
    at Object.toCharSetSource (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:487:22)
    at reportIntersect (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/rules/no-dupe-characters-character-class.js:89:47)
    at onCharacterClassEnter (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/rules/no-dupe-characters-character-class.js:177:37)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:105:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)

Rule: no-dupe-characters-character-class

  • Message: Incompatible flags: The i flag is forbidden to create a literal but required by the options. Occurred while linting <text>:1
  • Path: IBMStreams/vscode-ide/src/webviews/cloudPakForDataJob/resources/utils.js
  • Link
> 1 | const JOB_NAME_MAX_LENGTH = 100;
  2 | const JOB_DESCRIPTION_MAX_LENGTH = 300;
  3 | const STREAMS_JOB_NAME_MAX_LENGTH = 1024;
  4 | const STREAMS_JOB_NAME_REGEX = new RegExp(
Error: Incompatible flags: The i flag is forbidden to create a literal but required by the options.
Occurred while linting <text>:1
    at fl (/home/<removed>/eslint-remote-tester/ci/node_modules/refa/index.js:1:715985)
    at Object.toLiteral (/home/<removed>/eslint-remote-tester/ci/node_modules/refa/index.js:1:733343)
    at Object.toCharSetSource (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:487:22)
    at reportIntersect (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/rules/no-dupe-characters-character-class.js:89:47)
    at onCharacterClassEnter (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/rules/no-dupe-characters-character-class.js:177:37)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:105:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)

Rule: no-dupe-characters-character-class

  • Message: Incompatible flags: The i flag is forbidden to create a literal but required by the options. Occurred while linting <text>:2
  • Path: kmjennison/react-sparkle/docs/component---src-pages-index-js-1209acb7120be946afae.js
  • Link
  1 | /*! For license information please see component---src-pages-index-js-1209acb7120be946afae.js.LICENSE.txt */
> 2 | (window.webpackJsonp=window.webpackJsonp||[]).push([[3],{"++L3":function(e,t,n){"...
  3 | //# sourceMappingURL=component---src-pages-index-js-1209acb7120be946afae.js.map
Error: Incompatible flags: The i flag is forbidden to create a literal but required by the options.
Occurred while linting <text>:2
    at fl (/home/<removed>/eslint-remote-tester/ci/node_modules/refa/index.js:1:715985)
    at Object.toLiteral (/home/<removed>/eslint-remote-tester/ci/node_modules/refa/index.js:1:733343)
    at Object.toCharSetSource (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:487:22)
    at reportIntersect (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/rules/no-dupe-characters-character-class.js:89:47)
    at onCharacterClassEnter (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/rules/no-dupe-characters-character-class.js:177:37)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:105:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)

Rule: no-dupe-characters-character-class

  • Message: Incompatible flags: The i flag is forbidden to create a literal but required by the options. Occurred while linting <text>:2
  • Path: kmjennison/react-sparkle/docs/component---src-pages-index-js-1d4c46f63ded03d7f5e1.js
  • Link
  1 | /*! For license information please see component---src-pages-index-js-1d4c46f63ded03d7f5e1.js.LICENSE.txt */
> 2 | (window.webpackJsonp=window.webpackJsonp||[]).push([[3],{"++L3":function(e,t,n){"use strict";...
  3 | //# sourceMappingURL=component---src-pages-index-js-1d4c46f63ded03d7f5e1.js.map
Error: Incompatible flags: The i flag is forbidden to create a literal but required by the options.
Occurred while linting <text>:2
    at fl (/home/<removed>/eslint-remote-tester/ci/node_modules/refa/index.js:1:715985)
    at Object.toLiteral (/home/<removed>/eslint-remote-tester/ci/node_modules/refa/index.js:1:733343)
    at Object.toCharSetSource (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:487:22)
    at reportIntersect (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/rules/no-dupe-characters-character-class.js:89:47)
    at onCharacterClassEnter (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/rules/no-dupe-characters-character-class.js:177:37)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:105:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)

Rule: no-dupe-characters-character-class

  • Message: Incompatible flags: The i flag is forbidden to create a literal but required by the options. Occurred while linting <text>:2
  • Path: kmjennison/react-sparkle/docs/component---src-pages-index-js-fda99f169ba46368955c.js
  • Link
  1 | /*! For license information please see component---src-pages-index-js-fda99f169ba46368955c.js.LICENSE.txt */
> 2 | (window.webpackJsonp=window.webpackJsonp||[]).push([[3],{"++L3":function(e,t,n){"use strict";var a=n("VOTz"),r=n(...
  3 | //# sourceMappingURL=component---src-pages-index-js-fda99f169ba46368955c.js.map
Error: Incompatible flags: The i flag is forbidden to create a literal but required by the options.
Occurred while linting <text>:2
    at fl (/home/<removed>/eslint-remote-tester/ci/node_modules/refa/index.js:1:715985)
    at Object.toLiteral (/home/<removed>/eslint-remote-tester/ci/node_modules/refa/index.js:1:733343)
    at Object.toCharSetSource (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:487:22)
    at reportIntersect (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/rules/no-dupe-characters-character-class.js:89:47)
    at onCharacterClassEnter (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/rules/no-dupe-characters-character-class.js:177:37)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:105:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)
    at handler.<computed> (/home/<removed>/eslint-remote-tester/ci/node_modules/eslint-plugin-regexp/dist/utils/index.js:104:25)

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions