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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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

0 comments on commit d50d886

Please sign in to comment.