Skip to content

Commit e6de810

Browse files
authored
Update xo to v0.48.0 (#1735)
1 parent 40b6f05 commit e6de810

34 files changed

+49
-49
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"outdent": "^0.8.0",
8888
"typescript": "^4.5.4",
8989
"vue-eslint-parser": "^8.0.1",
90-
"xo": "^0.47.0"
90+
"xo": "^0.48.0"
9191
},
9292
"peerDependencies": {
9393
"eslint": ">=8.8.0"

rules/better-regex.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const create = context => {
2525
}
2626

2727
return {
28-
'Literal[regex]': node => {
28+
'Literal[regex]'(node) {
2929
const {raw: original, regex} = node;
3030

3131
// Regular Expressions with `u` flag are not well handled by `regexp-tree`
@@ -63,7 +63,7 @@ const create = context => {
6363
fix: fixer => fixer.replaceText(node, optimized),
6464
};
6565
},
66-
[newRegExp]: node => {
66+
[newRegExp](node) {
6767
const [patternNode, flagsNode] = node.arguments;
6868

6969
if (typeof patternNode.value !== 'string') {

rules/catch-error-name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const create = context => {
5050
|| name.endsWith(expectedName.charAt(0).toUpperCase() + expectedName.slice(1));
5151

5252
return {
53-
[selector]: node => {
53+
[selector](node) {
5454
const originalName = node.name;
5555

5656
if (

rules/consistent-destructuring.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const create = context => {
5757
const declarations = new Map();
5858

5959
return {
60-
[declaratorSelector]: node => {
60+
[declaratorSelector](node) {
6161
// Ignore any complex expressions (e.g. arrays, functions)
6262
if (!isSimpleExpression(node.init)) {
6363
return;
@@ -69,7 +69,7 @@ const create = context => {
6969
objectPattern: node.id,
7070
});
7171
},
72-
[memberSelector]: node => {
72+
[memberSelector](node) {
7373
const declaration = declarations.get(source.getText(node.object));
7474

7575
if (!declaration) {

rules/consistent-function-scoping.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,17 @@ const create = context => {
159159
const functions = [];
160160

161161
return {
162-
':function': () => {
162+
':function'() {
163163
functions.push(false);
164164
},
165-
JSXElement: () => {
165+
JSXElement() {
166166
// Turn off this rule if we see a JSX element because scope
167167
// references does not include JSXElement nodes.
168168
if (functions.length > 0) {
169169
functions[functions.length - 1] = true;
170170
}
171171
},
172-
':function:exit': node => {
172+
':function:exit'(node) {
173173
const currentFunctionHasJsx = functions.pop();
174174
if (currentFunctionHasJsx) {
175175
return;

rules/new-for-builtins.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const create = context => {
1717
const sourceCode = context.getSourceCode();
1818

1919
return {
20-
[callExpressionSelector(builtins.enforceNew)]: node => {
20+
[callExpressionSelector(builtins.enforceNew)](node) {
2121
const {callee, parent} = node;
2222
if (isShadowed(context.getScope(), callee)) {
2323
return;
@@ -42,7 +42,7 @@ const create = context => {
4242
fix: fixer => switchCallExpressionToNewExpression(node, sourceCode, fixer),
4343
};
4444
},
45-
[newExpressionSelector(builtins.disallowNew)]: node => {
45+
[newExpressionSelector(builtins.disallowNew)](node) {
4646
const {callee} = node;
4747

4848
if (isShadowed(context.getScope(), callee)) {

rules/no-array-callback-reference.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ function getProblem(context, node, method, options) {
157157
name,
158158
parameters: suggestionParameters,
159159
},
160-
fix: fixer => {
160+
fix(fixer) {
161161
const sourceCode = context.getSourceCode();
162162
let nodeText = sourceCode.getText(node);
163163
if (isParenthesized(node, sourceCode) || type === 'ConditionalExpression') {

rules/no-hex-escape.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function checkEscape(context, node, value) {
2323

2424
/** @param {import('eslint').Rule.RuleContext} context */
2525
const create = context => ({
26-
Literal: node => {
26+
Literal(node) {
2727
if (node.regex || typeof node.value === 'string') {
2828
return checkEscape(context, node, node.raw);
2929
}

rules/no-invalid-remove-event-listener.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const removeEventListenerSelector = [
2323

2424
/** @param {import('eslint').Rule.RuleContext} context */
2525
const create = context => ({
26-
[removeEventListenerSelector]: node => {
26+
[removeEventListenerSelector](node) {
2727
const listener = node.arguments[1];
2828
if (['ArrowFunctionExpression', 'FunctionExpression'].includes(listener.type)) {
2929
return {

rules/no-keyword-prefix.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const create = context => {
102102
}
103103

104104
return {
105-
Identifier: node => {
105+
Identifier(node) {
106106
const {name, parent} = node;
107107
const keyword = findKeywordPrefix(name, options);
108108
const effectiveParent = parent.type === 'MemberExpression' ? parent.parent : parent;

rules/no-nested-ternary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const create = context => {
1818
[nestTernarySelector(3)]: node =>
1919
// Nesting more than one level not allowed.
2020
({node, messageId: MESSAGE_ID_TOO_DEEP}),
21-
[nestTernarySelector(2)]: node => {
21+
[nestTernarySelector(2)](node) {
2222
if (!isParenthesized(node, sourceCode)) {
2323
return {
2424
node,

rules/no-new-buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function fix(node, sourceCode, method) {
5454
const create = context => {
5555
const sourceCode = context.getSourceCode();
5656
return {
57-
[newExpressionSelector('Buffer')]: node => {
57+
[newExpressionSelector('Buffer')](node) {
5858
const method = inferMethod(node.arguments, context.getScope());
5959

6060
if (method) {

rules/no-null.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const create = context => {
4040
};
4141

4242
return {
43-
[selector]: node => {
43+
[selector](node) {
4444
const {parent} = node;
4545
if (!checkStrictEquality && isStrictEqual(parent)) {
4646
return;

rules/no-object-as-default-parameter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const objectParameterSelector = [
1515

1616
/** @param {import('eslint').Rule.RuleContext} context */
1717
const create = () => ({
18-
[objectParameterSelector]: node => {
18+
[objectParameterSelector](node) {
1919
const {left, right} = node;
2020

2121
if (left.type === 'Identifier') {

rules/no-process-exit.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,20 @@ const create = context => {
4545

4646
return {
4747
// Check `worker_threads` require / import
48-
[importWorkerThreadsSelector]: () => {
48+
[importWorkerThreadsSelector]() {
4949
requiredWorkerThreadsModule = true;
5050
},
5151
// Check `process.on` / `process.once` call
52-
[processOnOrOnceCallSelector]: node => {
52+
[processOnOrOnceCallSelector](node) {
5353
processEventHandler = node;
5454
},
5555
// Check `process.exit` call
56-
[processExitCallSelector]: node => {
56+
[processExitCallSelector](node) {
5757
if (!processEventHandler) {
5858
problemNodes.push(node);
5959
}
6060
},
61-
'CallExpression:exit': node => {
61+
'CallExpression:exit'(node) {
6262
if (node === processEventHandler) {
6363
processEventHandler = undefined;
6464
}

rules/no-unsafe-regex.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const newRegExpSelector = [
1414

1515
/** @param {import('eslint').Rule.RuleContext} context */
1616
const create = () => ({
17-
'Literal[regex]': node => {
17+
'Literal[regex]'(node) {
1818
// Handle regex literal inside RegExp constructor in the other handler
1919
if (
2020
node.parent.type === 'NewExpression'
@@ -30,7 +30,7 @@ const create = () => ({
3030
};
3131
}
3232
},
33-
[newRegExpSelector]: node => {
33+
[newRegExpSelector](node) {
3434
const arguments_ = node.arguments;
3535
const hasRegExp = arguments_[0].regex;
3636

rules/no-useless-undefined.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ const create = context => {
165165
start: firstUndefined.loc.start,
166166
end: lastUndefined.loc.end,
167167
},
168-
fix: fixer => {
168+
fix(fixer) {
169169
let start = firstUndefined.range[0];
170170
let end = lastUndefined.range[1];
171171

rules/no-zero-fractions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const messages = {
1414

1515
/** @param {import('eslint').Rule.RuleContext} context */
1616
const create = context => ({
17-
Literal: node => {
17+
Literal(node) {
1818
if (!isNumber(node)) {
1919
return;
2020
}

rules/number-literal-case.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const fix = raw => {
1818

1919
/** @param {import('eslint').Rule.RuleContext} context */
2020
const create = () => ({
21-
Literal: node => {
21+
Literal(node) {
2222
const {raw} = node;
2323

2424
let fixed = raw;

rules/numeric-separators-style.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const create = context => {
9797
};
9898

9999
return {
100-
Literal: node => {
100+
Literal(node) {
101101
if (!numeric.isNumeric(node) || numeric.isLegacyOctal(node)) {
102102
return;
103103
}

rules/prefer-array-flat.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const emptyArrayConcat = {
102102
}),
103103
emptyArraySelector('callee.object'),
104104
].join(''),
105-
getArrayNode: node => {
105+
getArrayNode(node) {
106106
const argumentNode = node.arguments[0];
107107
return argumentNode.type === 'SpreadElement' ? argumentNode.argument : argumentNode;
108108
},
@@ -127,7 +127,7 @@ const arrayPrototypeConcat = {
127127
}),
128128
].join(''),
129129
testFunction: node => node.arguments[1].type !== 'SpreadElement' || node.callee.property.name === 'call',
130-
getArrayNode: node => {
130+
getArrayNode(node) {
131131
const argumentNode = node.arguments[1];
132132
return argumentNode.type === 'SpreadElement' ? argumentNode.argument : argumentNode;
133133
},

rules/prefer-default-parameters.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,18 @@ const create = context => {
190190
};
191191

192192
return {
193-
':function': node => {
193+
':function'(node) {
194194
functionStack.push(node);
195195
},
196-
':function:exit': () => {
196+
':function:exit'() {
197197
functionStack.pop();
198198
},
199-
[assignmentSelector]: node => {
199+
[assignmentSelector](node) {
200200
const {left, right} = node.expression;
201201

202202
return checkExpression(node, left, right, true);
203203
},
204-
[declarationSelector]: node => {
204+
[declarationSelector](node) {
205205
const {id, init} = node.declarations[0];
206206

207207
return checkExpression(node, id, init, false);

rules/prefer-includes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const getProblem = (context, node, target, argumentsNodes) => {
3030
return {
3131
node: memberExpressionNode.property,
3232
messageId: MESSAGE_ID,
33-
fix: fixer => {
33+
fix(fixer) {
3434
const replacement = `${isNegativeResult(node) ? '!' : ''}${targetSource}.includes(${argumentsSource.join(', ')})`;
3535
return fixer.replaceText(node, replacement);
3636
},
@@ -44,7 +44,7 @@ const includesOverSomeRule = simpleArraySearchRule({
4444

4545
/** @param {import('eslint').Rule.RuleContext} context */
4646
const create = context => ({
47-
BinaryExpression: node => {
47+
BinaryExpression(node) {
4848
const {left, right, operator} = node;
4949

5050
if (!isMethodNamed(left, 'indexOf')) {

rules/prefer-math-trunc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const create = context => {
4040
};
4141

4242
return {
43-
':matches(BinaryExpression, AssignmentExpression)[right.type="Literal"]': node => {
43+
':matches(BinaryExpression, AssignmentExpression)[right.type="Literal"]'(node) {
4444
const {type, operator, right, left} = node;
4545
const isAssignment = type === 'AssignmentExpression';
4646
if (

rules/prefer-negative-index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function parse(node) {
132132

133133
/** @param {import('eslint').Rule.RuleContext} context */
134134
const create = context => ({
135-
'CallExpression[callee.type="MemberExpression"]': node => {
135+
'CallExpression[callee.type="MemberExpression"]'(node) {
136136
const parsed = parse(node);
137137

138138
if (!parsed) {

rules/prefer-number-properties.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const create = context => {
5050
const reported = new WeakSet();
5151

5252
return {
53-
[methodsSelector]: node => {
53+
[methodsSelector](node) {
5454
if (isShadowed(context.getScope(), node)) {
5555
return;
5656
}
@@ -84,7 +84,7 @@ const create = context => {
8484

8585
return problem;
8686
},
87-
[propertiesSelector]: node => {
87+
[propertiesSelector](node) {
8888
if (reported.has(node) || isShadowed(context.getScope(), node)) {
8989
return;
9090
}

rules/prefer-optional-catch-binding.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const selector = [
1717

1818
/** @param {import('eslint').Rule.RuleContext} context */
1919
const create = context => ({
20-
[selector]: node => {
20+
[selector](node) {
2121
const variables = context.getDeclaredVariables(node.parent);
2222

2323
if (variables.some(variable => variable.references.length > 0)) {

rules/prefer-reflect-apply.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const fixFunctionPrototypeCall = (node, sourceCode) => {
6666

6767
/** @param {import('eslint').Rule.RuleContext} context */
6868
const create = context => ({
69-
[selector]: node => {
69+
[selector](node) {
7070
const sourceCode = context.getSourceCode();
7171
const fix = fixDirectApplyCall(node, sourceCode) || fixFunctionPrototypeCall(node, sourceCode);
7272
if (fix) {

rules/prefer-set-has.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const isMultipleCall = (identifier, node) => {
126126

127127
/** @param {import('eslint').Rule.RuleContext} context */
128128
const create = context => ({
129-
[selector]: node => {
129+
[selector](node) {
130130
const variable = findVariable(context.getScope(), node);
131131

132132
// This was reported https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1075#issuecomment-768073342

rules/prefer-string-replace-all.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function removeEscapeCharacters(regexString) {
4444

4545
/** @param {import('eslint').Rule.RuleContext} context */
4646
const create = () => ({
47-
[selector]: node => {
47+
[selector](node) {
4848
const {arguments: arguments_, callee} = node;
4949
const [search] = arguments_;
5050

rules/prefer-type-error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const isTypechecking = node => node.type === 'IfStatement' && isTypecheckingExpr
112112

113113
/** @param {import('eslint').Rule.RuleContext} context */
114114
const create = () => ({
115-
[selector]: node => {
115+
[selector](node) {
116116
if (
117117
isLone(node)
118118
&& node.parent.parent

rules/string-content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const create = context => {
7474
}
7575

7676
return {
77-
'Literal, TemplateElement': node => {
77+
'Literal, TemplateElement'(node) {
7878
const {type, value, raw} = node;
7979

8080
let string;

0 commit comments

Comments
 (0)