diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..85482e8 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +CHANGELOG.md +dist/** +package-lock.json +docs/images diff --git a/README.md b/README.md index 82bb64c..84dc3de 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,8 @@ For greater convenience, you may wish to add a script to your `package.json`: // ... "scripts": { // ... - "import-graph-visualizer": "import-graph-visualizer --entry-points path/to/entry/module ..." - } + "import-graph-visualizer": "import-graph-visualizer --entry-points path/to/entry/module ...", + }, } ``` @@ -98,4 +98,4 @@ npm install --save-dev vscode-material-icons@latest --- -made with ❤ by [push-based.io](https://www.push-based.io) \ No newline at end of file +made with ❤ by [push-based.io](https://www.push-based.io) diff --git a/package-lock.json b/package-lock.json index df604bc..259116b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "@rx-angular/import-graph-visualizer", - "version": "0.2.0", + "version": "0.2.2", "license": "MIT", "dependencies": { "@material-ui/core": "^4.11.3", @@ -17,6 +17,7 @@ "match-sorter": "^6.3.0", "open": "^8.0.5", "ora": "^5.4.0", + "prettier": "^3.4.2", "react": "^17.0.1", "react-dom": "^17.0.1", "react-router-dom": "^5.2.0", @@ -6689,6 +6690,20 @@ "node": ">=0.10.0" } }, + "node_modules/prettier": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", + "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-error": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.2.tgz", diff --git a/package.json b/package.json index ff83104..ff48909 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "build": "npm run build:app && npm run build:cli", "build:app": "webpack --mode production", "build:cli": "tsc src/cli/main.ts --strict --esModuleInterop --outDir dist/cli", + "format": "prettier .", "reporter": "npm run build:cli && node dist/cli/reporter.js", "release": "standard-version", "release:dry-run": "standard-version --dry-run" @@ -52,6 +53,7 @@ "match-sorter": "^6.3.0", "open": "^8.0.5", "ora": "^5.4.0", + "prettier": "^3.4.2", "react": "^17.0.1", "react-dom": "^17.0.1", "react-router-dom": "^5.2.0", diff --git a/src/app/components/SelectModules.tsx b/src/app/components/SelectModules.tsx index 72aab1b..fb5dba2 100644 --- a/src/app/components/SelectModules.tsx +++ b/src/app/components/SelectModules.tsx @@ -57,37 +57,36 @@ const OuterElementType = forwardRef((props, ref) => { }); // Adapter for react-window -const ListboxComponent = forwardRef(function ListboxComponent( - props, - ref, -) { - const { children, ...other } = props; - const itemData = Children.toArray(children); - const theme = useTheme(); - const smUp = useMediaQuery(theme.breakpoints.up('sm'), { noSsr: true }); - const itemCount = itemData.length; - const itemSize = smUp ? 36 : 48; - const height = Math.min(itemCount, 8) * itemSize + 2 * LISTBOX_PADDING; +const ListboxComponent = forwardRef( + function ListboxComponent(props, ref) { + const { children, ...other } = props; + const itemData = Children.toArray(children); + const theme = useTheme(); + const smUp = useMediaQuery(theme.breakpoints.up('sm'), { noSsr: true }); + const itemCount = itemData.length; + const itemSize = smUp ? 36 : 48; + const height = Math.min(itemCount, 8) * itemSize + 2 * LISTBOX_PADDING; - return ( -
- - - {renderRow} - - -
- ); -}); + return ( +
+ + + {renderRow} + + +
+ ); + }, +); function renderOption(option: Module) { const iconSrc = option.isLocal diff --git a/src/app/index.html b/src/app/index.html index be3f583..e0ad672 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -1,4 +1,4 @@ - + diff --git a/src/app/utils/parsers.ts b/src/app/utils/parsers.ts index 53004e9..3db957b 100644 --- a/src/app/utils/parsers.ts +++ b/src/app/utils/parsers.ts @@ -44,19 +44,17 @@ export function parseModuleDeps(result: ICruiseResult): ModuleDeps { }); const allModules = result.modules - .map( - (module): Module => { - const npmPackageName = npmPackageNames.get(module.source); - const alias = aliases.get(module.source); - const isLocal = localModules.has(module.source); - return { - path: npmPackageName ?? module.source, - source: module.source, - isLocal, - ...(alias && { alias }), - }; - }, - ) + .map((module): Module => { + const npmPackageName = npmPackageNames.get(module.source); + const alias = aliases.get(module.source); + const isLocal = localModules.has(module.source); + return { + path: npmPackageName ?? module.source, + source: module.source, + isLocal, + ...(alias && { alias }), + }; + }) .filter( (item, index, array) => array.findIndex(({ path }) => path === item.path) === index,