mirror of
https://github.com/harness/drone.git
synced 2025-05-02 21:55:27 +00:00
28 lines
669 B
JavaScript
28 lines
669 B
JavaScript
const { get } = require('lodash')
|
|
const toolTipValuesMap = {}
|
|
module.exports = {
|
|
meta: {
|
|
docs: {
|
|
description: `Give warning for duplicate tooltip id's'`
|
|
}
|
|
},
|
|
|
|
create: function (context) {
|
|
return {
|
|
JSXAttribute(node) {
|
|
if (get(node, 'name.name') === 'data-tooltip-id' && get(node, 'value.type') === 'Literal') {
|
|
if (toolTipValuesMap[get(node, 'value.value')]) {
|
|
return context.report({
|
|
node,
|
|
message: 'Duplicate tooltip id'
|
|
})
|
|
} else {
|
|
toolTipValuesMap[get(node, 'value.value')] = true
|
|
}
|
|
}
|
|
return null
|
|
}
|
|
}
|
|
}
|
|
}
|