Skip to content

Commit f4339d8

Browse files
committed
rename isParenthesized util
1 parent 36edd13 commit f4339d8

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/rules/jsx-no-leaked-zero.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
const docsUrl = require('../util/docsUrl');
99
const report = require('../util/report');
10-
const isParenthesised = require('../util/ast').isParenthesised;
10+
const isParenthesized = require('../util/ast').isParenthesized;
1111

1212
//------------------------------------------------------------------------------
1313
// Rule Definition
@@ -62,7 +62,7 @@ module.exports = {
6262
function ruleFixer(fixer, logicalExpressionNode) {
6363
if (fixStrategy === CAST_FIX_STRATEGY) {
6464
let leftSideRange = logicalExpressionNode.left.range;
65-
if (isParenthesised(context, logicalExpressionNode.left)) {
65+
if (isParenthesized(context, logicalExpressionNode.left)) {
6666
const [leftSideStart, leftSideEnd] = leftSideRange;
6767
leftSideRange = [leftSideStart - 1, leftSideEnd + 1];
6868
}
@@ -72,7 +72,7 @@ module.exports = {
7272
const sourceCode = context.getSourceCode();
7373
const rightSideText = sourceCode.getText(logicalExpressionNode.right);
7474
let leftSideText = sourceCode.getText(logicalExpressionNode.left);
75-
if (isParenthesised(context, logicalExpressionNode.left)) {
75+
if (isParenthesized(context, logicalExpressionNode.left)) {
7676
leftSideText = `(${leftSideText})`;
7777
}
7878
return fixer.replaceText(logicalExpressionNode, `${leftSideText} ? ${rightSideText} : null`);

lib/rules/jsx-wrap-multilines.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const has = require('object.hasown/polyfill')();
99
const docsUrl = require('../util/docsUrl');
1010
const jsxUtil = require('../util/jsx');
1111
const reportC = require('../util/report');
12-
const isParenthesised = require('../util/ast').isParenthesised;
12+
const isParenthesized = require('../util/ast').isParenthesized;
1313

1414
// ------------------------------------------------------------------------------
1515
// Constants
@@ -93,7 +93,7 @@ module.exports = {
9393
function needsOpeningNewLine(node) {
9494
const previousToken = context.getSourceCode().getTokenBefore(node);
9595

96-
if (!isParenthesised(context, node)) {
96+
if (!isParenthesized(context, node)) {
9797
return false;
9898
}
9999

@@ -107,7 +107,7 @@ module.exports = {
107107
function needsClosingNewLine(node) {
108108
const nextToken = context.getSourceCode().getTokenAfter(node);
109109

110-
if (!isParenthesised(context, node)) {
110+
if (!isParenthesized(context, node)) {
111111
return false;
112112
}
113113

@@ -144,12 +144,12 @@ module.exports = {
144144
const sourceCode = context.getSourceCode();
145145
const option = getOption(type);
146146

147-
if ((option === true || option === 'parens') && !isParenthesised(context, node) && isMultilines(node)) {
147+
if ((option === true || option === 'parens') && !isParenthesized(context, node) && isMultilines(node)) {
148148
report(node, 'missingParens', (fixer) => fixer.replaceText(node, `(${sourceCode.getText(node)})`));
149149
}
150150

151151
if (option === 'parens-new-line' && isMultilines(node)) {
152-
if (!isParenthesised(context, node)) {
152+
if (!isParenthesized(context, node)) {
153153
const tokenBefore = sourceCode.getTokenBefore(node, { includeComments: true });
154154
const tokenAfter = sourceCode.getTokenAfter(node, { includeComments: true });
155155
const start = node.loc.start;

lib/util/ast.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ function getKeyValue(context, node) {
271271
* @param {ASTNode} node - Node to be checked
272272
* @returns {boolean}
273273
*/
274-
function isParenthesised(context, node) {
274+
function isParenthesized(context, node) {
275275
const sourceCode = context.getSourceCode();
276276
const previousToken = sourceCode.getTokenBefore(node);
277277
const nextToken = sourceCode.getTokenAfter(node);
@@ -397,7 +397,7 @@ module.exports = {
397397
getPropertyNameNode,
398398
getComponentProperties,
399399
getKeyValue,
400-
isParenthesised,
400+
isParenthesized: isParenthesized,
401401
isAssignmentLHS,
402402
isClass,
403403
isFunction,

0 commit comments

Comments
 (0)