File tree 1 file changed +44
-0
lines changed
1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,50 @@ module.exports = {
101
101
102
102
```
103
103
104
+ ## Version specific URL
105
+
106
+ If you want to enforce version-specific URLs, it's feasible easily with ` .eslintrc.js ` and ` npm version <type> ` script.
107
+ For example:
108
+
109
+ ** .eslintrc.js** :
110
+
111
+ ``` js
112
+ " use strict"
113
+
114
+ const version = require (" ./package.json" ).version
115
+
116
+ module .exports = {
117
+ plugins: [" eslint-plugin" ],
118
+ // ... leaving out ...
119
+ rules: {
120
+ " eslint-plugin/require-meta-docs-url" : [" error" , {
121
+ pattern: ` path/to/v${ version} /docs/rules/{{name}}.md` ,
122
+ }],
123
+ }
124
+ }
125
+ ```
126
+
127
+ ** package.json** :
128
+
129
+ ``` json
130
+ {
131
+ "version" : " 1.0.0" ,
132
+ "scripts" : {
133
+ "pretest" : " eslint ." ,
134
+ "test" : " ... leaving out ..." ,
135
+ "preversion" : " npm test" ,
136
+ "version" : " eslint . --fix && git add ."
137
+ },
138
+ // ... leaving out ...
139
+ }
140
+ ```
141
+
142
+ Then ` npm version <type> ` command will update every rule to the new version's URL.
143
+
144
+ > npm runs ` preversion ` script on the current version, runs ` version ` script on the new version, and commits and makes a tag.
145
+ >
146
+ > Further reading: https://docs.npmjs.com/cli/version
147
+
104
148
## When Not To Use It
105
149
106
150
If you do not plan to provide rule's documentation in website, you can turn off this rule.
You can’t perform that action at this time.
0 commit comments