Skip to content

Commit

Permalink
[types] add type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
y-hsgw authored and ljharb committed Apr 9, 2024
1 parent e4ecbcf commit d50d886
Show file tree
Hide file tree
Showing 71 changed files with 71 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rules/boolean-prop-naming.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const messages = {
patternMismatch: 'Prop name `{{propName}}` doesn’t match rule `{{pattern}}`',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/default-props-match-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const messages = {
defaultHasNoType: 'defaultProp "{{name}}" has no corresponding propTypes declaration.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/destructuring-assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const messages = {
destructureInSignature: 'Must destructure props in the function signature.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/display-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const messages = {
noContextDisplayName: 'Context definition is missing display name',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/forbid-component-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const messages = {
propIsForbidden: 'Prop "{{prop}}" is forbidden on Components',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/forbid-dom-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const messages = {
propIsForbidden: 'Prop "{{prop}}" is forbidden on DOM Nodes',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/function-component-definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const messages = {
'arrow-function': 'Function component is not an arrow function',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/iframe-missing-sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function checkProps(context, node) {
}
}

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-boolean-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const messages = {
omitPropAndBoolean: 'Value must be omitted for `false` attribute: `{{propName}}`',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-child-element-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const messages = {
spacingBeforeNext: 'Ambiguous spacing before next element {{element}}',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-closing-tag-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const messages = {
matchIndent: 'Expected closing tag to match indentation of opening.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-curly-brace-presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const messages = {
missingCurly: 'Need to wrap this literal in a JSX expression.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-curly-newline.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const messages = {
unexpectedAfter: 'Unexpected newline after \'{\'.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
type: 'layout',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-filename-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const messages = {
extensionOnlyForJSX: 'Only files containing JSX may use the extension \'{{ext}}\'',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-first-prop-new-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const messages = {
propOnSameLine: 'Property should be placed on the same line as the component declaration',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-handler-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const messages = {
badPropKey: 'Prop key for {{propValue}} must begin with \'{{handlerPropPrefix}}\'',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const messages = {
nonUniqueKeys: '`key` prop must be unique',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-max-depth.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const messages = {
wrongDepth: 'Expected the depth of nested jsx elements to be <= {{needed}}, but found {{found}}.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-max-props-per-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const messages = {
newLine: 'Prop `{{prop}}` must be placed on a new line',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-newline.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function isMultilined(node) {
return node && node.loc.start.line !== node.loc.end.line;
}

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-comment-textnodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function checkText(node, context) {
}
}

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-constructed-context-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ const messages = {
defaultMsgFunc: 'The {{type}} passed as the value prop to the Context provider (at line {{nodeLine}}) changes every render. To fix this consider wrapping it in a useCallback hook.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-duplicate-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const messages = {
noDuplicateProps: 'No duplicate props allowed',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-leaked-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function ruleFixer(context, fixStrategy, fixer, reportedNode, leftNode, rightNod
/**
* @type {import('eslint').Rule.RuleModule}
*/
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-literals.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const messages = {
literalNotInJSXExpression: 'Missing JSX expression container around literal string: "{{text}}"',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-script-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const messages = {
noScriptURL: 'A future version of React will block javascript: URLs as a security precaution. Use event handlers instead if you can. If you need to generate unsafe HTML, try using dangerouslySetInnerHTML instead.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-target-blank.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const messages = {
noTargetBlankWithoutNoopener: 'Using target="_blank" without rel="noreferrer" or rel="noopener" (the former implies the latter and is preferred due to wider support) is a security risk: see https://mathiasbynens.github.io/rel-noopener/#recommendations',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
fixable: 'code',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-undef.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const messages = {
undefined: '\'{{identifier}}\' is not defined.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-useless-fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const messages = {
ChildOfHtmlElement: 'Passing a fragment to an HTML element is useless.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
type: 'suggestion',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-one-expression-per-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const messages = {
moveToNewLine: '`{{descriptor}}` must be placed on a new line',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-pascal-case.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const messages = {
usePascalOrSnakeCase: 'Imported JSX component {{name}} must be in PascalCase or SCREAMING_SNAKE_CASE',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-props-no-multi-spaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const messages = {
onlyOneSpace: 'Expected only one space between “{{prop1}}” and “{{prop2}}”',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-props-no-spreading.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const messages = {
noSpreading: 'Prop spreading is forbidden',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-sort-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ function reportNodeAttribute(nodeAttribute, errorType, node, context, reservedLi
});
}

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-tag-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ const optionDefaults = {
beforeClosing: 'allow',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-uses-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const docsUrl = require('../util/docsUrl');
// Rule Definition
// ------------------------------------------------------------------------------

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
// eslint-disable-next-line eslint-plugin/prefer-message-ids -- https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/issues/292
meta: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-uses-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const docsUrl = require('../util/docsUrl');
const isTagNameRe = /^[a-z]/;
const isTagName = (name) => isTagNameRe.test(name);

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
// eslint-disable-next-line eslint-plugin/prefer-message-ids -- https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/issues/292
meta: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-wrap-multilines.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const messages = {
parensOnNewLines: 'Parentheses around JSX should be on separate lines',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-array-index-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const messages = {
noArrayIndex: 'Do not use Array index in keys',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-arrow-function-lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const messages = {
lifecycle: '{{propertyName}} is a React lifecycle method, and should not be an arrow function or in a class field. Use an instance method instead.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-danger.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const messages = {
dangerousProp: 'Dangerous property \'{{name}}\' found',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-did-mount-set-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

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

/** @type {import('eslint').Rule.RuleModule} */
module.exports = makeNoMethodSetStateRule('componentDidMount');
1 change: 1 addition & 0 deletions lib/rules/no-did-update-set-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

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

/** @type {import('eslint').Rule.RuleModule} */
module.exports = makeNoMethodSetStateRule('componentDidUpdate');
1 change: 1 addition & 0 deletions lib/rules/no-direct-mutation-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const messages = {
noDirectMutation: 'Do not mutate state directly. Use setState().',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-multi-comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const messages = {
onlyOneComponent: 'Declare only one React component per file',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const messages = {
noNamespace: 'React component {{name}} must not be in a namespace, as React does not support them',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-object-type-as-default-prop.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function verifyDefaultPropsDestructuring(context, properties) {
});
}

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-redundant-should-component-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const messages = {
noShouldCompUpdate: '{{component}} does not need shouldComponentUpdate when extending React.PureComponent.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-set-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const messages = {
noSetState: 'Do not use setState',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-string-refs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const messages = {
stringInRefDeprecated: 'Using string literals in ref attributes is deprecated.',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
Loading

0 comments on commit d50d886

Please sign in to comment.