Skip to content

Commit

Permalink
chore: upgrade a few dev deps to latest (#472)
Browse files Browse the repository at this point in the history
chore: re-apply prettier
  • Loading branch information
aladdin-add committed Apr 18, 2024
1 parent 189f75c commit 95b1980
Show file tree
Hide file tree
Showing 37 changed files with 185 additions and 185 deletions.
2 changes: 1 addition & 1 deletion docs/rules/report-message-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {
context.report(
node,
'This will get reported, regardless of the value of the {{placeholder}}',
{ placeholder: foo }
{ placeholder: foo },
);
},
};
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = [
'not-an-aardvark/node',
'plugin:eslint-comments/recommended',
'plugin:prettier/recommended',
'plugin:unicorn/recommended'
'plugin:unicorn/recommended',
),
pluginN.configs['flat/recommended'],
{
Expand Down
10 changes: 5 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const allRules = Object.fromEntries(
.map((ruleName) => [
ruleName,
require(path.join(__dirname, 'rules', ruleName)),
])
]),
);

const plugin = {
Expand All @@ -61,11 +61,11 @@ Object.assign(
rules: Object.fromEntries(
Object.keys(allRules)
.filter((ruleName) => configFilters[configName](allRules[ruleName]))
.map((ruleName) => [`${PLUGIN_NAME}/${ruleName}`, 'error'])
.map((ruleName) => [`${PLUGIN_NAME}/${ruleName}`, 'error']),
),
},
});
}, {})
}, {}),
);

// flat configs
Expand All @@ -79,11 +79,11 @@ Object.assign(
rules: Object.fromEntries(
Object.keys(allRules)
.filter((ruleName) => configFilters[configName](allRules[ruleName]))
.map((ruleName) => [`${PLUGIN_NAME}/${ruleName}`, 'error'])
.map((ruleName) => [`${PLUGIN_NAME}/${ruleName}`, 'error']),
),
},
});
}, {})
}, {}),
);

