4.10.116 β€’ Published 2 months ago

@taktikorg/fugit-voluptatibus-quod v4.10.116

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Introduction

@taktikorg/fugit-voluptatibus-quod is ESLint plugin for finding RegExp mistakes and RegExp style guide violations.

NPM license NPM version NPM downloads NPM downloads NPM downloads NPM downloads NPM downloads Build Status Coverage Status

:name_badge: Features

This ESLint plugin provides linting rules relate to better ways to help you avoid problems when using RegExp.

  • Find the wrong usage of regular expressions, and their hints.
  • Enforces a consistent style of regular expressions.
  • Find hints for writing optimized regular expressions.
  • 80 plugin rules for regular expression syntax and features.

You can check on the Online DEMO.

:book: Documentation

See documents.

:cd: Installation

npm install --save-dev eslint @taktikorg/fugit-voluptatibus-quod

Requirements

  • ESLint v8.44.0 and above
  • Node.js v18.x, v20.x and above

:book: Usage

Add regexp to the plugins section of your eslint.config.js or .eslintrc configuration file (you can omit the eslint-plugin- prefix) and either use one of the two configurations available (recommended or all) or configure the rules you want:

The recommended configuration (New Config)

The plugin.configs["flat/recommended"] config enables a subset of the rules that should be most useful to most users. See lib/configs/rules/recommended.ts for more details.

// eslint.config.js
import * as regexpPlugin from "@taktikorg/fugit-voluptatibus-quod"

export default [
    regexpPlugin.configs["flat/recommended"],
];

The recommended configuration (Legacy Config)

The plugin:regexp/recommended config enables a subset of the rules that should be most useful to most users. See lib/configs/rules/recommended.ts for more details.

// .eslintrc.js
module.exports = {
    "plugins": [
        "regexp"
    ],
    "extends": [
         // add more generic rulesets here, such as:
         // 'eslint:recommended',
        "plugin:regexp/recommended"
    ]
}

Advanced Configuration

Override/add specific rules configurations. See also: http://eslint.org/docs/user-guide/configuring.

// eslint.config.js
import * as regexpPlugin from "@taktikorg/fugit-voluptatibus-quod"

export default [
    {
        plugins: { regexp: regexpPlugin }
        rules: {
            // Override/add rules settings here, such as:
            "regexp/rule-name": "error"
        }
    }
];
// .eslintrc.js
module.exports = {
    "plugins": [
        "regexp"
    ],
    "rules": {
        // Override/add rules settings here, such as:
        "regexp/rule-name": "error"
    }
}

Using the all configuration

The plugin.configs["flat/all"] / plugin:regexp/all config enables all rules. It's meant for testing, not for production use because it changes with every minor and major version of the plugin. Use it at your own risk. See lib/configs/rules/all.ts for more details.

:white_check_mark: Rules

πŸ’Ό Configurations enabled in.\ ⚠️ Configurations set to warn in.\ 🟒 Set in the flat/recommended configuration.\ πŸ”΅ Set in the recommended configuration.\ πŸ”§ Automatically fixable by the --fix CLI option.\ πŸ’‘ Manually fixable by editor suggestions.

Possible Errors

NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β DescriptionπŸ’Όβš οΈπŸ”§πŸ’‘
no-contradiction-with-assertiondisallow elements that contradict assertions🟒 πŸ”΅πŸ’‘
no-control-characterdisallow control charactersπŸ’‘
no-dupe-disjunctionsdisallow duplicate disjunctions🟒 πŸ”΅πŸ’‘
no-empty-alternativedisallow alternatives without elements🟒 πŸ”΅πŸ’‘
no-empty-capturing-groupdisallow capturing group that captures empty.🟒 πŸ”΅
no-empty-character-classdisallow character classes that match no characters🟒 πŸ”΅
no-empty-groupdisallow empty group🟒 πŸ”΅
no-empty-lookarounds-assertiondisallow empty lookahead assertion or empty lookbehind assertion🟒 πŸ”΅
no-escape-backspacedisallow escape backspace ([\b])🟒 πŸ”΅πŸ’‘
no-invalid-regexpdisallow invalid regular expression strings in RegExp constructors🟒 πŸ”΅
no-lazy-endsdisallow lazy quantifiers at the end of an expression🟒 πŸ”΅πŸ’‘
no-misleading-capturing-groupdisallow capturing groups that do not behave as one would expect🟒 πŸ”΅πŸ’‘
no-misleading-unicode-characterdisallow multi-code-point characters in character classes and quantifiers🟒 πŸ”΅πŸ”§πŸ’‘
no-missing-g-flagdisallow missing g flag in patterns used in String#matchAll and String#replaceAll🟒 πŸ”΅πŸ”§
no-optional-assertiondisallow optional assertions🟒 πŸ”΅
no-potentially-useless-backreferencedisallow backreferences that reference a group that might not be matched🟒 πŸ”΅
no-super-linear-backtrackingdisallow exponential and polynomial backtracking🟒 πŸ”΅πŸ”§
no-super-linear-movedisallow quantifiers that cause quadratic moves
no-useless-assertionsdisallow assertions that are known to always accept (or reject)🟒 πŸ”΅πŸ’‘
no-useless-backreferencedisallow useless backreferences in regular expressions🟒 πŸ”΅
no-useless-dollar-replacementsdisallow useless $ replacements in replacement string🟒 πŸ”΅
strictdisallow not strictly valid regular expressions🟒 πŸ”΅πŸ”§πŸ’‘

Best Practices

NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β DescriptionπŸ’Όβš οΈπŸ”§πŸ’‘
confusing-quantifierdisallow confusing quantifiers🟒 πŸ”΅
control-character-escapeenforce consistent escaping of control characters🟒 πŸ”΅πŸ”§
negationenforce use of escapes on negation🟒 πŸ”΅πŸ”§
no-dupe-characters-character-classdisallow duplicate characters in the RegExp character class🟒 πŸ”΅πŸ”§
no-empty-string-literaldisallow empty string literals in character classes🟒 πŸ”΅
no-extra-lookaround-assertionsdisallow unnecessary nested lookaround assertions🟒 πŸ”΅πŸ”§
no-invisible-characterdisallow invisible raw character🟒 πŸ”΅πŸ”§
no-legacy-featuresdisallow legacy RegExp features🟒 πŸ”΅
no-non-standard-flagdisallow non-standard flags🟒 πŸ”΅
no-obscure-rangedisallow obscure character ranges🟒 πŸ”΅
no-octaldisallow octal escape sequenceπŸ’‘
no-standalone-backslashdisallow standalone backslashes (\)
no-trivially-nested-assertiondisallow trivially nested assertions🟒 πŸ”΅πŸ”§
no-trivially-nested-quantifierdisallow nested quantifiers that can be rewritten as one quantifier🟒 πŸ”΅πŸ”§
no-unused-capturing-groupdisallow unused capturing group🟒 πŸ”΅πŸ”§πŸ’‘
no-useless-character-classdisallow character class with one character🟒 πŸ”΅πŸ”§
no-useless-flagdisallow unnecessary regex flags🟒 πŸ”΅πŸ”§
no-useless-lazydisallow unnecessarily non-greedy quantifiers🟒 πŸ”΅πŸ”§
no-useless-quantifierdisallow quantifiers that can be removed🟒 πŸ”΅πŸ”§πŸ’‘
no-useless-rangedisallow unnecessary character ranges🟒 πŸ”΅πŸ”§
no-useless-set-operanddisallow unnecessary elements in expression character classes🟒 πŸ”΅πŸ”§
no-useless-string-literaldisallow string disjunction of single characters in \q{...}🟒 πŸ”΅πŸ”§
no-useless-two-nums-quantifierdisallow unnecessary {n,m} quantifier🟒 πŸ”΅πŸ”§
no-zero-quantifierdisallow quantifiers with a maximum of zero🟒 πŸ”΅πŸ’‘
optimal-lookaround-quantifierdisallow the alternatives of lookarounds that end with a non-constant quantifier🟒 πŸ”΅πŸ’‘
optimal-quantifier-concatenationrequire optimal quantifiers for concatenated quantifiers🟒 πŸ”΅πŸ”§
prefer-escape-replacement-dollar-charenforces escape of replacement $ character ($$).
prefer-predefined-assertionprefer predefined assertion over equivalent lookarounds🟒 πŸ”΅πŸ”§
prefer-quantifierenforce using quantifierπŸ”§
prefer-rangeenforce using character class range🟒 πŸ”΅πŸ”§
prefer-regexp-execenforce that RegExp#exec is used instead of String#match if no global flag is provided
prefer-regexp-testenforce that RegExp#test is used instead of String#match and RegExp#execπŸ”§
prefer-set-operationprefer character class set operations instead of lookarounds🟒 πŸ”΅πŸ”§
require-unicode-regexpenforce the use of the u flagπŸ”§
require-unicode-sets-regexpenforce the use of the v flagπŸ”§
simplify-set-operationsrequire simplify set operations🟒 πŸ”΅πŸ”§
sort-alternativessort alternatives if order doesn't matterπŸ”§
use-ignore-caseuse the i flag if it simplifies the pattern🟒 πŸ”΅πŸ”§

