mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-10 08:37:00 +02:00
* Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License. Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUS-1.1 * Fix test that expected exact offset on hcl file --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Sarah Thompson <sthompson@hashicorp.com> Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
59 lines
1.8 KiB
JavaScript
59 lines
1.8 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
/* eslint-env node */
|
|
/**
|
|
* Codemod to convert args to attributes for Input and TextArea built in components
|
|
* eg. <Input @id="foo" /> -> <Input id="foo" />
|
|
*/
|
|
|
|
module.exports = () => {
|
|
// partial list of deprecated arguments
|
|
// complete list used by linter found at:
|
|
// https://github.com/ember-template-lint/ember-template-lint/blob/master/lib/rules/no-unknown-arguments-for-builtin-components.js
|
|
const deprecatedArgs = [
|
|
'@id',
|
|
'@name',
|
|
'@autocomplete',
|
|
'@spellcheck',
|
|
'@disabled', // not deprecated for LinkTo
|
|
'@class',
|
|
'@placeholder',
|
|
'@wrap',
|
|
'@rows',
|
|
'@readonly',
|
|
'@step',
|
|
'@min',
|
|
'@pattern',
|
|
];
|
|
return {
|
|
ElementNode(node) {
|
|
if (['Textarea', 'Input', 'LinkTo', 'ToolbarSecretLink', 'SecretLink'].includes(node.tag)) {
|
|
const attrs = node.attributes;
|
|
let i = 0;
|
|
while (i < attrs.length) {
|
|
// LinkTo uses disabled as named arg
|
|
// ensure that it is not present as attribute since link will still work
|
|
// since ToolbarSecretLink wraps SecretLink and SecretLink wraps LinkTo include them as well
|
|
const disabledAsArg = ['LinkTo', 'SecretLink', 'ToolbarSecretLink'].includes(node.tag);
|
|
if (disabledAsArg && attrs[i].name === 'disabled') {
|
|
attrs[i].name = '@disabled';
|
|
}
|
|
const arg = deprecatedArgs.find((name) => {
|
|
return node.tag.includes('SecretLink') || (node.tag === 'LinkTo' && name === '@disabled')
|
|
? false
|
|
: name === attrs[i].name;
|
|
});
|
|
if (arg) {
|
|
attrs[i].name = arg.slice(1);
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
},
|
|
};
|
|
};
|