Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ESLint #297

Merged
merged 2 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 2 additions & 1 deletion packages/eslint-plugin/lib/rules/class-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,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
8 changes: 0 additions & 8 deletions packages/eslint-plugin/tests/collision.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ new RuleTester({
{ messageId: 'collisionClass' },
{ messageId: 'collisionClass' }
]
},
{
code: `<div class="m:10@sm m:20@sm">collision</div>`,
output: `<div class="m:10@sm">collision</div>`,
errors: [
{ messageId: 'collisionClass' },
{ messageId: 'collisionClass' }
]
}
]
})
Loading