Skip to content

Commit e14f2b8

Browse files
committed
[eslint] enable and autofix arrow-parens
1 parent 04d65bb commit e14f2b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+89
-90
lines changed

.eslintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"object-shorthand": 1,
2828
"import/order": 1,
2929
"no-useless-escape": 1,
30-
"arrow-parens": 1,
3130
"import/newline-after-import": 1,
3231
"operator-linebreak": 1,
3332
"function-paren-newline": 0,

lib/rules/boolean-prop-naming.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ module.exports = {
156156
function runCheck(proptypes, addInvalidProp) {
157157
proptypes = proptypes || [];
158158

159-
proptypes.forEach(prop => {
159+
proptypes.forEach((prop) => {
160160
if (config.validateNested && nestedPropTypes(prop)) {
161161
runCheck(prop.value.arguments[0].properties, addInvalidProp);
162162
return;
@@ -176,7 +176,7 @@ module.exports = {
176176
const component = components.get(node) || node;
177177
const invalidProps = component.invalidProps || [];
178178

179-
runCheck(proptypes, prop => {
179+
runCheck(proptypes, (prop) => {
180180
invalidProps.push(prop);
181181
});
182182

@@ -190,7 +190,7 @@ module.exports = {
190190
* @param {Object} component The component to process
191191
*/
192192
function reportInvalidNaming(component) {
193-
component.invalidProps.forEach(propNode => {
193+
component.invalidProps.forEach((propNode) => {
194194
const propName = getPropName(propNode);
195195
context.report({
196196
node: propNode,
@@ -253,7 +253,7 @@ module.exports = {
253253
}
254254

255255
// Search for the proptypes declaration
256-
node.properties.forEach(property => {
256+
node.properties.forEach((property) => {
257257
if (!propsUtil.isPropTypesDeclaration(property)) {
258258
return;
259259
}
@@ -274,7 +274,7 @@ module.exports = {
274274
}
275275

276276
const list = components.list();
277-
Object.keys(list).forEach(component => {
277+
Object.keys(list).forEach((component) => {
278278
// If this is a functional component that uses a global type, check it
279279
if (
280280
list[component].node.type === 'FunctionDeclaration' &&

lib/rules/default-props-match-prop-types.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ module.exports = {
5151
return;
5252
}
5353

54-
Object.keys(defaultProps).forEach(defaultPropName => {
54+
Object.keys(defaultProps).forEach((defaultPropName) => {
5555
const defaultProp = defaultProps[defaultPropName];
5656
const prop = propTypes[defaultPropName];
5757

@@ -84,7 +84,7 @@ module.exports = {
8484
const list = components.list();
8585

8686
// If no defaultProps could be found, we don't report anything.
87-
Object.keys(list).filter(component => list[component].defaultProps).forEach(component => {
87+
Object.keys(list).filter(component => list[component].defaultProps).forEach((component) => {
8888
reportInvalidDefaultProps(
8989
list[component].declaredPropTypes,
9090
list[component].defaultProps || {}

lib/rules/display-name.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ module.exports = {
191191
ObjectExpression: function (node) {
192192
if (ignoreTranspilerName || !hasTranspilerName(node)) {
193193
// Search for the displayName declaration
194-
node.properties.forEach(property => {
194+
node.properties.forEach((property) => {
195195
if (!property.key || !propsUtil.isDisplayNameDeclaration(property.key)) {
196196
return;
197197
}
@@ -205,7 +205,7 @@ module.exports = {
205205
'Program:exit': function () {
206206
const list = components.list();
207207
// Report missing display name for all components
208-
Object.keys(list).filter(component => !list[component].hasDisplayName).forEach(component => {
208+
Object.keys(list).filter(component => !list[component].hasDisplayName).forEach((component) => {
209209
reportMissingDisplayName(list[component]);
210210
});
211211
}

lib/rules/forbid-component-props.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = {
5757

5858
create: function (context) {
5959
const configuration = context.options[0] || {};
60-
const forbid = new Map((configuration.forbid || DEFAULTS).map(value => {
60+
const forbid = new Map((configuration.forbid || DEFAULTS).map((value) => {
6161
const propName = typeof value === 'string' ? value : value.propName;
6262
const whitelist = typeof value === 'string' ? [] : (value.allowedFor || []);
6363
return [propName, whitelist];

lib/rules/forbid-elements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module.exports = {
5353

5454
const indexedForbidConfigs = {};
5555

56-
forbidConfiguration.forEach(item => {
56+
forbidConfiguration.forEach((item) => {
5757
if (typeof item === 'string') {
5858
indexedForbidConfigs[item] = {element: item};
5959
} else {

lib/rules/forbid-prop-types.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ module.exports = {
7979
* @returns {void}
8080
*/
8181
function checkProperties(declarations) {
82-
declarations.forEach(declaration => {
82+
declarations.forEach((declaration) => {
8383
if (declaration.type !== 'Property') {
8484
return;
8585
}
@@ -178,7 +178,7 @@ module.exports = {
178178
},
179179

180180
ObjectExpression: function (node) {
181-
node.properties.forEach(property => {
181+
node.properties.forEach((property) => {
182182
if (!property.key) {
183183
return;
184184
}

lib/rules/jsx-child-element-spacing.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ module.exports = {
7171
INLINE_ELEMENTS.has(elementName(node))
7272
);
7373

74-
const handleJSX = node => {
74+
const handleJSX = (node) => {
7575
let lastChild = null;
7676
let child = null;
77-
(node.children.concat([null])).forEach(nextChild => {
77+
(node.children.concat([null])).forEach((nextChild) => {
7878
if (
7979
(lastChild || nextChild) &&
8080
(!lastChild || isInlineElement(lastChild)) &&

lib/rules/jsx-curly-brace-presence.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,13 @@ module.exports = {
240240
// --------------------------------------------------------------------------
241241

242242
return {
243-
JSXExpressionContainer: node => {
243+
JSXExpressionContainer: (node) => {
244244
if (shouldCheckForUnnecessaryCurly(node.parent, userConfig)) {
245245
lintUnnecessaryCurly(node);
246246
}
247247
},
248248

249-
'Literal, JSXText': node => {
249+
'Literal, JSXText': (node) => {
250250
if (shouldCheckForMissingCurly(node.parent, userConfig)) {
251251
reportMissingCurly(node);
252252
}

lib/rules/jsx-equals-spacing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.exports = {
4545

4646
return {
4747
JSXOpeningElement: function (node) {
48-
node.attributes.forEach(attrNode => {
48+
node.attributes.forEach((attrNode) => {
4949
if (!hasEqual(attrNode)) {
5050
return;
5151
}

0 commit comments

Comments
 (0)