Stylistic Issues

NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β DescriptionπŸ’Όβš οΈπŸ”§πŸ’‘
grapheme-string-literalenforce single grapheme in string literal
hexadecimal-escapeenforce consistent usage of hexadecimal escapeπŸ”§
letter-caseenforce into your favorite caseπŸ”§
match-anyenforce match any character style🟒 πŸ”΅πŸ”§
no-useless-escapedisallow unnecessary escape characters in RegExp🟒 πŸ”΅πŸ”§
no-useless-non-capturing-groupdisallow unnecessary non-capturing group🟒 πŸ”΅πŸ”§
prefer-character-classenforce using character class🟒 πŸ”΅πŸ”§
prefer-denforce using \d🟒 πŸ”΅πŸ”§
prefer-lookaroundprefer lookarounds over capturing group that do not replaceπŸ”§
prefer-named-backreferenceenforce using named backreferencesπŸ”§
prefer-named-capture-groupenforce using named capture groups
prefer-named-replacementenforce using named replacementπŸ”§
prefer-plus-quantifierenforce using + quantifier🟒 πŸ”΅πŸ”§
prefer-question-quantifierenforce using ? quantifier🟒 πŸ”΅πŸ”§
prefer-result-array-groupsenforce using result array groupsπŸ”§
prefer-star-quantifierenforce using * quantifier🟒 πŸ”΅πŸ”§
prefer-unicode-codepoint-escapesenforce use of unicode codepoint escapes🟒 πŸ”΅πŸ”§
prefer-wenforce using \w🟒 πŸ”΅πŸ”§
sort-character-class-elementsenforces elements order in character classπŸ”§
sort-flagsrequire regex flags to be sorted🟒 πŸ”΅πŸ”§
unicode-escapeenforce consistent usage of unicode escape or unicode codepoint escapeπŸ”§
unicode-propertyenforce consistent naming of unicode propertiesπŸ”§

Removed

  • :no_entry: These rules have been removed in a previous major release, after they have been deprecated for a while.
Rule IDReplaced byRemoved in version
no-assertion-capturing-groupregexp/no-empty-capturing-groupv2.0.0
no-useless-exactly-quantifierregexp/no-useless-quantifier, regexp/no-zero-quantifierv2.0.0
no-useless-non-greedyregexp/no-useless-lazyv2.0.0
order-in-character-classregexp/sort-character-class-elementsv2.0.0
prefer-tregexp/control-character-escapev2.0.0

:gear: Settings

See Settings.

:traffic_light: Semantic Versioning Policy

@taktikorg/fugit-voluptatibus-quod follows Semantic Versioning and ESLint's Semantic Versioning Policy.

:beers: Contributing

Welcome contributing!

Please use GitHub's Issues/PRs.

See CONTRIBUTING.md.

Development Tools

  • npm test runs tests and measures coverage.
  • npm run update runs in order to update readme and recommended configuration.
  • npm run new [new rule name] runs to create the files needed for the new rule.
  • npm run docs:watch starts the website locally.

:lock: License

See the LICENSE file for license rights and limitations (MIT).

@taktikorg/ab-laudantium@taktikorg/accusantium-cum@taktikorg/ad-id@taktikorg/accusamus-quod-debitis@taktikorg/accusantium-possimus@taktikorg/adipisci-quia@taktikorg/ad-ipsa@taktikorg/asperiores-distinctio@taktikorg/asperiores-doloribus@taktikorg/ab-deserunt@taktikorg/alias-asperiores-non@taktikorg/aliquid-rerum-voluptate@taktikorg/alias-suscipit@taktikorg/architecto-nobis@taktikorg/aperiam-iure@taktikorg/amet-dolore-eius@taktikorg/amet-odio@taktikorg/animi-nihil@taktikorg/aperiam-dolores-dolor@taktikorg/amet-hic-culpa@taktikorg/atque-repudiandae@taktikorg/atque-tempore-provident@taktikorg/aspernatur-dolorem@taktikorg/saepe-culpa-pariatur@taktikorg/rerum-quod@taktikorg/sapiente-officiis@taktikorg/soluta-dolores-exercitationem@taktikorg/sunt-nulla-ad@taktikorg/sunt-velit@taktikorg/tenetur-et-modi@taktikorg/tenetur-incidunt-minus@taktikorg/vel-illo@taktikorg/vel-deleniti@taktikorg/voluptate-vitae-aspernatur@taktikorg/sapiente-cupiditate@taktikorg/similique-adipisci@taktikorg/similique-porro-et@taktikorg/sit-maiores@taktikorg/sit-ut@taktikorg/sint-sequi-velit@taktikorg/temporibus-iure@taktikorg/vel-nihil-aliquam@taktikorg/sed-cupiditate-vero@taktikorg/suscipit-nesciunt-itaque@taktikorg/tempore-occaecati@taktikorg/veritatis-laboriosam@taktikorg/velit-perspiciatis@taktikorg/vitae-a@taktikorg/veritatis-officia@taktikorg/voluptatibus-error@taktikorg/voluptatem-nostrum@taktikorg/voluptatibus-dolor@taktikorg/voluptates-quo@taktikorg/voluptatem-nesciunt@taktikorg/dolorem-ducimus@taktikorg/dolores-recusandae-excepturi@taktikorg/dolores-totam@taktikorg/doloribus-quos@taktikorg/dolorum-assumenda@taktikorg/esse-totam@taktikorg/esse-nihil@taktikorg/eum-debitis-fugiat@taktikorg/eveniet-ipsum@taktikorg/facilis-itaque-ut@taktikorg/facere-nemo-enim@taktikorg/fuga-inventore@taktikorg/illo-excepturi-at@taktikorg/natus-enim-non@taktikorg/nemo-magnam@taktikorg/necessitatibus-sunt@taktikorg/natus-fugit@taktikorg/natus-officiis@taktikorg/nihil-itaque-nesciunt@taktikorg/quae-dolorem-eum@taktikorg/quae-ab@taktikorg/quaerat-nulla-nesciunt@taktikorg/quas-eveniet-explicabo@taktikorg/quisquam-temporibus@taktikorg/cumque-repudiandae-veritatis@taktikorg/eos-iure@taktikorg/eos-asperiores@taktikorg/exercitationem-quae-recusandae@taktikorg/expedita-assumenda-temporibus@taktikorg/expedita-corporis@taktikorg/excepturi-neque@taktikorg/exercitationem-deserunt@taktikorg/ex-voluptatibus@taktikorg/id-adipisci@taktikorg/harum-reprehenderit-perferendis@taktikorg/hic-officia@taktikorg/harum-eum@taktikorg/illum-molestiae-placeat@taktikorg/ipsum-magni@taktikorg/ipsum-aperiam@taktikorg/iste-doloremque-a@taktikorg/ipsa-voluptatibus@taktikorg/perspiciatis-iste@taktikorg/qui-tempore@taktikorg/quia-beatae-ut@taktikorg/quia-molestias
4.7.96

