0.4.8 • Published 4 years ago

@iceworks/doctor v0.4.8

Weekly downloads
34
License
-
Repository
-
Last release
4 years ago

Iceworks Doctor

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

1. Code Scanner

Installation

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

or

$ npm install -g @iceworks/doctor

Usage

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

$ iceworks-doctor -s ./

Options

$ 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 check your project.

.eslintrc.js customConfig will merge into ESLint config.

// .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 calculate complexity reports.

Repeatability

Use jscpd calculate repeatability reports.

2. Codemod

This repository also contains a collection of codemod scripts that help update React(ICE) and Rax APIs.

Installation

Install jscodeshift and @iceworks/doctor.

$ 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'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

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

Enjoy!

0.4.8

4 years ago

0.4.8-beta.13

4 years ago

0.4.8-beta.12

4 years ago

0.4.8-beta.11

4 years ago

0.4.8-beta.10

4 years ago

0.4.8-beta.14

4 years ago

0.4.8-beta.8

4 years ago

0.4.8-beta.7

4 years ago

0.4.8-beta.6

4 years ago

0.4.8-beta.5

4 years ago

0.4.8-beta.4

4 years ago

0.4.8-beta.3

4 years ago

0.4.8-beta.2

4 years ago

0.4.8-beta.1

4 years ago

0.4.8-beta.9

4 years ago

0.4.6-beta.7

4 years ago

0.4.6-beta.2

4 years ago

0.4.6-beta.1

4 years ago

0.4.6-beta.4

4 years ago

0.4.6-beta.3

4 years ago

0.4.6-beta.6

4 years ago

0.4.6-beta.5

4 years ago

0.4.7

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3-beta.1

4 years ago

0.4.3

4 years ago

0.4.2-1

4 years ago

0.4.2

4 years ago

0.4.2-0

4 years ago

0.4.1-0

4 years ago

0.4.1

4 years ago

0.4.0-0

4 years ago

0.4.0

4 years ago

0.3.2-beta.1

4 years ago

0.3.1

4 years ago

0.3.1-beta.2

4 years ago

0.3.1-beta.1

4 years ago

0.3.0

4 years ago

0.2.3

4 years ago

0.2.3-0

4 years ago

0.2.2-0

4 years ago

0.2.2

4 years ago

0.2.1-0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.5

4 years ago

0.1.5-beta.8

4 years ago

0.1.5-beta.7

4 years ago

0.1.5-beta.6

4 years ago

0.1.5-beta.5

4 years ago

0.1.5-beta.4

4 years ago

0.1.5-beta.3

4 years ago

0.1.5-beta.2

4 years ago

0.1.5-beta.1

4 years ago

0.1.4-beta.5

4 years ago

0.1.4

4 years ago

0.1.4-beta.3

4 years ago

0.1.4-beta.4

4 years ago

0.1.4-beta.2

4 years ago

0.1.4-beta.1

4 years ago

0.1.4-8

4 years ago

0.1.4-7

4 years ago

0.1.4-6

4 years ago

0.1.4-5

4 years ago

0.1.4-4

4 years ago

0.1.4-3

4 years ago

0.1.4-1

4 years ago

0.1.4-2

4 years ago

0.1.4-0

4 years ago

0.1.3

4 years ago

0.1.3-0

4 years ago

0.1.2

4 years ago

0.1.2-1

4 years ago

0.1.2-0

4 years ago

0.1.1

4 years ago

0.1.1-beta.5

4 years ago

0.1.1-beta.4

4 years ago

0.1.1-beta.3

4 years ago

0.1.1-beta.2

4 years ago

0.1.1-beta.1

4 years ago

0.1.0

4 years ago

0.1.0-beta.3

4 years ago

0.1.0-beta.2

4 years ago

0.1.0-beta.1

4 years ago