Skip to content

Commit

Permalink
Add URL to rule documentation to the metadata
Browse files Browse the repository at this point in the history
ESLint v4.15.0 added an official location for rules to store a URL to
their documentation in the rule metadata in eslint/eslint#9788. This
adds the URL to all the existing rules so anything consuming them can
know where their documentation is without having to resort to external
packages to guess.
  • Loading branch information
Arcanemagus committed Jan 8, 2018
1 parent c23d395 commit bf544dc
Show file tree
Hide file tree
Showing 71 changed files with 244 additions and 72 deletions.
4 changes: 3 additions & 1 deletion lib/rules/boolean-prop-naming.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
const has = require('has');
const Components = require('../util/Components');
const propsUtil = require('../util/props');
const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
Expand All @@ -17,7 +18,8 @@ module.exports = {
docs: {
category: 'Stylistic Issues',
description: 'Enforces consistent naming for boolean props',
recommended: false
recommended: false,
url: docsUrl('boolean-prop-naming')
},

schema: [{
Expand Down
4 changes: 3 additions & 1 deletion lib/rules/button-has-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

const getProp = require('jsx-ast-utils/getProp');
const getLiteralPropValue = require('jsx-ast-utils/getLiteralPropValue');
const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Helpers
Expand All @@ -27,7 +28,8 @@ module.exports = {
docs: {
description: 'Forbid "button" element without an explicit "type" attribute',
category: 'Possible Errors',
recommended: false
recommended: false,
url: docsUrl('button-has-type')
},
schema: [{
type: 'object',
Expand Down
4 changes: 3 additions & 1 deletion lib/rules/default-props-match-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const variableUtil = require('../util/variable');
const annotations = require('../util/annotations');
const astUtil = require('../util/ast');
const propsUtil = require('../util/props');
const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
Expand All @@ -20,7 +21,8 @@ module.exports = {
meta: {
docs: {
description: 'Enforce all defaultProps are defined and not "required" in propTypes.',
category: 'Best Practices'
category: 'Best Practices',
url: docsUrl('default-props-match-prop-types')
},

schema: [{
Expand Down
4 changes: 3 additions & 1 deletion lib/rules/destructuring-assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'use strict';

const Components = require('../util/Components');
const docsUrl = require('../util/docsUrl');

const DEFAULT_OPTION = 'always';

Expand All @@ -12,7 +13,8 @@ module.exports = {
docs: {
description: 'Enforce consistent usage of destructuring assignment of props, state, and context',
category: 'Stylistic Issues',
recommended: false
recommended: false,
url: docsUrl('destructuring-assignment')
},
schema: [{
type: 'string',
Expand Down
4 changes: 3 additions & 1 deletion lib/rules/display-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

const has = require('has');
const Components = require('../util/Components');
const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
Expand All @@ -16,7 +17,8 @@ module.exports = {
docs: {
description: 'Prevent missing displayName in a React component definition',
category: 'Best Practices',
recommended: true
recommended: true,
url: docsUrl('display-name')
},

schema: [{
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/forbid-component-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
'use strict';

const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------------
Expand All @@ -19,7 +21,8 @@ module.exports = {
docs: {
description: 'Forbid certain props on components',
category: 'Best Practices',
recommended: false
recommended: false,
url: docsUrl('forbid-component-props')
},

schema: [{
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/forbid-dom-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
'use strict';

const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------------
Expand All @@ -19,7 +21,8 @@ module.exports = {
docs: {
description: 'Forbid certain props on DOM Nodes',
category: 'Best Practices',
recommended: false
recommended: false,
url: docsUrl('forbid-dom-props')
},

schema: [{
Expand Down
4 changes: 3 additions & 1 deletion lib/rules/forbid-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'use strict';

const has = require('has');
const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
Expand All @@ -15,7 +16,8 @@ module.exports = {
docs: {
description: 'Forbid certain elements',
category: 'Best Practices',
recommended: false
recommended: false,
url: docsUrl('forbid-elements')
},

schema: [{
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/forbid-foreign-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
'use strict';

const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------------
Expand All @@ -18,7 +20,8 @@ module.exports = {
docs: {
description: 'Forbid using another component\'s propTypes',
category: 'Best Practices',
recommended: false
recommended: false,
url: docsUrl('forbid-foreign-prop-types')
}
},

Expand Down
4 changes: 3 additions & 1 deletion lib/rules/forbid-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
const variableUtil = require('../util/variable');
const propsUtil = require('../util/props');
const astUtil = require('../util/ast');
const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Constants
Expand All @@ -22,7 +23,8 @@ module.exports = {
docs: {
description: 'Forbid certain propTypes',
category: 'Best Practices',
recommended: false
recommended: false,
url: docsUrl('forbid-prop-types')
},

schema: [{
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/jsx-boolean-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
'use strict';

const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
Expand Down Expand Up @@ -48,7 +50,8 @@ module.exports = {
docs: {
description: 'Enforce boolean attributes notation in JSX',
category: 'Stylistic Issues',
recommended: false
recommended: false,
url: docsUrl('jsx-boolean-value')
},
fixable: 'code',

Expand Down
4 changes: 3 additions & 1 deletion lib/rules/jsx-closing-bracket-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'use strict';

const has = require('has');
const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
Expand All @@ -14,7 +15,8 @@ module.exports = {
docs: {
description: 'Validate closing bracket location in JSX',
category: 'Stylistic Issues',
recommended: false
recommended: false,
url: docsUrl('jsx-closing-bracket-location')
},
fixable: 'code',

Expand Down
4 changes: 3 additions & 1 deletion lib/rules/jsx-closing-tag-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'use strict';

const astUtil = require('../util/ast');
const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
Expand All @@ -14,7 +15,8 @@ module.exports = {
docs: {
description: 'Validate closing tag location for multiline JSX',
category: 'Stylistic Issues',
recommended: false
recommended: false,
url: docsUrl('jsx-closing-tag-location')
},
fixable: 'whitespace'
},
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/jsx-curly-brace-presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
'use strict';

const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------------
Expand All @@ -31,7 +33,8 @@ module.exports = {
'Disallow unnecessary JSX expressions when literals alone are sufficient ' +
'or enfore JSX expressions on literals in JSX children or attributes',
category: 'Stylistic Issues',
recommended: false
recommended: false,
url: docsUrl('jsx-curly-brace-presence')
},
fixable: 'code',

Expand Down
4 changes: 3 additions & 1 deletion lib/rules/jsx-curly-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'use strict';

const has = require('has');
const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
Expand All @@ -27,7 +28,8 @@ module.exports = {
docs: {
description: 'Enforce or disallow spaces inside of curly braces in JSX attributes',
category: 'Stylistic Issues',
recommended: false
recommended: false,
url: docsUrl('jsx-curly-spacing')
},
fixable: 'code',

Expand Down
5 changes: 4 additions & 1 deletion lib/rules/jsx-equals-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
'use strict';

const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
Expand All @@ -13,7 +15,8 @@ module.exports = {
docs: {
description: 'Disallow or enforce spaces around equal signs in JSX attributes',
category: 'Stylistic Issues',
recommended: false
recommended: false,
url: docsUrl('jsx-equals-spacing')
},
fixable: 'code',

Expand Down
4 changes: 3 additions & 1 deletion lib/rules/jsx-filename-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'use strict';

const path = require('path');
const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Constants
Expand All @@ -23,7 +24,8 @@ module.exports = {
docs: {
description: 'Restrict file extensions that may contain JSX',
category: 'Stylistic Issues',
recommended: false
recommended: false,
url: docsUrl('jsx-filename-extension')
},

schema: [{
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/jsx-first-prop-new-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
'use strict';

const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
Expand All @@ -13,7 +15,8 @@ module.exports = {
docs: {
description: 'Ensure proper position of the first property in JSX',
category: 'Stylistic Issues',
recommended: false
recommended: false,
url: docsUrl('jsx-first-prop-new-line')
},
fixable: 'code',

Expand Down
5 changes: 4 additions & 1 deletion lib/rules/jsx-handler-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
'use strict';

const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
Expand All @@ -13,7 +15,8 @@ module.exports = {
docs: {
description: 'Enforce event handler naming conventions in JSX',
category: 'Stylistic Issues',
recommended: false
recommended: false,
url: docsUrl('jsx-handler-names')
},

schema: [{
Expand Down
4 changes: 3 additions & 1 deletion lib/rules/jsx-indent-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'use strict';

const astUtil = require('../util/ast');
const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
Expand All @@ -39,7 +40,8 @@ module.exports = {
docs: {
description: 'Validate props indentation in JSX',
category: 'Stylistic Issues',
recommended: false
recommended: false,
url: docsUrl('jsx-indent-props')
},
fixable: 'code',

Expand Down
4 changes: 3 additions & 1 deletion lib/rules/jsx-indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'use strict';

const astUtil = require('../util/ast');
const docsUrl = require('../util/docsUrl');

// ------------------------------------------------------------------------------
// Rule Definition
Expand All @@ -39,7 +40,8 @@ module.exports = {
docs: {
description: 'Validate JSX indentation',
category: 'Stylistic Issues',
recommended: false
recommended: false,
url: docsUrl('jsx-indent')
},
fixable: 'whitespace',
schema: [{
Expand Down
Loading

0 comments on commit bf544dc

Please sign in to comment.