Skip to content

Commit

Permalink
Update ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
0Miles committed Oct 26, 2023
1 parent 434253d commit 51683b9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 19 deletions.
3 changes: 2 additions & 1 deletion packages/eslint-plugin/lib/rules/class-collision.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ module.exports = {
},
false,
false,
settings.ignoredKeys
settings.ignoredKeys,
context
)
}
return defineVisitors({ context, options, settings, config }, visitNode)
Expand Down
6 changes: 2 additions & 4 deletions packages/eslint-plugin/lib/rules/class-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ module.exports = {
messageId: 'disallowTraditionalClass',
data: {
message: `Disallow a traditional class \`${className}\`.`,
},
fix: function (fixer) {
return fixer.replaceTextRange([start, end], '')
}
})
}
Expand All @@ -59,7 +56,8 @@ module.exports = {
},
false,
false,
settings.ignoredKeys
settings.ignoredKeys,
context
)
}
return defineVisitors({ context, options, settings, config }, visitNode)
Expand Down
8 changes: 4 additions & 4 deletions packages/eslint-plugin/lib/utils/ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function extractClassnamesFromValue(classStr) {
* @param {Array} ignoredKeys Optional, set object keys which should not be parsed e.g. for `cva`
* @returns {void}
*/
function parseNodeRecursive(rootNode, childNode, cb, skipConditional = false, isolate = false, ignoredKeys = []) {
function parseNodeRecursive(rootNode, childNode, cb, skipConditional = false, isolate = false, ignoredKeys = [], context = null) {
// TODO allow vue non litteral
let originalClassNamesValue
let classNames
Expand Down Expand Up @@ -162,9 +162,9 @@ function parseNodeRecursive(rootNode, childNode, cb, skipConditional = false, is
originalClassNamesValue = childNode.value.raw
start = childNode.range[0]
end = childNode.range[1]
const txt = context.getSourceCode().getText(childNode)
prefix = astUtil.getTemplateElementPrefix(txt, originalClassNamesValue)
suffix = astUtil.getTemplateElementSuffix(txt, originalClassNamesValue)
const txt = context?.getSourceCode()?.getText(childNode) ?? ''
prefix = getTemplateElementPrefix(txt, originalClassNamesValue)
suffix = getTemplateElementSuffix(txt, originalClassNamesValue)
break
}
({ classNames } = extractClassnamesFromValue(originalClassNamesValue))
Expand Down
10 changes: 0 additions & 10 deletions packages/eslint-plugin/tests/collision.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ new RuleTester({
{ messageId: 'collisionClass' },
{ messageId: 'collisionClass' }
]
},
{
code: `<div class="m:10@sm m:20@sm m:10@md m:20@md">collision</div>`,
output: `<div class="m:10@sm m:10@md">collision</div>`,
errors: [
{ messageId: 'collisionClass' },
{ messageId: 'collisionClass' },
{ messageId: 'collisionClass' },
{ messageId: 'collisionClass' }
]
}
]
})

0 comments on commit 51683b9

Please sign in to comment.