Skip to content

Commit 2598b1e

Browse files
committed
[Dev Deps] update @types/eslint, @types/estree, @types/node, @typescript-eslint/parser, coveralls, eslint-config-airbnb-base, eslint-plugin-import, typescript
- `npm run lint -- --quiet --fix`
1 parent f94d851 commit 2598b1e

Some content is hidden

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

52 files changed

+110
-109
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@
2626
"consistent-return": 0,
2727

2828
"prefer-destructuring": [2, { "array": false, "object": false }, { "enforceForRenamedProperties": false }],
29-
29+
"prefer-object-spread": 0,
3030
"function-paren-newline": 0,
3131
"no-plusplus": 1,
3232
"no-param-reassign": 1,
3333
"no-mixed-operators": 1,
3434
"no-restricted-syntax": 1,
35+
"strict": [2, "safe"],
3536
"valid-jsdoc": [2, {
3637
"requireReturn": false,
3738
"requireParamDescription": false,

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,17 @@ const allRules = {
9696
/* eslint-enable */
9797

9898
function filterRules(rules, predicate) {
99-
return fromEntries(entries(rules).filter(entry => predicate(entry[1])));
99+
return fromEntries(entries(rules).filter((entry) => predicate(entry[1])));
100100
}
101101

102102
function configureAsError(rules) {
103-
return fromEntries(Object.keys(rules).map(key => [`react/${key}`, 2]));
103+
return fromEntries(Object.keys(rules).map((key) => [`react/${key}`, 2]));
104104
}
105105

106-
const activeRules = filterRules(allRules, rule => !rule.meta.deprecated);
106+
const activeRules = filterRules(allRules, (rule) => !rule.meta.deprecated);
107107
const activeRulesConfig = configureAsError(activeRules);
108108

109-
const deprecatedRules = filterRules(allRules, rule => rule.meta.deprecated);
109+
const deprecatedRules = filterRules(allRules, (rule) => rule.meta.deprecated);
110110

111111
module.exports = {
112112
deprecatedRules,

lib/rules/boolean-prop-naming.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ module.exports = {
209209
if (!node || !Array.isArray(args)) {
210210
return;
211211
}
212-
args.filter(arg => arg.type === 'ObjectExpression').forEach(object => validatePropNaming(node, object.properties));
212+
args.filter((arg) => arg.type === 'ObjectExpression').forEach((object) => validatePropNaming(node, object.properties));
213213
}
214214

215215
// --------------------------------------------------------------------------

lib/rules/button-has-type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module.exports = {
7373
}
7474

7575
function checkValue(node, value) {
76-
const q = x => `"${x}"`;
76+
const q = (x) => `"${x}"`;
7777
if (!(value in configuration)) {
7878
context.report({
7979
node,
@@ -126,7 +126,7 @@ module.exports = {
126126
}
127127

128128
const props = node.arguments[1].properties;
129-
const typeProp = props.find(prop => prop.key && prop.key.name === 'type');
129+
const typeProp = props.find((prop) => prop.key && prop.key.name === 'type');
130130

131131
if (!typeProp || typeProp.value.type !== 'Literal') {
132132
reportMissing(node);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ module.exports = {
230230
'Program:exit'() {
231231
const list = components.list();
232232
// Report missing display name for all components
233-
Object.keys(list).filter(component => !list[component].hasDisplayName).forEach((component) => {
233+
Object.keys(list).filter((component) => !list[component].hasDisplayName).forEach((component) => {
234234
reportMissingDisplayName(list[component]);
235235
});
236236
}

lib/rules/forbid-foreign-prop-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ module.exports = {
115115
},
116116

117117
ObjectPattern(node) {
118-
const propTypesNode = node.properties.find(property => property.type === 'Property' && property.key.name === 'propTypes');
118+
const propTypesNode = node.properties.find((property) => property.type === 'Property' && property.key.name === 'propTypes');
119119

120120
if (propTypesNode) {
121121
context.report({

lib/rules/function-component-definition.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ module.exports = {
136136
if (isUnfixableBecauseOfExport(node)) return;
137137
if (isFunctionExpressionWithName(node)) return;
138138

139-
return fixer => fixer.replaceTextRange(options.range, buildFunction(options.template, {
139+
return (fixer) => fixer.replaceTextRange(options.range, buildFunction(options.template, {
140140
typeAnnotation,
141141
typeParams: getNodeText(node.typeParameters, source),
142142
params: getParams(node, source),

lib/rules/jsx-boolean-value.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const NEVER = 'never';
2323
const errorData = new WeakMap();
2424
function getErrorData(exceptions) {
2525
if (!errorData.has(exceptions)) {
26-
const exceptionProps = Array.from(exceptions, name => `\`${name}\``).join(', ');
26+
const exceptionProps = Array.from(exceptions, (name) => `\`${name}\``).join(', ');
2727
const exceptionsMessage = exceptions.size > 0 ? ` for the following props: ${exceptionProps}` : '';
2828
errorData.set(exceptions, {exceptionsMessage});
2929
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ module.exports = {
5959
const TEXT_FOLLOWING_ELEMENT_PATTERN = /^\s*\n\s*\S/;
6060
const TEXT_PRECEDING_ELEMENT_PATTERN = /\S\s*\n\s*$/;
6161

62-
const elementName = node => (
62+
const elementName = (node) => (
6363
node.openingElement
6464
&& node.openingElement.name
6565
&& node.openingElement.name.type === 'JSXIdentifier'
6666
&& node.openingElement.name.name
6767
);
6868

69-
const isInlineElement = node => (
69+
const isInlineElement = (node) => (
7070
node.type === 'JSXElement'
7171
&& INLINE_ELEMENTS.has(elementName(node))
7272
);

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ module.exports = {
122122

123123
function wrapNonHTMLEntities(text) {
124124
const HTML_ENTITY = '<HTML_ENTITY>';
125-
const withCurlyBraces = text.split(HTML_ENTITY_REGEX()).map(word => (
125+
const withCurlyBraces = text.split(HTML_ENTITY_REGEX()).map((word) => (
126126
word === '' ? '' : `{${JSON.stringify(word)}}`
127127
)).join(HTML_ENTITY);
128128

@@ -292,19 +292,19 @@ module.exports = {
292292
if (!children) {
293293
return false;
294294
}
295-
const childrenExcludingWhitespaceLiteral = children.filter(child => !isWhiteSpaceLiteral(child));
295+
const childrenExcludingWhitespaceLiteral = children.filter((child) => !isWhiteSpaceLiteral(child));
296296
const adjSiblings = getAdjacentSiblings(node, childrenExcludingWhitespaceLiteral);
297297

298-
return adjSiblings.some(x => x.type && x.type === 'JSXExpressionContainer');
298+
return adjSiblings.some((x) => x.type && x.type === 'JSXExpressionContainer');
299299
}
300300
function hasAdjacentJsx(node, children) {
301301
if (!children) {
302302
return false;
303303
}
304-
const childrenExcludingWhitespaceLiteral = children.filter(child => !isWhiteSpaceLiteral(child));
304+
const childrenExcludingWhitespaceLiteral = children.filter((child) => !isWhiteSpaceLiteral(child));
305305
const adjSiblings = getAdjacentSiblings(node, childrenExcludingWhitespaceLiteral);
306306

307-
return adjSiblings.some(x => x.type && arrayIncludes(['JSXExpressionContainer', 'JSXElement'], x.type));
307+
return adjSiblings.some((x) => x.type && arrayIncludes(['JSXExpressionContainer', 'JSXElement'], x.type));
308308
}
309309
function shouldCheckForUnnecessaryCurly(parent, node, config) {
310310
// Bail out if the parent is a JSXAttribute & its contents aren't

lib/rules/jsx-curly-newline.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ module.exports = {
140140
context.report({
141141
node: leftCurly,
142142
messageId: 'expectedAfter',
143-
fix: fixer => fixer.insertTextAfter(leftCurly, '\n')
143+
fix: (fixer) => fixer.insertTextAfter(leftCurly, '\n')
144144
});
145145
}
146146

@@ -164,7 +164,7 @@ module.exports = {
164164
context.report({
165165
node: rightCurly,
166166
messageId: 'expectedBefore',
167-
fix: fixer => fixer.insertTextBefore(rightCurly, '\n')
167+
fix: (fixer) => fixer.insertTextBefore(rightCurly, '\n')
168168
});
169169
}
170170
}

lib/rules/jsx-filename-extension.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module.exports = {
6262
}
6363

6464
const allowedExtensions = getExtensionsConfig();
65-
const isAllowedExtension = allowedExtensions.some(extension => filename.slice(-extension.length) === extension);
65+
const isAllowedExtension = allowedExtensions.some((extension) => filename.slice(-extension.length) === extension);
6666

6767
if (isAllowedExtension) {
6868
return;

lib/rules/jsx-indent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,12 @@ module.exports = {
307307
const regExp = indentType === 'space' ? /\n( *)[\t ]*\S/g : /\n(\t*)[\t ]*\S/g;
308308
const nodeIndentsPerLine = Array.from(
309309
matchAll(String(value), regExp),
310-
match => (match[1] ? match[1].length : 0)
310+
(match) => (match[1] ? match[1].length : 0)
311311
);
312312
const hasFirstInLineNode = nodeIndentsPerLine.length > 0;
313313
if (
314314
hasFirstInLineNode
315-
&& !nodeIndentsPerLine.every(actualIndent => actualIndent === indent)
315+
&& !nodeIndentsPerLine.every((actualIndent) => actualIndent === indent)
316316
) {
317317
nodeIndentsPerLine.forEach((nodeIndent) => {
318318
report(node, indent, nodeIndent);

lib/rules/jsx-key.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module.exports = {
5959
}
6060

6161
function getReturnStatement(body) {
62-
return body.filter(item => item.type === 'ReturnStatement')[0];
62+
return body.filter((item) => item.type === 'ReturnStatement')[0];
6363
}
6464

6565
return {

lib/rules/jsx-no-bind.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ module.exports = {
112112

113113
function getBlockStatementAncestors(node) {
114114
return context.getAncestors(node).reverse().filter(
115-
ancestor => ancestor.type === 'BlockStatement'
115+
(ancestor) => ancestor.type === 'BlockStatement'
116116
);
117117
}
118118

@@ -132,7 +132,7 @@ module.exports = {
132132

133133
function findVariableViolation(node, name) {
134134
getBlockStatementAncestors(node).find(
135-
block => reportVariableViolation(node, name, block.range[0])
135+
(block) => reportVariableViolation(node, name, block.range[0])
136136
);
137137
}
138138

lib/rules/jsx-no-script-url.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function hasJavaScriptProtocol(attr) {
2222

2323
function shouldVerifyElement(node, config) {
2424
const name = node.name && node.name.name;
25-
return name === 'a' || config.find(i => i.name === name);
25+
return name === 'a' || config.find((i) => i.name === name);
2626
}
2727

2828
function shouldVerifyProp(node, config) {
@@ -33,7 +33,7 @@ function shouldVerifyProp(node, config) {
3333
return true;
3434
}
3535

36-
const el = config.find(i => i.name === parentName);
36+
const el = config.find((i) => i.name === parentName);
3737
if (!el) {
3838
return false;
3939
}

lib/rules/jsx-no-target-blank.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ function isTargetBlank(attr) {
2828
}
2929

3030
function hasExternalLink(element, linkAttribute) {
31-
return element.attributes.some(attr => attr.name
31+
return element.attributes.some((attr) => attr.name
3232
&& attr.name.name === linkAttribute
3333
&& attr.value.type === 'Literal'
3434
&& /^(?:\w+:|\/\/)/.test(attr.value.value));
3535
}
3636

3737
function hasDynamicLink(element, linkAttribute) {
38-
return element.attributes.some(attr => attr.name
38+
return element.attributes.some((attr) => attr.name
3939
&& attr.name.name === linkAttribute
4040
&& attr.value.type === 'JSXExpressionContainer');
4141
}

lib/rules/jsx-props-no-spreading.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ module.exports = {
7878
const ignoreExplicitSpread = (configuration.explicitSpread || DEFAULTS.explicitSpread) === OPTIONS.ignore;
7979
const exceptions = configuration.exceptions || DEFAULTS.exceptions;
8080
const isException = (tag, allExceptions) => allExceptions.indexOf(tag) !== -1;
81-
const isProperty = property => property.type === 'Property';
82-
const getTagNameFromMemberExpression = node => `${node.property.parent.object.name}.${node.property.name}`;
81+
const isProperty = (property) => property.type === 'Property';
82+
const getTagNameFromMemberExpression = (node) => `${node.property.parent.object.name}.${node.property.name}`;
8383
return {
8484
JSXSpreadAttribute(node) {
8585
const jsxOpeningElement = node.parent.name;

lib/rules/jsx-sort-default-props.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module.exports = {
8181
* @returns {ASTNode|null} Return null if the variable could not be found, ASTNode otherwise.
8282
*/
8383
function findVariableByName(name) {
84-
const variable = variableUtil.variablesInScope(context).find(item => item.name === name);
84+
const variable = variableUtil.variablesInScope(context).find((item) => item.name === name);
8585

8686
if (!variable || !variable.defs[0] || !variable.defs[0].node) {
8787
return null;

lib/rules/jsx-sort-props.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const generateFixerFunction = (node, context, reservedList) => {
134134
const sortableAttributeGroups = getGroupsOfSortableAttributes(attributes);
135135
const sortedAttributeGroups = sortableAttributeGroups
136136
.slice(0)
137-
.map(group => group.slice(0).sort((a, b) => contextCompare(a, b, options)));
137+
.map((group) => group.slice(0).sort((a, b) => contextCompare(a, b, options)));
138138

139139
return function fixFunction(fixer) {
140140
const fixers = [];
@@ -176,7 +176,7 @@ function validateReservedFirstConfig(context, reservedFirst) {
176176
if (reservedFirst) {
177177
if (Array.isArray(reservedFirst)) {
178178
// Only allow a subset of reserved words in customized lists
179-
const nonReservedWords = reservedFirst.filter(word => !isReservedPropName(
179+
const nonReservedWords = reservedFirst.filter((word) => !isReservedPropName(
180180
word,
181181
RESERVED_PROPS_LIST
182182
));
@@ -260,7 +260,7 @@ module.exports = {
260260
JSXOpeningElement(node) {
261261
// `dangerouslySetInnerHTML` is only "reserved" on DOM components
262262
if (reservedFirst && !jsxUtil.isDOMComponent(node)) {
263-
reservedList = reservedList.filter(prop => prop !== 'dangerouslySetInnerHTML');
263+
reservedList = reservedList.filter((prop) => prop !== 'dangerouslySetInnerHTML');
264264
}
265265

266266
node.attributes.reduce((memo, decl, idx, attrs) => {

lib/rules/jsx-wrap-multilines.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ module.exports = {
150150
const option = getOption(type);
151151

152152
if ((option === true || option === 'parens') && !isParenthesised(node) && isMultilines(node)) {
153-
report(node, MISSING_PARENS, fixer => fixer.replaceText(node, `(${sourceCode.getText(node)})`));
153+
report(node, MISSING_PARENS, (fixer) => fixer.replaceText(node, `(${sourceCode.getText(node)})`));
154154
}
155155

156156
if (option === 'parens-new-line' && isMultilines(node)) {
@@ -162,13 +162,13 @@ module.exports = {
162162
report(
163163
node,
164164
MISSING_PARENS,
165-
fixer => fixer.replaceTextRange(
165+
(fixer) => fixer.replaceTextRange(
166166
[tokenBefore.range[0], tokenAfter && (tokenAfter.value === ';' || tokenAfter.value === '}') ? tokenAfter.range[0] : node.range[1]],
167167
`${trimTokenBeforeNewline(node, tokenBefore)}(\n${' '.repeat(node.loc.start.column)}${sourceCode.getText(node)}\n${' '.repeat(node.loc.start.column - 2)})`
168168
)
169169
);
170170
} else {
171-
report(node, MISSING_PARENS, fixer => fixer.replaceText(node, `(\n${sourceCode.getText(node)}\n)`));
171+
report(node, MISSING_PARENS, (fixer) => fixer.replaceText(node, `(\n${sourceCode.getText(node)}\n)`));
172172
}
173173
} else {
174174
const needsOpening = needsOpeningNewLine(node);

lib/rules/no-access-state-in-setstate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ module.exports = {
144144
while (current.type !== 'Program') {
145145
if (isFirstArgumentInSetStateCall(current, node)) {
146146
vars
147-
.filter(v => v.scope === context.getScope() && v.variableName === node.name)
147+
.filter((v) => v.scope === context.getScope() && v.variableName === node.name)
148148
.forEach((v) => {
149149
context.report({
150150
node: v.node,

lib/rules/no-children-prop.js

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

5959
const props = node.arguments[1].properties;
60-
const childrenProp = props.find(prop => prop.key && prop.key.name === 'children');
60+
const childrenProp = props.find((prop) => prop.key && prop.key.name === 'children');
6161

6262
if (childrenProp) {
6363
context.report({

lib/rules/no-danger-with-children.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424
},
2525
create(context) {
2626
function findSpreadVariable(name) {
27-
return variableUtil.variablesInScope(context).find(item => item.name === name);
27+
return variableUtil.variablesInScope(context).find((item) => item.name === name);
2828
}
2929
/**
3030
* Takes a ObjectExpression and returns the value of the prop if it has it
@@ -120,7 +120,7 @@ module.exports = {
120120
let props = node.arguments[1];
121121

122122
if (props.type === 'Identifier') {
123-
const variable = variableUtil.variablesInScope(context).find(item => item.name === props.name);
123+
const variable = variableUtil.variablesInScope(context).find((item) => item.name === props.name);
124124
if (variable && variable.defs.length && variable.defs[0].node.init) {
125125
props = variable.defs[0].node.init;
126126
}

lib/rules/no-deprecated.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ module.exports = {
139139
}
140140

141141
values(MODULES).some((moduleNames) => {
142-
moduleName = moduleNames.find(name => name === node.init.name);
142+
moduleName = moduleNames.find((name) => name === node.init.name);
143143
return moduleName;
144144
});
145145

@@ -153,7 +153,7 @@ module.exports = {
153153
*/
154154
function getLifeCycleMethods(node) {
155155
const properties = astUtil.getComponentProperties(node);
156-
return properties.map(property => ({
156+
return properties.map((property) => ({
157157
name: astUtil.getPropertyName(property),
158158
node: astUtil.getPropertyNameNode(property)
159159
}));
@@ -166,7 +166,7 @@ module.exports = {
166166
function checkLifeCycleMethods(node) {
167167
if (utils.isES5Component(node) || utils.isES6Component(node)) {
168168
const methods = getLifeCycleMethods(node);
169-
methods.forEach(method => checkDeprecation(node, method.name, method.node));
169+
methods.forEach((method) => checkDeprecation(node, method.name, method.node));
170170
}
171171
}
172172

0 commit comments

Comments
 (0)