File tree Expand file tree Collapse file tree 5 files changed +6
-16
lines changed Expand file tree Collapse file tree 5 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -91,8 +91,8 @@ The rules with the following star :star: are included in the `plugin:regexp/reco
91
91
| [ regexp/no-useless-backreference] ( https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-backreference.html ) | disallow useless backreferences in regular expressions | |
92
92
| [ regexp/no-useless-character-class] ( https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-character-class.html ) | disallow character class with one character | :wrench : |
93
93
| [ regexp/no-useless-exactly-quantifier] ( https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-exactly-quantifier.html ) | disallow unnecessary exactly quantifier | :star : |
94
- | [ regexp/no-useless-range] ( https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-range.html ) | disallow unnecessary range of characters by using a hyphen | :wrench : |
95
94
| [ regexp/no-useless-non-greedy] ( https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-non-greedy.html ) | disallow unnecessary quantifier non-greedy (` ? ` ) | :wrench : |
95
+ | [ regexp/no-useless-range] ( https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-range.html ) | disallow unnecessary range of characters by using a hyphen | :wrench : |
96
96
| [ regexp/no-useless-two-nums-quantifier] ( https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-useless-two-nums-quantifier.html ) | disallow unnecessary ` {n,m} ` quantifier | :star : |
97
97
| [ regexp/prefer-d] ( https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-d.html ) | enforce using ` \d ` | :star ::wrench : |
98
98
| [ regexp/prefer-plus-quantifier] ( https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-plus-quantifier.html ) | enforce using ` + ` quantifier | :star ::wrench : |
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ The rules with the following star :star: are included in the `plugin:regexp/reco
23
23
| [ regexp/no-useless-backreference] ( ./no-useless-backreference.md ) | disallow useless backreferences in regular expressions | |
24
24
| [ regexp/no-useless-character-class] ( ./no-useless-character-class.md ) | disallow character class with one character | :wrench : |
25
25
| [ regexp/no-useless-exactly-quantifier] ( ./no-useless-exactly-quantifier.md ) | disallow unnecessary exactly quantifier | :star : |
26
- | [ regexp/no-useless-range] ( ./no-useless-range.md ) | disallow unnecessary range of characters by using a hyphen | :wrench : |
27
26
| [ regexp/no-useless-non-greedy] ( ./no-useless-non-greedy.md ) | disallow unnecessary quantifier non-greedy (` ? ` ) | :wrench : |
27
+ | [ regexp/no-useless-range] ( ./no-useless-range.md ) | disallow unnecessary range of characters by using a hyphen | :wrench : |
28
28
| [ regexp/no-useless-two-nums-quantifier] ( ./no-useless-two-nums-quantifier.md ) | disallow unnecessary ` {n,m} ` quantifier | :star : |
29
29
| [ regexp/prefer-d] ( ./prefer-d.md ) | enforce using ` \d ` | :star ::wrench : |
30
30
| [ regexp/prefer-plus-quantifier] ( ./prefer-plus-quantifier.md ) | enforce using ` + ` quantifier | :star ::wrench : |
Original file line number Diff line number Diff line change @@ -4,16 +4,6 @@ sidebarDepth: 0
4
4
title : " regexp/prefer-regexp-exec"
5
5
description : " enforce that `RegExp#exec` is used instead of `String#match` if no global flag is provided"
6
6
---
7
- ---
8
- pageClass: "rule-details"
9
- sidebarDepth: 0
10
- title: "regexp/prefer-regexp-exec"
11
- description: "enforce that `RegExp# regexp/prefer-regexp-exec
12
-
13
- > enforce that ` RegExp#exec ` is used instead of ` String#match ` if no global flag is provided
14
-
15
- - :exclamation : <badge text =" This rule has not been released yet. " vertical =" middle " type =" error " > *** This rule has not been released yet.*** </badge >
16
-
17
7
# regexp/prefer-regexp-exec
18
8
19
9
> enforce that ` RegExp#exec ` is used instead of ` String#match ` if no global flag is provided
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ import noOctal from "../rules/no-octal"
11
11
import noUselessBackreference from "../rules/no-useless-backreference"
12
12
import noUselessCharacterClass from "../rules/no-useless-character-class"
13
13
import noUselessExactlyQuantifier from "../rules/no-useless-exactly-quantifier"
14
- import noUselessRange from "../rules/no-useless-range"
15
14
import noUselessNonGreedy from "../rules/no-useless-non-greedy"
15
+ import noUselessRange from "../rules/no-useless-range"
16
16
import noUselessTwoNumsQuantifier from "../rules/no-useless-two-nums-quantifier"
17
17
import preferD from "../rules/prefer-d"
18
18
import preferPlusQuantifier from "../rules/prefer-plus-quantifier"
@@ -38,8 +38,8 @@ export const rules = [
38
38
noUselessBackreference ,
39
39
noUselessCharacterClass ,
40
40
noUselessExactlyQuantifier ,
41
- noUselessRange ,
42
41
noUselessNonGreedy ,
42
+ noUselessRange ,
43
43
noUselessTwoNumsQuantifier ,
44
44
preferD ,
45
45
preferPlusQuantifier ,
Original file line number Diff line number Diff line change @@ -107,9 +107,9 @@ class DocFile {
107
107
notes . push ( "" , "" )
108
108
}
109
109
110
- const headerPattern = / # .+ \n + [ ^ \n ] * \n + (?: - .+ \n + ) * \n * / u
110
+ const headerPattern = / (?: ^ | \n ) # .+ \n + [ ^ \n ] * \n + (?: - .+ \n + ) * \n * / u
111
111
112
- const header = `${ title } \n\n${ notes . join ( "\n" ) } `
112
+ const header = `\n ${ title } \n\n${ notes . join ( "\n" ) } `
113
113
if ( headerPattern . test ( this . content ) ) {
114
114
this . content = this . content . replace ( headerPattern , header )
115
115
} else {
You can’t perform that action at this time.
0 commit comments