3 months ago

4.7.97

3 months ago

4.9.108

3 months ago

4.9.109

3 months ago

4.7.98

3 months ago

3.5.94

3 months ago

3.5.93

3 months ago

3.5.92

3 months ago

3.5.91

3 months ago

3.5.90

3 months ago

4.9.113

3 months ago

3.5.25

6 months ago

4.9.114

2 months ago

3.5.24

6 months ago

4.9.115

2 months ago

3.5.23

6 months ago

4.9.110

3 months ago

4.9.111

3 months ago

4.9.112

3 months ago

3.5.29

5 months ago

3.5.28

6 months ago

3.5.27

6 months ago

3.5.26

6 months ago

3.5.79

4 months ago

3.5.78

4 months ago

3.5.77

4 months ago

3.5.76

4 months ago

3.5.75

4 months ago

3.5.74

4 months ago

3.5.73

4 months ago

4.10.115

2 months ago

4.5.94

3 months ago

4.10.116

2 months ago

4.5.95

3 months ago

2.4.14

6 months ago

2.4.13

6 months ago

2.4.15

6 months ago

3.5.72

4 months ago

3.5.71

4 months ago

3.5.70

4 months ago

2.4.12

6 months ago

3.5.89

3 months ago

3.5.88

4 months ago

3.5.87

4 months ago

3.5.86

4 months ago

3.5.85

4 months ago

3.5.84

4 months ago

3.5.83

4 months ago

3.5.82

4 months ago

3.5.81

4 months ago

3.5.80

4 months ago

3.5.58

5 months ago

3.5.57

5 months ago

3.5.56

5 months ago

3.5.55

5 months ago

3.5.54

5 months ago

3.5.53

5 months ago

3.5.52

5 months ago

3.5.51

5 months ago

3.5.59

4 months ago

4.8.101

3 months ago

4.8.102

3 months ago

4.8.100

3 months ago

4.8.105

3 months ago

4.8.106

3 months ago

4.8.103

3 months ago

4.8.104

3 months ago

3.5.50

5 months ago

4.8.107

3 months ago

4.8.108

3 months ago

3.5.69

4 months ago

3.5.68

4 months ago

3.5.67

4 months ago

3.5.66

4 months ago

3.5.65

4 months ago

3.5.64

4 months ago

3.5.63

4 months ago

3.5.62

4 months ago

4.8.98

3 months ago

2.5.18

6 months ago

4.8.99

3 months ago

2.5.19

6 months ago

2.5.15

6 months ago

2.5.16

6 months ago

2.5.17

6 months ago

3.5.61

4 months ago

3.5.60

4 months ago

3.5.36

5 months ago

3.5.35

5 months ago

3.5.34

5 months ago

3.5.33

5 months ago

3.5.32

5 months ago

3.5.31

5 months ago

3.5.30

5 months ago

3.5.39

5 months ago

3.5.38

5 months ago

3.5.37

5 months ago

2.5.21

6 months ago

2.5.22

6 months ago

2.5.23

6 months ago

2.5.20

6 months ago

3.5.47

5 months ago

3.5.46

5 months ago

3.5.45

5 months ago

3.5.44

5 months ago

3.5.43

5 months ago

3.5.42

5 months ago

3.5.41

5 months ago

3.5.40

5 months ago

4.6.95

3 months ago

4.6.96

3 months ago

3.5.49

5 months ago

3.5.48

5 months ago

2.3.12

6 months ago

2.3.11

6 months ago

2.3.9

6 months ago

1.3.9

6 months ago

1.2.9

6 months ago

2.3.10

6 months ago

1.2.8

6 months ago

1.1.8

6 months ago

1.1.7

6 months ago

1.1.6

6 months ago

1.1.5

6 months ago

1.1.4

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.0

7 months ago