JSPM

@whalecloud/doctor

0.0.4
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • 0
    • Score
      100M100P100Q25136F

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

    Package Exports

    • @whalecloud/doctor
    • @whalecloud/doctor/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@whalecloud/doctor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    AppWorks Doctor

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

    1. Code Scanner

    Installation

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

    or

    $ npm install -g @appworks/doctor

    Usage

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

    Usage(CLI)

    Use $ appworks-doctor -h for help.

    Scan

    $ appworks-doctor -s ./

    Options

    $ appworks-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.
    • transforms?: string[], you want to run code transform keys, from @appworks/codemod
    • languageType?: 'js'|'ts', target project languageType, default is js.
    • tempFileDir?: string, set temp reporters file directory, default is node_modules/@appworks/doctor/tmp/.
    • disableESLint?: boolean, whether disable ESLint part reports.
    • disableMaintainability?: boolean, whether disable maintainability part reports.
    • disableRepeatability?: boolean, whether disable repeatability part reports.
    • disableCodemod?: boolean, whether disable codemod 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.

    Codemod

    Use @appworks/codemod check and update Rax and React deprecated usages.

    Enjoy!