Skip to content
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,23 @@ $ delete-react-zombies

**Options**:

- `--path` define the path where search zombies (default=process.cwd)
- `--verbose` show in the console the file content to be deleted
- `--force` don't ask confirm before delete files.
- `--path` define the path where search zombies (default=process.cwd)
- `--verbose` show in the console the file content to be deleted
- `--force` don't ask confirm before delete files.
- `--ignoreNodeModules` skip looking in the node_modules folder
- `--absoluteImports` include the baseUrl in the path

## How it works

The package create a list of components in your application.
Based on that, the library search in your files content the keyword `import ${componentName}`, where the `componentName` variable is the name of the component that is exported.

## Absolute imports (baseUrl)

If your react project is configured to support [importing modules & components using absolute paths](https://create-react-app.dev/docs/importing-a-component/#absolute-imports) then turning this on will add the base url into the path & component name check.

> Note: If you also provide a path this will be ignored.

## Contributing

Check the [issue list](https://github.com/CVarisco/delete-react-zombies/issues) to contribute on some activities or to advice new features!
Expand Down
5 changes: 3 additions & 2 deletions components_test/mainComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from "react";
import ComponentUsed from "./componentUsed";
import ComponentUsed from "./ComponentUsed";
import ComponentImported from "./mixed/ComponentImported";

class Main extends React.Component {
render() {
return <ComponentUsed>Hello World</ComponentUsed>;
return <ComponentUsed>Hello World<ComponentImported /></ComponentUsed>;
}
}

Expand Down
9 changes: 9 additions & 0 deletions components_test/mixed/componentImported.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";

class ComponentImported extends React.Component {
render() {
return <h1>{this.props.children}</h1>;
}
}

export default ComponentImported;
9 changes: 9 additions & 0 deletions components_test/mixed/componentUnimported.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";

class ComponentUnimported extends React.Component {
render() {
return <h1>Not used</h1>;
}
}

export default ComponentUnimported;
Loading