Skip to content

Commit

Permalink
[refactor] Delete Spaces and fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
y-hsgw committed Aug 11, 2024
1 parent 49fda12 commit fbaf8e3
Show file tree
Hide file tree
Showing 31 changed files with 35 additions and 38 deletions.
2 changes: 1 addition & 1 deletion lib/rules/button-has-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const messages = {
forbiddenValue: '"{{value}}" is an invalid value for button type attribute',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/checked-requires-onchange-or-readonly.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function extractTargetProps(properties, keyName) {
);
}

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/forbid-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const messages = {
forbiddenElement_message: '<{{element}}> is forbidden, {{message}}',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/forbid-foreign-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const messages = {
forbiddenPropType: 'Using propTypes from another component is not safe because they may be removed in production builds',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/forbid-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const messages = {
forbiddenPropType: 'Prop type "{{target}}" is forbidden',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/hook-use-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const messages = {
suggestMemo: 'Replace useState call with useMemo',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-closing-bracket-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const messages = {
bracketLocation: 'The closing bracket must be {{location}}{{details}}',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-curly-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const messages = {
spaceNeededBefore: 'A space is required before \'{{token}}\'',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-equals-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const messages = {
needSpaceAfter: 'A space is required after \'=\'',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/jsx-fragments.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const messages = {
preferFragment: 'Prefer fragment shorthand over {{react}}.{{fragment}}',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down Expand Up @@ -171,7 +171,7 @@ module.exports = {
ImportDeclaration(node) {
if (node.source && node.source.value === 'react') {
node.specifiers.forEach((spec) => {
if (spec.type === "ImportSpecifier" && spec.imported && spec.imported.name === fragmentPragma) {
if (spec.type === 'ImportSpecifier' && spec.imported && spec.imported.name === fragmentPragma) {
if (spec.local) {
fragmentNames.add(spec.local.name);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-indent-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const messages = {
wrongIndent: 'Expected indentation of {{needed}} {{type}} {{characters}} but found {{gotten}}.',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const messages = {
wrongIndent: 'Expected indentation of {{needed}} {{type}} {{characters}} but found {{gotten}}.',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-no-bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const messages = {
func: 'JSX props should not use functions',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
3 changes: 0 additions & 3 deletions lib/rules/jsx-no-leaked-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ function ruleFixer(context, fixStrategy, fixer, reportedNode, leftNode, rightNod
throw new TypeError('Invalid value for "validStrategies" option');
}

/**
* @type {import('eslint').Rule.RuleModule}
*/
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-sort-default-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const messages = {
propsNotSorted: 'Default prop types declarations should be sorted alphabetically',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
deprecated: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-space-before-closing.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const messages = {
needSpaceBeforeClose: 'A space is required before closing bracket',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
deprecated: true,
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-access-state-in-setstate.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const messages = {
useCallback: 'Use callback in setState when referencing the previous state.',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down Expand Up @@ -77,7 +77,7 @@ module.exports = {
if (node.callee.type === 'Identifier' && node.callee.name === method.methodName) {
let current = node.parent;
while (current.type !== 'Program') {
if (current.type === 'MethodDefinition' && current.key.type === 'PrivateIdentifier') {
if (current.type === 'MethodDefinition' && current.key.type === 'Identifier') {
methods.push({
methodName: current.key.name,
node: method.node,
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/no-adjacent-inline-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const messages = {
inlineElement: 'Child elements which render as inline HTML elements should be separated by a space or wrapped in block level elements.',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down Expand Up @@ -119,8 +119,8 @@ module.exports = {
if (node.arguments.length < 2 || !node.arguments[2]) {
return;
}
if(node.arguments[2].type !== "ArrayExpression") {
return
if (node.arguments[2].type !== 'ArrayExpression') {
return;
}
const children = node.arguments[2].elements;
validate(node, children);
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-children-prop.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const messages = {
passFunctionAsArgs: 'Do not pass a function as an additional argument to React.createElement. Instead, pass it as a prop.',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-danger-with-children.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const messages = {
dangerWithChildren: 'Only set one of `children` or `props.dangerouslySetInnerHTML`',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const messages = {
deprecated: '{{oldMethod}} is deprecated since React {{version}}{{newMethod}}{{refs}}',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-find-dom-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const messages = {
noFindDOMNode: 'Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-invalid-html-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ function checkCreateProps(context, node, attribute) {
}
}

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-is-mounted.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const messages = {
noIsMounted: 'Do not use isMounted',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand All @@ -41,7 +41,7 @@ module.exports = {
}
if (
callee.object.type !== 'ThisExpression'
|| (callee.property.type === 'PrivateIdentifier' || callee.property.type === 'Identifier')
&& callee.property.type === 'Identifier'
&& callee.property.name !== 'isMounted') {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-render-return-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const messages = {
noReturnValue: 'Do not depend on the return value from {{node}}.render',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ const messages = {
dataLowercaseRequired: 'React does not recognize data-* props with uppercase characters on a DOM element. Found \'{{name}}\', use \'{{lowerCaseName}}\' instead',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unused-class-component-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const messages = {
unusedWithClass: 'Unused method or property "{{name}}" of class "{{className}}"',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unused-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const messages = {
unusedStateField: 'Unused state field: \'{{name}}\'',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/sort-default-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const messages = {
propsNotSorted: 'Default prop types declarations should be sorted alphabetically',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/style-prop-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const messages = {
stylePropNotObject: 'Style prop value must be an object',
};

/** @type { import('eslint').Rule.RuleModule } */
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/void-dom-elements-no-children.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function isVoidDOMElement(elementName) {

const noChildrenInVoidEl = 'Void DOM element <{{element}} /> cannot receive children.';

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

0 comments on commit fbaf8e3

Please sign in to comment.