module.exports = plugin;
4 changes: 2 additions & 2 deletions lib/rules/consistent-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ module.exports = {
Program(ast) {
utils.getTestInfo(context, ast).forEach((testRun) => {
const readableCases = testRun.invalid.filter(
(testCase) => testCase.type === 'ObjectExpression'
(testCase) => testCase.type === 'ObjectExpression',
);
const casesWithoutOutput = readableCases.filter(
(testCase) =>
!testCase.properties.map(utils.getKeyName).includes('output')
!testCase.properties.map(utils.getKeyName).includes('output'),
);

if (
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/fixer-return.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
*/
function ensureFunctionReturnedFix(
node,
loc = (node.id || node).loc.start
loc = (node.id || node).loc.start,
) {
if (
(node.generator && !funcInfo.hasYieldWithFixer) || // Generator function never yielded a fix
Expand Down Expand Up @@ -102,7 +102,7 @@ module.exports = {
const sourceCode = context.sourceCode || context.getSourceCode(); // TODO: just use context.sourceCode when dropping eslint < v9
contextIdentifiers = utils.getContextIdentifiers(
sourceCode.scopeManager,
ast
ast,
);
},

Expand Down
6 changes: 3 additions & 3 deletions lib/rules/meta-property-ordering.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ module.exports = {
const knownProps = props
.filter((prop) => orderMap.has(getKeyName(prop)))
.sort(
(a, b) => orderMap.get(getKeyName(a)) - orderMap.get(getKeyName(b))
(a, b) => orderMap.get(getKeyName(a)) - orderMap.get(getKeyName(b)),
);
const unknownProps = props.filter(
(prop) => !orderMap.has(getKeyName(prop))
(prop) => !orderMap.has(getKeyName(prop)),
);

for (const violatingProp of violatingProps) {
Expand All @@ -96,7 +96,7 @@ module.exports = {
return props.map((prop, k) => {
return fixer.replaceText(
prop,
sourceCode.getText(expectedProps[k])
sourceCode.getText(expectedProps[k]),
);
});
},
Expand Down
8 changes: 4 additions & 4 deletions lib/rules/no-deprecated-context-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ module.exports = {
contextId.parent.property.type === 'Identifier' &&
Object.prototype.hasOwnProperty.call(
DEPRECATED_PASSTHROUGHS,
contextId.parent.property.name
)
contextId.parent.property.name,
),
)
.forEach((contextId) =>
context.report({
Expand All @@ -87,10 +87,10 @@ module.exports = {
fixer.insertTextAfter(contextId, '.getSourceCode()'),
fixer.replaceText(
contextId.parent.property,
DEPRECATED_PASSTHROUGHS[contextId.parent.property.name]
DEPRECATED_PASSTHROUGHS[contextId.parent.property.name],
),
],
})
}),
);
},
};
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/no-deprecated-report-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = {
Program(ast) {
contextIdentifiers = utils.getContextIdentifiers(
sourceCode.scopeManager,
ast
ast,
);
},
CallExpression(node) {
Expand Down Expand Up @@ -70,9 +70,9 @@ module.exports = {
[openingParen.range[1], closingParen.range[0]],
`{${Object.keys(reportInfo)
.map(
(key) => `${key}: ${sourceCode.getText(reportInfo[key])}`
(key) => `${key}: ${sourceCode.getText(reportInfo[key])}`,
)
.join(', ')}}`
.join(', ')}}`,
);
},
});
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-identical-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module.exports = {
[
start.range[1],
end.value === ',' ? end.range[1] : test.range[1],
]
],
);
},
});
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-missing-message-ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = {
const reportMessagesAndDataArray =
utils.collectReportViolationAndSuggestionData(reportInfo);
for (const { messageId } of reportMessagesAndDataArray.filter(
(obj) => obj.messageId
(obj) => obj.messageId,
)) {
const values =
messageId.type === 'Literal'
Expand All @@ -81,7 +81,7 @@ module.exports = {
val.value,
ruleInfo,
scopeManager,
scope
scope,
)
)
// Couldn't find this messageId in `meta.messages`.
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/no-missing-placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module.exports = {
obj.messageId.value,
ruleInfo,
scopeManager,
scope
scope,
);
if (correspondingMessage) {
obj.message = correspondingMessage.value;
Expand Down Expand Up @@ -105,13 +105,13 @@ module.exports = {

while (
(match = PLACEHOLDER_MATCHER.exec(
message.value || messageStaticValue.value
message.value || messageStaticValue.value,
))
) {
const matchingProperty =
data &&
data.properties.find(
(prop) => utils.getKeyName(prop) === match[1]
(prop) => utils.getKeyName(prop) === match[1],
);

if (!matchingProperty) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-only-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {
property.key.type === 'Identifier' &&
property.key.name === 'only' &&
property.value.type === 'Literal' &&
property.value.value
property.value.value,
);

if (onlyProperty) {
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-property-in-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function isAstNodeType(type) {
return (type.types || [type])
.filter((typePart) => typePart.getProperty('type'))
.flatMap(
(typePart) => (typePart.symbol && typePart.symbol.declarations) || []
(typePart) => (typePart.symbol && typePart.symbol.declarations) || [],
)
.some((declaration) => {
const fileName = declaration.getSourceFile().fileName;
Expand Down Expand Up @@ -69,7 +69,7 @@ module.exports = {
const services = (context.sourceCode || context).parserServices;
if (!services.program) {
throw new Error(
'You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.'
'You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.',
);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-unused-message-ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module.exports = {
const scope = sourceCode.getScope?.(ast) || context.getScope(); // TODO: just use sourceCode.getScope() when we drop support for ESLint < 9.0.0

const messageIdNodesUnused = messageIdNodes.filter(
(node) => !messageIdsUsed.has(utils.getKeyName(node, scope))
(node) => !messageIdsUsed.has(utils.getKeyName(node, scope)),
);

// Report any messageIds that were never used.
Expand Down Expand Up @@ -93,7 +93,7 @@ module.exports = {
const reportMessagesAndDataArray =
utils.collectReportViolationAndSuggestionData(reportInfo);
for (const { messageId } of reportMessagesAndDataArray.filter(
(obj) => obj.messageId
(obj) => obj.messageId,
)) {
const values =
messageId.type === 'Literal'
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/no-unused-placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module.exports = {
obj.messageId.value,
ruleInfo,
scopeManager,
scope
scope,
);
if (correspondingMessage) {
obj.message = correspondingMessage.value;
Expand All @@ -85,7 +85,7 @@ module.exports = {
}

for (const { message, data } of reportMessagesAndDataArray.filter(
(obj) => obj.message
(obj) => obj.message,
)) {
const messageStaticValue = getStaticValue(message, scope);
if (
Expand All @@ -105,7 +105,7 @@ module.exports = {
PLACEHOLDER_MATCHER,
(fullMatch, term) => {
placeholdersInMessage.add(term);
}
},
);

data.properties.forEach((prop) => {
Expand Down
10 changes: 5 additions & 5 deletions lib/rules/no-useless-token-range.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,23 @@ module.exports = {
((isStartAccess(identifier.parent.parent.parent) &&
identifier.parent.property.name === 'getFirstToken') ||
(isEndAccess(identifier.parent.parent.parent) &&
identifier.parent.property.name === 'getLastToken'))
identifier.parent.property.name === 'getLastToken')),
)
.forEach((identifier) => {
const fullRangeAccess = isRangeAccess(
identifier.parent.parent.parent
identifier.parent.parent.parent,
)
? identifier.parent.parent.parent.parent
: identifier.parent.parent.parent;
const replacementText =
sourceCode.text.slice(
fullRangeAccess.range[0],
identifier.parent.parent.range[0]
identifier.parent.parent.range[0],
) +
sourceCode.getText(identifier.parent.parent.arguments[0]) +
sourceCode.text.slice(
identifier.parent.parent.range[1],
fullRangeAccess.range[1]
fullRangeAccess.range[1],
);
context.report({
node: identifier.parent.parent,
Expand All @@ -163,7 +163,7 @@ module.exports = {
fix(fixer) {
return fixer.replaceText(
identifier.parent.parent,
sourceCode.getText(identifier.parent.parent.arguments[0])
sourceCode.getText(identifier.parent.parent.arguments[0]),
);
},
});
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/prefer-message-ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ module.exports = {
const scope = sourceCode.getScope?.(ast) || context.getScope(); // TODO: just use sourceCode.getScope() when we drop support for ESLint < v9.0.0
contextIdentifiers = utils.getContextIdentifiers(
sourceCode.scopeManager,
ast
ast,
);

const metaNode = ruleInfo.meta;
const messagesNode =
metaNode &&
metaNode.properties &&
metaNode.properties.find(
(p) => p.type === 'Property' && utils.getKeyName(p) === 'messages'
(p) => p.type === 'Property' && utils.getKeyName(p) === 'messages',
);

if (!messagesNode) {
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/prefer-object-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports = {
) {
const openParenToken = sourceCode.getFirstToken(
ruleInfo.create,
(token) => token.type === 'Punctuator' && token.value === '('
(token) => token.type === 'Punctuator' && token.value === '(',
);

/* istanbul ignore if */
Expand All @@ -68,7 +68,7 @@ module.exports = {

yield fixer.replaceTextRange(
[ruleInfo.create.range[0], openParenToken.range[0]],
'{create'
'{create',
);
yield fixer.insertTextAfter(ruleInfo.create, '}');
} else if (ruleInfo.create.type === 'ArrowFunctionExpression') {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-output-null.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = {
function getTestInfo(key) {
if (test.type === 'ObjectExpression') {
return test.properties.find(
(item) => item.type === 'Property' && item.key.name === key
(item) => item.type === 'Property' && item.key.name === key,
);
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = {

const variable = findVariable(
scopeManager.acquire(messageNode) || scopeManager.globalScope,
messageNode
messageNode,
);

if (
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/prefer-replace-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = {
Program(ast) {
contextIdentifiers = utils.getContextIdentifiers(
sourceCode.scopeManager,
ast
ast,
);
},

Expand Down
Loading

0 comments on commit 95b1980

Please sign in to comment.