File tree Expand file tree Collapse file tree 9 files changed +22
-8
lines changed Expand file tree Collapse file tree 9 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ module.exports = {
22
22
description : "requires a `eslint-enable` comment for every `eslint-disable` comment" ,
23
23
category : "Best Practices" ,
24
24
recommended : true ,
25
- url : "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/ disable-enable-pair.md" ,
25
+ url : utils . getDocsUrl ( " disable-enable-pair" ) ,
26
26
} ,
27
27
fixable : false ,
28
28
schema : [ {
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ module.exports = {
51
51
description : "disallows `eslint-enable` comments for multiple `eslint-disable` comments" ,
52
52
category : "Best Practices" ,
53
53
recommended : true ,
54
- url : "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/ no-aggregating-enable.md" ,
54
+ url : utils . getDocsUrl ( " no-aggregating-enable" ) ,
55
55
} ,
56
56
fixable : false ,
57
57
schema : [ ] ,
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ module.exports = {
22
22
description : "disallows duplicate `eslint-disable` comments" ,
23
23
category : "Best Practices" ,
24
24
recommended : true ,
25
- url : "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/ no-duplicate-disable.md" ,
25
+ url : utils . getDocsUrl ( " no-duplicate-disable" ) ,
26
26
} ,
27
27
fixable : false ,
28
28
schema : [ ] ,
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ module.exports = {
58
58
description : "disallows `eslint-disable` comments about specific rules" ,
59
59
category : "Stylistic Issues" ,
60
60
recommended : false ,
61
- url : "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/ no-restricted-disable.md" ,
61
+ url : utils . getDocsUrl ( " no-restricted-disable" ) ,
62
62
} ,
63
63
fixable : false ,
64
64
schema : {
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ module.exports = {
30
30
description : "disallows `eslint-disable` comments without rule names" ,
31
31
category : "Best Practices" ,
32
32
recommended : true ,
33
- url : "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/ no-unlimited-disable.md" ,
33
+ url : utils . getDocsUrl ( " no-unlimited-disable" ) ,
34
34
} ,
35
35
fixable : false ,
36
36
schema : [ ] ,
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ module.exports = {
22
22
description : "disallows unused `eslint-disable` comments" ,
23
23
category : "Best Practices" ,
24
24
recommended : true ,
25
- url : "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/ no-unused-disable.md" ,
25
+ url : utils . getDocsUrl ( " no-unused-disable" ) ,
26
26
} ,
27
27
fixable : false ,
28
28
schema : [ ] ,
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ module.exports = {
22
22
description : "disallows unused `eslint-enable` comments" ,
23
23
category : "Best Practices" ,
24
24
recommended : true ,
25
- url : "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/ no-unused-enable.md" ,
25
+ url : utils . getDocsUrl ( " no-unused-enable" ) ,
26
26
} ,
27
27
fixable : false ,
28
28
schema : [ ] ,
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ module.exports = {
30
30
description : "disallows ESLint directive-comments" ,
31
31
category : "Stylistic Issues" ,
32
32
recommended : false ,
33
- url : "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/ no-use.md" ,
33
+ url : utils . getDocsUrl ( " no-use" ) ,
34
34
} ,
35
35
fixable : false ,
36
36
schema : [ {
Original file line number Diff line number Diff line change 10
10
//------------------------------------------------------------------------------
11
11
12
12
const escapeStringRegexp = require ( "escape-string-regexp" )
13
+ const pkg = require ( "../package" )
13
14
14
15
//------------------------------------------------------------------------------
15
16
// Helpers
16
17
//------------------------------------------------------------------------------
17
18
18
19
const LINE_PATTERN = / [ ^ \r \n \u2028 \u2029 ] * (?: \r \n | [ \r \n \u2028 \u2029 ] | $ ) / g
20
+ const REPO_URL = "https://github.com/mysticatea/eslint-plugin-eslint-comments"
19
21
20
22
//------------------------------------------------------------------------------
21
23
// Exports
@@ -104,4 +106,16 @@ module.exports = {
104
106
lte ( a , b ) {
105
107
return a . line < b . line || ( a . line === b . line && a . column <= b . column )
106
108
} ,
109
+
110
+ /**
111
+ * Generates the URL to documentation for the given rule name. It uses the
112
+ * package version to build the link to a tagged version of the
113
+ * documentation file.
114
+ *
115
+ * @param {string } ruleName - Name of the eslint rule
116
+ * @returns {string } URL to the documentation for the given rule
117
+ */
118
+ getDocsUrl ( ruleName ) {
119
+ return `${ REPO_URL } /blob/v${ pkg . version } /docs/rules/${ ruleName } .md`
120
+ } ,
107
121
}
You can’t perform that action at this time.
0 commit comments