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

ESLint: Added regexp/strict rule #2944

Merged
merged 4 commits into from
Jun 27, 2021

Conversation

RunDevelopment
Copy link
Member

This will disallow regexes with parsing ambiguities.

The ECMAScript specification has a whole chapter on how regex parsing ambiguities are to be resolved. In practice, this means that we might not be required to escape some source characters (e.g. ], {) even though it would improve readability. Parsing without ambiguity is also required to utilize newer regex features like named capturing groups and the Unicode flag.

Adding this rule has two main advantages:

  1. Consistent escaping: Source characters (e.g. \[) will always be escaped and non-source characters (e.g. =) are forbidden to be escaped.
  2. Forward compatibility: We can just use new regex features if we even want to without having to worry.

Consistent escaping is really nice for code review because a lot of people do unnecessary escaping.

@github-actions
Copy link

github-actions bot commented Jun 13, 2021

JS File Size Changes (gzipped)

A total of 46 files have changed, with a combined diff of +24 B (+0.0%).

file master pull size diff % diff
components/prism-aql.min.js 626 B 627 B +1 B +0.2%
components/prism-cfscript.min.js 699 B 698 B -1 B -0.1%
components/prism-clojure.min.js 1.4 KB 1.4 KB -1 B -0.1%
components/prism-cmake.min.js 4.1 KB 4.1 KB 0 Bytes 0%
components/prism-concurnas.min.js 892 B 893 B +1 B +0.1%
components/prism-dataweave.min.js 508 B 508 B 0 Bytes 0%
components/prism-django.min.js 566 B 571 B +5 B +0.9%
components/prism-editorconfig.min.js 235 B 236 B +1 B +0.4%
components/prism-elm.min.js 596 B 597 B +1 B +0.2%
components/prism-gherkin.min.js 5.16 KB 5.16 KB -1 B -0.0%
components/prism-graphql.min.js 1.14 KB 1.14 KB 0 Bytes 0%
components/prism-haskell.min.js 1.5 KB 1.5 KB +1 B +0.1%
components/prism-hcl.min.js 582 B 585 B +3 B +0.5%
components/prism-idris.min.js 377 B 378 B +1 B +0.3%
components/prism-iecst.min.js 849 B 848 B -1 B -0.1%
components/prism-java.min.js 991 B 989 B -2 B -0.2%
components/prism-javascript.min.js 1.49 KB 1.5 KB +5 B +0.3%
components/prism-javastacktrace.min.js 613 B 612 B -1 B -0.2%
components/prism-jsdoc.min.js 643 B 647 B +4 B +0.6%
components/prism-jsstacktrace.min.js 412 B 411 B -1 B -0.2%
components/prism-jsx.min.js 961 B 962 B +1 B +0.1%
components/prism-markup.min.js 1.03 KB 1.03 KB -2 B -0.2%
components/prism-neon.min.js 476 B 475 B -1 B -0.2%
components/prism-nevod.min.js 730 B 730 B 0 Bytes 0%
components/prism-nsis.min.js 2.02 KB 2.02 KB -2 B -0.1%
components/prism-php.min.js 1.96 KB 1.96 KB +1 B +0.1%
components/prism-powershell.min.js 1.25 KB 1.25 KB -1 B -0.1%
components/prism-pug.min.js 950 B 950 B 0 Bytes 0%
components/prism-pure.min.js 1.68 KB 1.68 KB +1 B +0.1%
components/prism-python.min.js 1.04 KB 1.05 KB +4 B +0.4%
components/prism-qsharp.min.js 1.01 KB 1.01 KB +1 B +0.1%
components/prism-regex.min.js 597 B 598 B +1 B +0.2%
components/prism-sas.min.js 3.01 KB 3.01 KB -2 B -0.1%
components/prism-soy.min.js 798 B 801 B +3 B +0.4%
components/prism-stylus.min.js 1.61 KB 1.61 KB 0 Bytes 0%
components/prism-tcl.min.js 850 B 852 B +2 B +0.2%
components/prism-tt2.min.js 641 B 640 B -1 B -0.2%
components/prism-typoscript.min.js 708 B 710 B +2 B +0.3%
components/prism-v.min.js 975 B 971 B -4 B -0.4%
components/prism-vala.min.js 985 B 986 B +1 B +0.1%
components/prism-velocity.min.js 560 B 564 B +4 B +0.7%
components/prism-wolfram.min.js 534 B 530 B -4 B -0.7%
components/prism-xeora.min.js 563 B 564 B +1 B +0.2%
components/prism-xquery.min.js 1.66 KB 1.66 KB +1 B +0.1%
components/prism-yaml.min.js 853 B 856 B +3 B +0.4%
plugins/autolinker/prism-autolinker.min.js 595 B 595 B 0 Bytes 0%

Generated by 🚫 dangerJS against bdb5d19

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

Successfully merging this pull request may close these issues.

1 participant