Skip to content

Commit

Permalink
Set url parameter automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
koddsson committed Mar 31, 2021
1 parent 7f54220 commit 5e2959d
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/rules/array-foreach.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
type: 'suggestion',
docs: {
description: 'enforce `for..of` loops over `Array.forEach`',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/array-foreach.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/async-currenttarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
type: 'problem',
docs: {
description: 'disallow `event.currentTarget` calls inside of async functions',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/async-currenttarget.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/async-preventdefault.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
type: 'problem',
docs: {
description: 'disallow `event.preventDefault` calls inside of async functions',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/async-preventDefault.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/authenticity-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
type: 'problem',
docs: {
description: 'disallow usage of CSRF tokens in JavaScript',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/authenticity-token.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/get-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = function(context) {
type: 'problem',
docs: {
description: 'disallow wrong usage of attribute names',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/get-attribute.md'
url: require('../url')(module)
},
fixable: 'code',
schema: []
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/js-class-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
type: 'suggestion',
docs: {
description: 'enforce a naming convention for js- prefixed classes',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/js-class-name.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-blur.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = function(context) {
type: 'problem',
docs: {
description: 'disallow usage of `Element.prototype.blur()`',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/no-blur.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-d-none.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
type: 'problem',
docs: {
description: 'disallow usage the `d-none` CSS class',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/no-d-none.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
type: 'problem',
docs: {
description: 'enforce usage of `Element.prototype.getAttribute` instead of `Element.prototype.datalist`',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/no-dataset.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-implicit-buggy-globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
type: 'problem',
docs: {
description: 'disallow implicit global variables',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/no-implicit-buggy-globals.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-innerText.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
type: 'problem',
docs: {
description: 'disallow `Element.prototype.innerText` in favor of `Element.prototype.textContent`',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/no-innerText.md'
url: require('../url')(module)
},
fixable: 'code',
schema: []
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-then.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
type: 'suggestion',
docs: {
description: 'enforce using `async/await` syntax over Promises',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/no-then.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-useless-passive.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
type: 'suggestion',
docs: {
description: 'disallow marking a event handler as passive when it has no effect',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/no-useless-passive.md'
url: require('../url')(module)
},
fixable: 'code',
schema: []
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-observers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
type: 'suggestion',
docs: {
description: 'disallow poorly performing event listeners',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/prefer-observers.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/require-passive-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
type: 'suggestion',
docs: {
description: 'enforce marking high frequency event handlers as passive',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/require-passive-events.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/unescaped-html-literal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
type: 'problem',
docs: {
description: 'disallow unesaped HTML literals',
url: 'https://github.com/github/eslint-plugin-github/blob/main/docs/rules/unescaped-html-literal.md'
url: require('../url')(module)
},
schema: []
},
Expand Down
9 changes: 9 additions & 0 deletions lib/url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const {homepage, version} = require('../package.json')
const path = require('path')
module.exports = ({id}) => {
const url = new URL(homepage)
const rule = path.basename(id, '.js')
url.hash = ''
url.pathname += `/blob/v${version}/docs/rules/${rule}.md`
return url.toString()
}

0 comments on commit 5e2959d

Please sign in to comment.