Skip to content

Commit

Permalink
[CHORE] update all docs urls (typescript-eslint#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 authored and JamesHenry committed Jan 18, 2019
1 parent ed6076d commit e29e68f
Show file tree
Hide file tree
Showing 28 changed files with 50 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
"use strict";

const util = require("../util");

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
Expand All @@ -13,8 +15,7 @@ module.exports = {
docs: {
description: "Require that member overloads be consecutive",
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/adjacent-overload-signatures.md",
url: util.metaDocsUrl("adjacent-overload-signatures"),
},
schema: [],
},
Expand Down
3 changes: 1 addition & 2 deletions packages/eslint-plugin-typescript/lib/rules/array-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ module.exports = {
description: "Requires using either `T[]` or `Array<T>` for arrays",
extraDescription: [util.tslintRule("array-type")],
category: "TypeScript",
url:
"https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/array-type.md",
url: util.metaDocsUrl("array-type"),
},
fixable: "code",
messages: {
Expand Down
3 changes: 1 addition & 2 deletions packages/eslint-plugin-typescript/lib/rules/ban-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ module.exports = {
description: "Enforces that types will not to be used",
extraDescription: [util.tslintRule("ban-types")],
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/ban-types.md",
url: util.metaDocsUrl("ban-types"),
},
fixable: "code",
messages: {
Expand Down
2 changes: 2 additions & 0 deletions packages/eslint-plugin-typescript/lib/rules/camelcase.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"use strict";

const baseRule = require("eslint/lib/rules/camelcase");
const util = require("../util");

//------------------------------------------------------------------------------
// Rule Definition
Expand All @@ -14,6 +15,7 @@ module.exports = {
meta: Object.assign({}, baseRule.meta, {
docs: {
description: "Enforce camelCase naming convention",
url: util.metaDocsUrl("ban-types"),
},
}),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ module.exports = {
extraDescription: [util.tslintRule("class-name")],
category: "Best Practices",
recommended: true,
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/class-name-casing.md",
url: util.metaDocsUrl("class-name-casing"),
},
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ module.exports = {
docs: {
description:
"Require explicit return types on functions and class methods",

category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/explicit-function-return-type.md",
url: util.metaDocsUrl("explicit-function-return-type"),
},
schema: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ module.exports = {
"Require explicit accessibility modifiers on class properties and methods",
extraDescription: [util.tslintRule("member-access")],
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/explicit-member-accessibility.md",
url: util.metaDocsUrl("explicit-member-accessibility"),
},
schema: [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
"use strict";

const util = require("../util");

/**
*
* @param {any} context ESLint context
Expand Down Expand Up @@ -43,8 +45,7 @@ module.exports = {
docs: {
description: "Enforces naming of generic type variables",
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/generic-type-naming.md",
url: util.metaDocsUrl("generic-type-naming"),
},
messages: {
paramNotMatchRule:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ module.exports = {
description: "Require that interface names be prefixed with `I`",
extraDescription: [util.tslintRule("interface-name")],
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/interface-name-prefix.md",
url: util.metaDocsUrl("interface-name-prefix"),
},
schema: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
"use strict";

const { deepMerge } = require("../util");
const { deepMerge, metaDocsUrl } = require("../util");

//------------------------------------------------------------------------------
// Rule Definition
Expand Down Expand Up @@ -41,8 +41,7 @@ module.exports = {
description:
"Require a specific member delimiter style for interfaces and type literals",
category: "TypeScript",
url:
"https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/member-delimiter-style.md",
url: metaDocsUrl("member-delimiter-style"),
},
fixable: "code",
messages: {
Expand Down
5 changes: 3 additions & 2 deletions packages/eslint-plugin-typescript/lib/rules/member-naming.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
"use strict";

const util = require("../util");

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
Expand All @@ -14,8 +16,7 @@ module.exports = {
description:
"Enforces naming conventions for class members by visibility.",
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/member-naming.md",
url: util.metaDocsUrl("member-naming"),
},
schema: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ module.exports = {
description: "Require a consistent member declaration order",
extraDescription: [util.tslintRule("member-ordering")],
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/member-ordering.md",
url: util.metaDocsUrl("member-ordering"),
},
schema: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ module.exports = {
util.tslintRule("no-angle-bracket-type-assertion"),
],
category: "Style",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-angle-bracket-type-assertion.md",
url: util.metaDocsUrl("no-angle-bracket-type-assertion"),
},
schema: [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
"use strict";

const util = require("../util");

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
Expand All @@ -15,8 +17,7 @@ module.exports = {
description: "Disallow generic `Array` constructors",
category: "Stylistic Issues",
recommended: false,
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-array-constructor.md",
url: util.metaDocsUrl("no-array-constructor"),
},
fixable: "code",
schema: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ module.exports = {
description: "Disallow the declaration of empty interfaces",
extraDescription: [util.tslintRule("no-empty-interface")],
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-empty-interface.md",
url: util.metaDocsUrl("no-empty-interface"),
},
schema: [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ module.exports = {
description: "Disallow usage of the `any` type",
extraDescription: [util.tslintRule("no-any")],
category: "TypeScript",
url:
"https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/no-explicit-any.md",
url: util.metaDocsUrl("no-explicit-any"),
},
schema: [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* @fileoverview Disallows explicit type declarations for inferrable types
* @author James Garbutt <https://github.com/43081j>
*/

"use strict";

const util = require("../util");
Expand All @@ -18,8 +17,7 @@ module.exports = {
"Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.",
extraDescription: [util.tslintRule("no-inferrable-types")],
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-inferrable-types.md",
url: util.metaDocsUrl("no-inferrable-types"),
},
fixable: "code",
schema: [
Expand Down
5 changes: 3 additions & 2 deletions packages/eslint-plugin-typescript/lib/rules/no-namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
"use strict";

const util = require("../util");

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
Expand All @@ -14,8 +16,7 @@ module.exports = {
description:
"Disallow the use of custom TypeScript modules and namespaces",
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-namespace.md",
url: util.metaDocsUrl("no-namespace"),
},
schema: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ module.exports = {
"Disallows non-null assertions using the `!` postfix operator",
extraDescription: [util.tslintRule("no-non-null-assertion")],
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-non-null-assertion.md",
url: util.metaDocsUrl("no-non-null-assertion"),
},
schema: [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ module.exports = {
"Disallow the use of parameter properties in class constructors.",
extraDescription: [util.tslintRule("no-parameter-properties")],
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-parameter-properties.md",
url: util.metaDocsUrl("no-parameter-properties"),
},
schema: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ module.exports = {
description: 'Disallow `/// <reference path="" />` comments',
extraDescription: [util.tslintRule("no-reference")],
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-triple-slash-reference.md",
url: util.metaDocsUrl("no-triple-slash-reference"),
},
schema: [],
},
Expand Down
3 changes: 1 addition & 2 deletions packages/eslint-plugin-typescript/lib/rules/no-type-alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ module.exports = {
description: "Disallow the use of type aliases",
extraDescription: [util.tslintRule("interface-over-type-literal")],
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-type-alias.md",
url: util.metaDocsUrl("no-type-alias"),
},
schema: [
{
Expand Down
5 changes: 3 additions & 2 deletions packages/eslint-plugin-typescript/lib/rules/no-unused-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
"use strict";

const util = require("../util");

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
Expand All @@ -15,8 +17,7 @@ module.exports = {
"Prevent TypeScript-specific constructs from being erroneously flagged as unused",
category: "TypeScript",
recommended: true,
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-unused-vars.md",
url: util.metaDocsUrl("no-unused-vars"),
},
schema: [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

"use strict";

const util = require("../util");

//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -183,8 +185,7 @@ module.exports = {
"Disallow the use of variables before they are defined",
category: "Variables",
recommended: false,
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-use-before-define.md",
url: util.metaDocsUrl("no-use-before-define"),
},

schema: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ module.exports = {
"Disallows the use of require statements except in import statements",
extraDescription: [util.tslintRule("no-var-requires")],
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-var-requires.md",
url: util.metaDocsUrl("no-var-requires"),
},
schema: [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ module.exports = {
"Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules.",
extraDescription: [util.tslintRule("no-internal-module")],
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/prefer-namespace-keyword.md",
url: util.metaDocsUrl("prefer-namespace-keyword"),
},
fixable: "code",
schema: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
"use strict";

const util = require("../util");

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
Expand All @@ -23,8 +25,7 @@ module.exports = {
docs: {
description: "Require consistent spacing around type annotations",
category: "TypeScript",
url:
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/type-annotation-spacing.md",
url: util.metaDocsUrl("type-annotation-spacing"),
},
fixable: "code",
schema: [
Expand Down
5 changes: 5 additions & 0 deletions packages/eslint-plugin-typescript/lib/util.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
"use strict";

const version = require("../package.json").version;

exports.tslintRule = name => `\`${name}\` from TSLint`;

exports.metaDocsUrl = name =>
`https://github.com/bradzacher/eslint-plugin-typescript/blob/${version}/docs/rules/${name}.md`;

/**
* Check if the context file name is *.ts or *.tsx
* @param {string} fileName The context file name
Expand Down

0 comments on commit e29e68f

Please sign in to comment.