open-vault/ui/scripts/codemods/linkto-with-on-modifier.js
Hamid Ghaf 27bb03bbc0
adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00

26 lines
619 B
JavaScript

#!/usr/bin/env node
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
/* eslint-env node */
// print to console all files that include LinkTo elements using the {{on modifier}}
module.exports = (env) => {
let fileAlerted;
return {
ElementNode(node) {
if (node.tag === 'LinkTo') {
if (!fileAlerted) {
const usesModifier = node.modifiers.find((modifier) => modifier.path.original === 'on');
if (usesModifier) {
console.log(env.filePath); // eslint-disable-line
fileAlerted = true;
}
}
}
},
};
};