Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
docs-url (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Seccafien authored Jan 22, 2019
1 parent 6cb2dc1 commit 3849073
Show file tree
Hide file tree
Showing 30 changed files with 111 additions and 63 deletions.
5 changes: 3 additions & 2 deletions lib/rules/binary-assignment-parens.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const {docsUrl} = require('../utilities');

const MESSAGES = {
always: 'You must include parentheses around a binary assignment expression.',
never:
Expand All @@ -13,8 +15,7 @@ module.exports = {
'Enforce (or disallow) assignments of binary, boolean-producing expressions to be wrapped in parentheses.',
category: 'Best Practices',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/binary-assignment-parens.md',
uri: docsUrl('binary-assignment-parens'),
},

schema: [
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/class-property-semi.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const {docsUrl} = require('../utilities');

module.exports = {
meta: {
docs: {
description: 'Require (or disallow) semicolons for class properties.',
category: 'Stylistic Issues',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/class-property-semi.md',
uri: docsUrl('class-property-semi'),
},
fixable: 'code',
schema: [
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/jest/no-snapshots.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const {docsUrl} = require('../../utilities');

module.exports = {
meta: {
docs: {
description: 'Disallows jest snapshots.',
category: 'Best Practices',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/jest/no-snapshots.md',
uri: docsUrl('jest/no-snapshots'),
},
},

Expand Down
4 changes: 2 additions & 2 deletions lib/rules/jest/no-vague-titles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const commonTags = require('common-tags');
const {docsUrl} = require('../../utilities');

const VAGUE_TERMS = {
should: /should/i,
Expand All @@ -25,8 +26,7 @@ module.exports = {
description: 'Prevent the usage of vague words in test statements.',
category: 'Best Practices',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/no-vague-titles.md',
uri: docsUrl('jest/no-vague-titles'),
},
schema: [
{
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/jquery-dollar-sign-reference.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const {docsUrl} = require('../utilities');

const JQUERY_IDENTIFIERS = ['$', 'jQuery'];

const nonChainingMethods = {
Expand Down Expand Up @@ -60,8 +62,7 @@ module.exports = {
'Require that all jQuery objects are assigned to references prefixed with `$`.',
category: 'Possible Errors',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/jquery-dollar-sign-reference.md',
uri: docsUrl('jquery-dollar-sign-reference'),
},
},

Expand Down
5 changes: 3 additions & 2 deletions lib/rules/jsx-no-complex-expressions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const {docsUrl} = require('../utilities');

const CONDITIONAL_EXPRESSION_WARNING = [
'Don’t use conditional expressions inside JSX;',
'they generally make your component harder to read.',
Expand All @@ -11,8 +13,7 @@ module.exports = {
description: 'Disallow complex expressions embedded in in JSX.',
category: 'Best Practices',
recommended: true,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/jsx-no-complex-expressions.md',
uri: docsUrl('jsx-no-complex-expressions'),
},
schema: [],
},
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/jsx-no-hardcoded-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const {
getImportDetailsForName,
DEFAULT_IMPORT,
NAMESPACE_IMPORT,
docsUrl,
} = require('../utilities');

const defaultDOMOptions = {
Expand All @@ -17,8 +18,7 @@ module.exports = {
description: 'Disallow hardcoded content in JSX.',
category: 'Best Practices',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/jsx-no-hardcoded-content.md',
uri: docsUrl('jsx-no-hardcoded-content'),
},
schema: [
{
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/jsx-prefer-fragment-wrappers.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const {docsUrl} = require('../utilities');

module.exports = {
meta: {
docs: {
description:
'Disallow useless wrapping elements in favour of fragment shorthand in JSX',
category: 'Best Practices',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/jsx-prefer-fragment-wrappers.md',
uri: docsUrl('jsx-prefer-fragment-wrappers'),
},
},

Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-ancestor-directory-import.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const {extname, basename, relative, sep} = require('path');
const resolve = require('eslint-module-utils/resolve').default;
const {docsUrl} = require('../utilities');

module.exports = {
meta: {
Expand All @@ -8,8 +9,7 @@ module.exports = {
'Prefer that imports from within a directory extend to the file from where they are importing without relying on an index file.',
category: 'Best Practices',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/no-ancestor-directory-import.md',
uri: docsUrl('no-ancestor-directory-import'),
},
fixable: null,
},
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/no-fully-static-classes.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const {docsUrl} = require('../utilities');

module.exports = {
meta: {
docs: {
description:
'Prevent the declaration of classes consisting only of static members.',
category: 'Best Practices',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/no-fully-static-classes.md',
uri: docsUrl('no-fully-static-classes'),
},
},

Expand Down
5 changes: 3 additions & 2 deletions lib/rules/no-useless-computed-properties.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const {docsUrl} = require('../utilities');

module.exports = {
meta: {
docs: {
description: 'Prevent the usage of unnecessary computed properties.',
category: 'Best Practices',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/no-useless-computed-properties.md',
uri: docsUrl('no-useless-computed-properties'),
},
},

Expand Down
5 changes: 2 additions & 3 deletions lib/rules/polaris-no-bare-stack-item.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {polarisComponentFromJSX} = require('../utilities');
const {docsUrl, polarisComponentFromJSX} = require('../utilities');

module.exports = {
meta: {
Expand All @@ -7,8 +7,7 @@ module.exports = {
'Disallow the use of Polaris’s `Stack.Item` without any custom props.',
category: 'Best Practices',
recommended: true,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/polaris-no-bare-stack-item.md',
uri: docsUrl('polaris-no-bare-stack-item'),
},
schema: [],
},
Expand Down
5 changes: 2 additions & 3 deletions lib/rules/polaris-prefer-sectioned-prop.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {polarisComponentFromJSX} = require('../utilities');
const {polarisComponentFromJSX, docsUrl} = require('../utilities');

const COMPONENTS_WITH_SECTIONED_PROP = ['Popover', 'Card', 'Layout'];

Expand All @@ -9,8 +9,7 @@ module.exports = {
'Prefer the use of the `sectioned` props in Polaris components instead of wrapping all contents in a `Section` component.',
category: 'Best Practices',
recommended: true,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/polaris-prefer-sectioned-prop.md',
uri: docsUrl('polaris-prefer-sectioned-prop'),
},
schema: [],
},
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/prefer-class-properties.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const {docsUrl} = require('../utilities');

module.exports = {
meta: {
docs: {
description:
'Prefer class properties to assignment of literals in constructors.',
category: 'Stylistic Issues',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/prefer-class-properties.md',
uri: docsUrl('prefer-class-properties'),
},
schema: [
{
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/prefer-early-return.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const {docsUrl} = require('../utilities');

const defaultMaximumStatements = 1;

module.exports = {
Expand All @@ -7,8 +9,7 @@ module.exports = {
'Prefer early returns over full-body conditional wrapping in function declarations.',
category: 'Best Practices',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/prefer-early-return.md',
uri: docsUrl('prefer-early-return'),
},
schema: [
{
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/prefer-module-scope-constants.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const {docsUrl} = require('../utilities');

module.exports = {
meta: {
docs: {
description:
'Prefer that screaming snake case variables always be defined using `const`, and always appear at module scope.',
category: 'Best Practices',
recommended: true,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/prefer-module-scope-constants.md',
uri: docsUrl('prefer-module-scope-constants'),
},
schema: [],
},
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/prefer-twine.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const {docsUrl} = require('../utilities');

module.exports = {
meta: {
docs: {
description: 'Prefer Twine over Bindings as the name for twine imports.',
category: 'Best Practices',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/prefer-twine.md',
uri: docsUrl('prefer-twine'),
},
},

Expand Down
5 changes: 2 additions & 3 deletions lib/rules/react-initialize-state.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Components = require('eslint-plugin-react/lib/util/Components');
const {uncast, getName} = require('../utilities');
const {docsUrl, uncast, getName} = require('../utilities');

module.exports = {
meta: {
Expand All @@ -8,8 +8,7 @@ module.exports = {
'Require that React component state be initialized when it has a non-empty type.',
category: 'Possible Errors',
recommended: true,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/react-initialize-state.md',
uri: docsUrl('react-initialize-state'),
},
schema: [],
},
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/react-no-multiple-render-methods.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const Components = require('eslint-plugin-react/lib/util/Components');
const {docsUrl} = require('../utilities');

const message = [
'Don’t use multiple render methods in a single component;',
Expand All @@ -14,8 +15,7 @@ module.exports = {
'Disallow multiple render methods in React component classes',
category: 'Best Practices',
recommended: true,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/react-no-multiple-render-methods.md',
uri: docsUrl('react-no-multiple-render-methods'),
},
},

Expand Down
4 changes: 2 additions & 2 deletions lib/rules/react-prefer-private-members.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const pascalCase = require('pascal-case');
const Components = require('eslint-plugin-react/lib/util/Components');
const {docsUrl} = require('../utilities');

module.exports = {
meta: {
docs: {
description: 'Disallow public members within React component classes',
category: 'Best Practices',
recommended: true,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/react-prefer-private-members.md',
uri: docsUrl('react-prefer-private-members'),
},
},

Expand Down
5 changes: 2 additions & 3 deletions lib/rules/react-type-state.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
const Components = require('eslint-plugin-react/lib/util/Components');
const {getName} = require('../utilities');
const {docsUrl, getName} = require('../utilities');

module.exports = {
meta: {
docs: {
description: 'Require that React component state be typed in TypeScript.',
category: 'Possible Errors',
recommended: true,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/react-type-state.md',
uri: docsUrl('react-type-state'),
},
schema: [],
},
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/restrict-full-import.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const {docsUrl} = require('../utilities');

module.exports = {
meta: {
docs: {
description: 'Prevent importing the entirety of a package.',
category: 'Best Practices',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/restrict-full-import.md',
uri: docsUrl('restrict-full-import'),
},
schema: [
{
Expand Down
5 changes: 3 additions & 2 deletions lib/rules/sinon-no-restricted-features.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const {docsUrl} = require('../utilities');

function createSinonMatcher(aliases, injected) {
return function(object) {
return (
Expand All @@ -21,8 +23,7 @@ module.exports = {
description: 'Restrict the use of specified sinon features.',
category: 'Best Practices',
recommended: false,
uri:
'https://github.com/Shopify/eslint-plugin-shopify/blob/master/docs/rules/sinon-no-restricted-features.md',
uri: docsUrl('sinon-no-restricted-features'),
},
schema: [
{
Expand Down
Loading

0 comments on commit 3849073

Please sign in to comment.