# @iceworks/doctor

> Analyse and running codemods over react/rax projects, troubleshooting and automatically fixing errors

Latest version **0.4.8** (published 2021-04-25) · 0 weekly downloads

## Install

```sh
npm install @iceworks/doctor
pnpm add @iceworks/doctor
yarn add @iceworks/doctor
bun add @iceworks/doctor
```

Provides the command `iceworks-doctor`.

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.8 |
| Published | 2021-04-25 |
| First published | 2020-08-02 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 50 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | yuanyan, sobear, empireo, alvinhui, rax-publisher, luhengchang228, fyangstudio |
| Keywords | doctor, analysis, codemod, lint, troubleshooting |

## Links

- npm: https://www.npmjs.com/package/@iceworks/doctor
- npm.io page: https://npm.io/package/@iceworks/doctor

## Dependencies (15)

- [glob](https://npm.io/package/glob.md) ^7.1.6
- [execa](https://npm.io/package/execa.md) ^4.1.0
- [jscpd](https://npm.io/package/jscpd.md) ^3.3.3
- [eslint](https://npm.io/package/eslint.md) ^7.22.0
- [ignore](https://npm.io/package/ignore.md) ^5.1.8
- [moment](https://npm.io/package/moment.md) ^2.29.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.0.1
- [stylelint](https://npm.io/package/stylelint.md) ^13.7.0
- [argv-parse](https://npm.io/package/argv-parse.md) ^1.0.1
- [typescript](https://npm.io/package/typescript.md) ^3.0.0
- [@jscpd/core](https://npm.io/package/@jscpd/core.md) ^3.3.3
- [@babel/parser](https://npm.io/package/@babel/parser.md) ^7.12.5
- [@iceworks/spec](https://npm.io/package/@iceworks/spec.md) ^1.0.2
- [@babel/traverse](https://npm.io/package/@babel/traverse.md) ^7.12.5
- [typhonjs-escomplex](https://npm.io/package/typhonjs-escomplex.md) ^0.1.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 0.4.8 (latest) — 2021-04-25
- 0.4.8-beta.14 (beta) — 2021-04-25
- 0.4.8-beta.13 — 2021-04-25
- 0.4.8-beta.12 — 2021-04-23
- 0.4.8-beta.11 — 2021-04-23
- 0.4.8-beta.10 — 2021-04-23
- 0.4.8-beta.9 — 2021-04-23
- 0.4.8-beta.8 — 2021-04-23
- 0.4.8-beta.7 — 2021-04-22
- 0.4.8-beta.6 — 2021-04-22
- 0.4.8-beta.5 — 2021-04-22
- 0.4.8-beta.4 — 2021-04-22
- 0.4.8-beta.3 — 2021-04-22
- 0.4.8-beta.2 — 2021-04-22
- 0.4.8-beta.1 — 2021-04-21
- … 71 more at https://npm.io/package/@iceworks/doctor/versions

## README

# Iceworks Doctor

Analyse and running codemods over react/rax projects, troubleshooting and automatically fixing errors.  
## 1. Code Scanner

### Installation

```shell
$ npm i @iceworks/doctor --save-dev
```

or

```shell
$ npm install -g @iceworks/doctor
```

### Usage

```js
const { Doctor } = require('@iceworks/doctor');

const doctor = new Doctor(options);
doctor.scan('/yourProjectPath').then((result) => {
  console.log(result);
});

```

### Usage(CLI)

Use `$ iceworks-doctor -h` for help.

Scan
```shell
$ iceworks-doctor -s ./
```

Options
```shell
$ iceworks-doctor -s ./ --ignore types mock
```

### Options

#### new Doctor(options?);

* ignore?: string[], Ignore directories, example ['mock'] . `.gitignore` will work too.

#### scan('/yourProjectPath', options?);

* fix?: boolean, whether fix ESLint fixable problems.
* framework?: string, target project framework, default is `react`.
* languageType?: 'js'|'ts', target project languageType, default is `js`.
* tempFileDir?: string, set temp reporters file directory, default is `node_modules/@iceworks/doctor/tmp/`.
* disableESLint?: boolean, whether disable ESLint part reports.
* disableMaintainability?: boolean, whether disable maintainability part reports.
* disableRepeatability?: boolean, whether disable repeatability part reports.

### Result

#### ESLint

Use [@iceworks/spec](https://www.npmjs.com/package/@iceworks/spec) check your project. 

`.eslintrc.js` customConfig will merge into ESLint config.

```js
// .eslintrc.js
const { getESLintConfig } = require('@iceworks/spec');
 
// getESLintConfig(rule: 'rax'|'react', customConfig?);
module.exports = getESLintConfig('react', {
  'no-unused-vars': 'off'
});
```
`.eslintignore` ignore config will merge into ESLint ignore.

#### Maintainability

Use [typhonjs-escomplex](https://www.npmjs.com/package/typhonjs-escomplex) calculate complexity reports.

#### Repeatability

Use [jscpd](https://www.npmjs.com/package/jscpd) calculate repeatability reports.

## 2. Codemod

This repository also contains a collection of codemod scripts that help update React([ICE](https://ice.work/)) and [Rax](https://rax.js.org/) APIs.

### Installation

Install [jscodeshift](https://www.npmjs.com/package/jscodeshift) and @iceworks/doctor.

```shell
$ npm i -g jscodeshift @iceworks/doctor 
```

### Usage (CLI)

`iceworks-doctor -c <transform> <path?> [...options?]`

   * `transform` - name of transform, see available transforms below.
   * `path?` - files or directory to transform. 
   * `options?` - some rule's options.

This will start an interactive wizard, and then run the specified transform.

PS: You can also clone this repository then use [jscodeshift](https://www.npmjs.com/package/jscodeshift)'s CLI API.

### Included Transforms

#### `plugin-rax-component-to-component`

Update `plugin-rax-component` to `plugin-component`.
See: https://rax.js.org/docs/guide/com-migration

```shell
iceworks-doctor -c plugin-rax-component-to-component ./
```

Enjoy!

---
_Source: https://npm.io/package/@iceworks/doctor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
