-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(generators): made enhancements to generator files (#719)
* chore(generators): made enhancements to generator files * Updated generator for default imports
- Loading branch information
1 parent
578475a
commit 4c7d9da
Showing
9 changed files
with
126 additions
and
114 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function betterStringSort(a: string, b: string) { | ||
return a.toLowerCase().localeCompare(b.toLowerCase()); | ||
} | ||
|
||
module.exports = { betterStringSort }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/eslint-plugin-pf-codemods/src/rules/helpers/nodeMatches.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { | ||
JSXOpeningElement, | ||
ImportSpecifier, | ||
ImportDefaultSpecifier, | ||
} from "estree-jsx"; | ||
|
||
export function checkMatchingJSXOpeningElement( | ||
node: JSXOpeningElement, | ||
imports: | ||
| ImportSpecifier | ||
| ImportDefaultSpecifier | ||
| (ImportSpecifier | ImportDefaultSpecifier)[] | ||
) { | ||
if (Array.isArray(imports)) { | ||
return ( | ||
node.name.type === "JSXIdentifier" && | ||
imports.map((imp) => imp.local.name).includes(node.name.name) | ||
); | ||
} | ||
|
||
return ( | ||
node.name.type === "JSXIdentifier" && imports.local.name === node.name.name | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters