Giter VIP home page Giter VIP logo

sortier's Introduction

Sortier

An opinionated Code Sorter

npm (scoped)

Sortier is an opinionated code sorter similar to how Prettier is a opinionated code formatter. Given a file, it parses then sorts and rearranges source code in a consistent way.

Documentation

Examples of what sortier will sort in JavaScript:

  • Import statements
  • Import specifiers
  • Union types
  • Keys and properties within objects and types
  • React JSX properties
  • And more!

It should work with JavaScript ES6, Flow, Typescript, HTML and Json but if you find a piece of code that after sorting doesn't look as expected, feel free to open an issue in Github!

How to run it

sortier "[glob-file-path]"

General things to keep in mind

  • Blank lines are treated as context breaks... Sortier will not sort through them
  • Comments will stay with the line they comment unless there is only one comment above all the lines of code

Example Input

// Imports are ordered by path
// ImportSpecifiers are also ordered

import {
    /* a2 comment */
    a2,
    /* a1 comment */
    a1 } from "./a";
// c2 import comment
import { c2 } from "c";
import { b3, b1 } from "./b";

// Blank lines act like context barriers and will divide sorting blocks
import { b2 } from "b1";

export type Props = {
  // Prop3 comment
  prop3: string;
  callback2: () => void;
  // Prop1 comment
  prop1: number;
  callback1(): void;

  // Since this is the only comment for this context block, this comment stays where it is
  prop4: boolean;
  prop2: boolean;
};

Example Output

// Imports are ordered by path
// ImportSpecifiers are also ordered

// c2 import comment
import { c2 } from "c";
import {
    /* a1 comment */
    a1,
    /* a2 comment */
    a2 } from "./a";
import { b1, b3 } from "./b";

// Blank lines act like context barriers and will divide sorting blocks
import { b2 } from "b1";

export type Props = {
  // Prop1 comment
  prop1: number;
  // Prop3 comment
  prop3: string;
  callback1(): void;
  callback2: () => void;

  // Since this is the only comment for this context block, this comment stays where it is
  prop2: boolean;
  prop4: boolean;
};

Options

And more to come!

Pre-commit Hook

See our Install documentation

Contributing

See ./CONTRIBUTING.md

sortier's People

Contributors

consistency-bot[bot] avatar dependabot[bot] avatar k2snowman69 avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tikitdo abanoubha

sortier's Issues

CSS sorting

We should handle css, scss and less file types!

Documentation website

We should build a website to document the product and help educate users on different settings and options.

What would be great is if we could animate and loop the examples of how they would actually sort to provide understanding of how the product works.

Remove ` extends JavascriptReprinterOptions` from ReprinterOptions

Since we're moving into the realm of supporting multiple languages, we should nest the options instead of have them all be on the root. We did the first step by adding a js property to the options but left the original extends JavascriptReprinterOptions for backwards compatibility.

export interface ReprinterOptions extends JavascriptReprinterOptions {
  // Default "false". If true, prints out very verbose lines that sortier doesn't know how to handle so you can open Github issues about them
  isHelpMode?: boolean;

  // Default "false". If true, sortier will run but not rewrite any files. Great for testing to make sure your code base doesn't have any weird issues before rewriting code.
  isTestRun?: boolean;

  // Default "normal". This overrides isHelpMode if set.
  //  - "quiet" - No console logs
  //  - "normal" - General information (e.g. if sortier was unable to parse a file)
  //  - "diagnostic" - All the above along with type information that sortier was unable to handle (great for opening bugs!)
  logLevel?: "diagnostic" | "normal" | "quiet";

  // Options for the javascript type languages
  js?: JavascriptReprinterOptions;
}

We should remove the extends in the next major breaking change and document it in the changelog.

Properties in an object are not always alphabetical

Language

Flow

Sample input source code

let value = {
   first: {
   },
   last: "asdfasdF",
};

Expected output

let value = {
   first: {
   },
   last: "asdfasdF",
};

Actual output (or error message)

let value = {
   last: "asdfasdF",
   first: {
   },
};

The overall question here is why isn't in alphabetical order like the rest of everything?

JS/Typescript/Flow - Add method sorting

There seems to be a few details for sorting methods that seem to be common for all sorting options implemented:

  • Static vs non-static types
  • Public vs Private (typescript's keyword and javascript's general use of underscore)
  • Properties vs Methods
  • React Lifecycle methods vs everything else
  • Ordering by usage
  • Ordering by definition (reverse usage)

There maybe other possible options, these are just several that pointed out to me while investigating

Incorrect sorting of case statements

Language

Flow

Sample input source code

// @flow
export type NodeActionType = "BLOCEMAIL" | "SEND_EMAIL" | "INCOMING";

function renderMessage() {
  switch ("BLOCEMAIL") {
    case ("BLOCEMAIL": NodeActionType):
    case ("SEND_EMAIL": NodeActionType): {
      console.log("hi");
      break;
    }
  }
}

Expected output

// @flow
export type NodeActionType = "BLOCEMAIL" | "SEND_EMAIL" | "INCOMING";

function renderMessage() {
  switch ("BLOCEMAIL") {
    case ("BLOCEMAIL": NodeActionType):
    case ("SEND_EMAIL": NodeActionType): {
      console.log("hi");
      break;
    }
  }
}

Actual output (or error message)

// @flow
export type NodeActionType = "BLOCEMAIL" | "INCOMING" | "SEND_EMAIL";

function renderMessage() {
  switch ("BLOCEMAIL") {
    case ("SEND_EMAIL": NodeActionType):
    case ("BLOCEMAIL": NodeActionType): {
      console.log("hi");
      break;
    }
  }
}

sortClassContents: Property functions being moved to the top

Language

Typescript

Sample input source code

export class Example {
  private getMemoizedSchema =() => {
  };
  private getMemoizedValues =() => {
  };
  public shouldComponentUpdate(
  ) {
  }
}

Expected output

export class Example {
  public shouldComponentUpdate(
  ) {
  }
  private getMemoizedSchema =() => {
  };
  private getMemoizedValues =() => {
  };
}

Actual output (or error message)

export class Example {
  private getMemoizedSchema =() => {
  };
  private getMemoizedValues =() => {
  };
  public shouldComponentUpdate(
  ) {
  }
}

Feature Request: Sort Switch Statements

Input:

function example() {
switch (d) {
  case 1:
    return false;
    break;
  case 0:
    return true;
    break;
  case 2:
    return true;
    break;
  default:
    return false;
};
}

Output:

function example() {
switch (d) {
  case 0:
    return true;
    break;
  case 1:
    return false;
    break;
  case 2:
    return true;
    break;
  default:
    return false;
};
}

Functions should be at bottom by default when sorting objects

Input:

    defaultProps = {
      a1: 'Workflow',
      a2: () => {},
      a3: () => {},
      a4: false,
   }

Expected output

    defaultProps = {
      a1: 'Workflow',
      a4: false,
      a2: () => {},
      a3: () => {},
   }

Actual:

    defaultProps = {
      a1: 'Workflow',
      a2: () => {},
      a3: () => {},
      a4: false,
   }

Sorting spread operators breaks source code

Input:

let { children, onHoverChange, className, ...popperProps } = this.props;

Expected:

let { children, className, onHoverChange, ...popperProps } = this.props;

Actual:

let { children, onHoverChange, className, ...popperProps } = this.props;

Content not being sorted

Language

Typescript

Sample input source code

export class ReactComponent {
  componentDidMount() {
    if (this.state.posts === undefined) {
      fetch(
        "fromUrl"
      )
        .then(response => response.json())
        .then(response => {
          let result: IPost[] = response.data.map(
            (value: { link?: string; created_time: Date; message: string }) => {
              return {
                link: value.link,
                contents: value.message,
                publishDateTime: moment(value.created_time)
              };
            }
          );
          this.setState({
            posts: result
          });
        })
        .catch(reason => {
          this.setState({ posts: null });
        });
    }
  }
}

Expected output

export class ReactComponent {
  componentDidMount() {
    if (this.state.posts === undefined) {
      fetch(
        "fromUrl"
      )
        .then(response => response.json())
        .then(response => {
          let result: IPost[] = response.data.map(
            (value: { created_time: Date; link?: string; message: string }) => {
              return {
                contents: value.message,
                link: value.link,
                publishDateTime: moment(value.created_time)
              };
            }
          );
          this.setState({
            posts: result
          });
        })
        .catch(reason => {
          this.setState({ posts: null });
        });
    }
  }
}

Actual output (or error message)

Same as input

Feature Request: Sort Enums

Input:

let d = "a" | "c" | "b" | "d" | null | undefined;

Output:

let d = null | undefined | "a" | "b" | "c" | "d";

Issue with sortClassContents

Language

Typescript

Sample input source code

export class Reprinter implements ILanguage {
  public static readonly SCSS_EXTENSIONS = [
    ".css",
    ".css.txt",
    ".scss",
    ".scss.txt"
  ];
  public static readonly LESS_EXTENSIONS = [".less", ".less.txt"];
  public static readonly EXTENSIONS = [
    ...Reprinter.SCSS_EXTENSIONS,
    ...Reprinter.LESS_EXTENSIONS
  ];
}

Expected output

export class Reprinter implements ILanguage {
  public static readonly LESS_EXTENSIONS = [".less", ".less.txt"];
  public static readonly SCSS_EXTENSIONS = [
    ".css",
    ".css.txt",
    ".scss",
    ".scss.txt"
  ];
  public static readonly EXTENSIONS = [
    ...Reprinter.SCSS_EXTENSIONS,
    ...Reprinter.LESS_EXTENSIONS
  ];
}

Actual output (or error message)

export class Reprinter implements ILanguage {
  public static readonly EXTENSIONS = [
    ...Reprinter.SCSS_EXTENSIONS,
    ...Reprinter.LESS_EXTENSIONS
  ];
  public static readonly LESS_EXTENSIONS = [".less", ".less.txt"];
  public static readonly SCSS_EXTENSIONS = [
    ".css",
    ".css.txt",
    ".scss",
    ".scss.txt"
  ];
}

Which is a build break:

[ts] Property 'SCSS_EXTENSIONS' is used before its initialization. [2729]

Cleanup publish output

The published output has quite a bit of extra information that is needed for debugging but not general usage. We should consider removing the following from publish

  • src/**/*
  • dist/**/index.js.map
  • Clean up the actual npmignore file

The last one has been started in the branch k2snowman69/cleanupPublish

Issue sorting case statements

Input:

let type: string = "ForStatement";
switch (type) {
    case "ImportDeclaration": {
        break;
    }

    case "IfStatement": {
        break;
    }
    case "ForStatement":
    case "WhileStatement":
    case "ForOfStatement": {
        break;
    }
    default:
      break;
}

Expected Output:

let type: string = "ForStatement";
switch (type) {
    case "IfStatement": {
        break;
    }
    case "ImportDeclaration": {
        break;
    }`
    case "ForStatement":
    case "WhileStatement":
    case "ForOfStatement": {
        break;
    }
    default:
      break;
}

Actual:
TypeError: Cannot read property 'range' of undefined
at Object.reorderValues (D:\Projects\sortier\src\common\sort-utils.ts:16:42)
at Object.sortSwitchCase (D:\Projects\sortier\src\sortSwitchCase\index.ts:142:27)
at Context.it (D:\Projects\sortier\src\sortSwitchCase\index.test.ts:70:26)
at callFn (D:\Projects\sortier\node_modules\mocha\lib\runnable.js:354:21)
at Test.Runnable.run (D:\Projects\sortier\node_modules\mocha\lib\runnable.js:346:7)
at Runner.runTest (D:\Projects\sortier\node_modules\mocha\lib\runner.js:442:10)
at D:\Projects\sortier\node_modules\mocha\lib\runner.js:560:12
at next (D:\Projects\sortier\node_modules\mocha\lib\runner.js:356:14)
at D:\Projects\sortier\node_modules\mocha\lib\runner.js:366:7
at next (D:\Projects\sortier\node_modules\mocha\lib\runner.js:290:14)
at Immediate._onImmediate (D:\Projects\sortier\node_modules\mocha\lib\runner.js:334:5)
at runCallback (timers.js:773:18)
at tryOnImmediate (timers.js:734:5)
at processImmediate [as _immediateCallback] (timers.js:711:5)

Flow sorting issue for typing

Input:

export type Data =
| $ReadOnly<{| +latter: string, +former: boolean|}>
| $ReadOnly<{| +differ: string, +former: boolean|}>
| $ReadOnly<{| +alternative: string, +former: boolean|}>;

Expected output:

export type Data =
| $ReadOnly<{| +alternative: string, +former: boolean|}>
| $ReadOnly<{| +differ: string, +former: boolean|}>
| $ReadOnly<{| +former: boolean, +latter: string|}>;

Sort jsx attributes

Input

return <input 
  onClick={() =>{}} 
  onBlur={() =>{}} />;

Output

return <input 
  onBlur={() =>{}}
  onClick={() =>{}} />;

Issue sorting values within an array

Language

Flow

Sample input source code

// @flow
class Example {
  static tabsConfig: TabConfig[] = [
    {
      title: "Details",
      id: "Details"
    }
  ];
}

Expected output

// @flow
class Example {
  static tabsConfig: TabConfig[] = [
    {
      id: "Details",
      title: "Details"
    }
  ];
}

Actual output (or error message)

// @flow
class Example {
  static tabsConfig: TabConfig[] = [
    {
      title: "Details",
      id: "Details"
    }
  ];
}

Function return types are not sorted

Input

export type Props = {
  callback2: () => "B" | "A",
  callback1(): "B" | "A",
}

Expected output

export type Props = {
  callback1(): "A" | "B",
  callback2: () => "A" | "B",
}

Actual output:
Same as input

Comment is moved when it should not be

Input

export type StoreData = {
  // Old store
  campaign?: any,

  // New store
  error?: null | string,
  bedrock: string,
};

Actual

export type StoreData = {
  // Old store
  campaign?: any,

  bedrock: string,
  // New store
  error?: null | string,
};

Expected

export type StoreData = {
  // Old store
  campaign?: any,

  // New store
  bedrock: string,
  error?: null | string,
};

Don't output information if not verbose

Language

All

General feature

Right now when you run sortier and you do not have a default config file you'll get the message "No valid sortier config file found. Using defaults...". Overall this isn't needed or useful unless you're running in a verbose mode.

Sorting values within BinaryExpressions

The example is a bit contrived but...

Language

JavaScript

Sample input source code

let result = 1 < [{ c: 'c', a: 'a'}].length;

Expected output

let result = 1 < [{ a: 'a', c: 'c'}].length;

Actual output (or error message)

let result = 1 < [{ c: 'c', a: 'a'}].length;

Templated types are not sorted

Input

export type StoreData = $DeepReadOnlyExact<{
  workflows?: string,
  bedrock: string,
}>;

Expected:

export type StoreData = $DeepReadOnlyExact<{
  bedrock: string,
  workflows?: string,
}>;

Actual

export type StoreData = $DeepReadOnlyExact<{
  workflows?: string,
  bedrock: string,
}>;

Sort within tags of a HTML file

Language

HTML

Sample input source code

<html>
  <head>
    <style>
      body {
        padding: 0px;
        margin: 0px;
      }
    </style>
  </head>
  <body>
  </body>
</html>

Expected output

<html>
  <head>
    <style>
      body {
        margin: 0px;
        padding: 0px;
      }
    </style>
  </head>
  <body>
  </body>
</html>

Actual output (or error message)

No sorting occurs

Bug: tslint code base failure

Language

Typescript

Sample input source code

// Ran into this when running sortier on tslint's codebase
let example: { rulesList: string[] | "all"; isEnabled: boolean; modifier: Modifier } | undefined = undefined;
type Modifier = "line" | "next-line" | undefined;

Expected output

// Ran into this when running sortier on tslint's codebase
let example: undefined | { isEnabled: boolean; modifier: Modifier; rulesList: string[] | "all" } = undefined;
type Modifier = undefined | "line" | "next-line";

Actual output (or error message)

// Ran into this when running sortier on tslint's codebase
let example: undefined | { isEnabled: boolean; modifier: Modifier rulesList: string[] | "all"; } = undefined;
type Modifier = undefined | "line" | "next-line";

Basically the semicolon is in the wrong place for some reason

Sorting switch statements requires multiple runs

Input

switch ('e') {
  case 'c':
  case 'a':
  case 'e':
    break;
  case 'b':
  case 'd':
  default:
    break;
}

Expected

switch ('e') {
  case 'a':
  case 'c':
  case 'e':
    break;
  case 'b':
  case 'd':
  default:
    break;
}

Actual

switch ('e') {
  case 'b':
  case 'd':
  default:
    break;

  case 'c':
  case 'a':
  case 'e':
    break;}

Sortier fails on jsx element spreads

Example code:

    let props = {
    };
      <svg className="sci-snowcoders-logo-image" {...props}>
      </svg>

Failure:

Sorting ./src/logo-image/component.tsx has failed!
If this is an issue with sortier please provide an issue in Github with minimal source code to reproduce the issue
TypeError: Cannot read property 'name' of undefined
    at element.nodes.slice.sort (D:\Temporary\SCI.Snowcoders.Client.Website\node_modules\@snowcoders\sortier\dist\sortJsxElement\index.js:10:53)

Switch case sorting is incorrect

Input:

/* Switch case example */
switch (1) {
  // This is the first context group
  case 4:
    break;
  case 3: 
    alert(3);
    // Leads into 2
  case 2:
    break;
    
  // This is the second context group
  case 7:
    break;
  case 4:
  case 5:
    break;
}

Expected output:

/* Switch case example */
switch (1) {
  // This is the first context group
  case 3:
    alert(3);
    // Leads into 2
  case 2:
    break;
  case 4:
    break;
    
  // This is the second context group
  case 4:
  case 5:
    break;
  case 7:
    break;
}

Missing estree support

Language: Flow

Here is a list of missing node handlers for the estree when run with isHelpMode: true

  • JSXText
  • TypeCastExpression
  • Super
  • SpreadProperty

Add issue template

Adding an issue template may help with resolving issues faster. It should have

  • Language
  • Input
  • Expected output
  • Actual output

Option to disable sorting JS arithmetic expressions

Sortier re-organizes arithmetic expressions which may be ordered in a particular way based on the formulae being applied. The resulting code can lose a lot of implicit meaning without offering any particular benefits. An option to disable this particular sorting behavior would be really helpful.

Language

Javascript

Sample Input

Trying a sort on a file that calculates 5 times the area of a circle

const example = 2 * pi * distance * distance * 5

Expected output

Expecting no change

const example = 2 * pi * distance * distance * 5

Actual output

Actual result is a blob made up of all the components. This is particularly an issue with longer, more complex calculations which can become practically illegible after sorting.

const example = 2 * 5 * distance * distance * pi

ImportDefaultSpecifiers being moved causing a build failure

Language

Typescript, Flow, JavaScript

Sample input source code

import React, { Component } from 'react';

Expected output

import React, { Component } from 'react';

Actual output (or error message)

import Component, { React } from 'react';

Sort type and interface properties

So something like this:

export interface ExternalProps {
   d: string;
   b: string;
   c: string;
   a: string;
}

Turns into this:

export interface ExternalProps {
   a: string;
   b: string;
   c: string;
   d: string;
}

Add HTML sorting

Language

HTML

Sample input source code

<!DOCTYPE html>
<html>
    <head>
        <meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript">
        <meta charset="UTF-8" />
        <style>
            body {
                margin: 0px;
            }
        </style>
        <title>React UI Base - Localhost</title>
        <style>
            body {
                border: 0px;
            }
        </style>
    </head>

    <body>
        <!-- Dependencies (15)
        <script src="../node_modules/react/dist/react.js"></script>
        <script src="../node_modules/react-dom/dist/react-dom.js"></script>
        -->

        <!-- Dependencies (16) -->
        <script src="../node_modules/react/umd/react.development.js"></script>
        <script src="../node_modules/react-dom/umd/react-dom.development.js"></script>

        <!-- Main -->
        <script src="../dist/main.js"></script>
    </body>
</html>

Expected output

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta content="HTML, CSS, XML, XHTML, JavaScript" name="keywords">
        <style>
            body {
                margin: 0px;
            }
        </style>
        <style>
            body {
                border: 0px;
            }
        </style>
        <title>React UI Base - Localhost</title>
    </head>

    <body>
        <!-- Dependencies (15)
        <script src="../node_modules/react/dist/react.js"></script>
        <script src="../node_modules/react-dom/dist/react-dom.js"></script>
        -->

        <!-- Dependencies (16) -->
        <script src="../node_modules/react/umd/react.development.js"></script>
        <script src="../node_modules/react-dom/umd/react-dom.development.js"></script>

        <!-- Main -->
        <script src="../dist/main.js"></script>
    </body>
</html>

Important things to remember

  • We must maintain the general order of tags. For example
    • The order that stylesheets are linked into the html file actually matters
    • The order that javascript files are linked into the html file actually matters
    • The order that style tags are defined matters
    • The order that script tags are defined matters

And probably other situations I'm completely missing

Absolute import paths should be before relative

I think there maybe a but regarding imports at the top of the file...

Input:
import "hello";
import "./hello";

Expected:
import "hello";
import "./hello";

Actual:
import "./hello";
import "hello";

Bug: TSLint code base issues due to comments on right

Language

Typescript

Sample input source code

// https://github.com/snowcoders/sortier/issues/264
// Things to note:
// - Comment "Recurse through these..." is expected to match with DeleteExpression as there are multiple comments in the case block
// - Comment "Allow stringification..." stays on the 5th line of the case block as we don't move comments to the right of lines
switch ("wheee") {
    case ts.SyntaxKind.ThisKeyword:
    case ts.SyntaxKind.Identifier:
        return anyOk ? false : this.check(node as ts.Expression);
    // Recurse through these, but ignore the immediate child because it is allowed to be 'any'.
    case ts.SyntaxKind.DeleteExpression:
    case ts.SyntaxKind.ExpressionStatement:
    case ts.SyntaxKind.TypeAssertionExpression:
    case ts.SyntaxKind.AsExpression:
    case ts.SyntaxKind.TemplateSpan: // Allow stringification (works on all values). Note: tagged templates handled differently.
    case ts.SyntaxKind.TypeOfExpression:
    case ts.SyntaxKind.VoidExpression:
        return this.visitNode(
            (node as
                | ts.ExpressionStatement
                | ts.AssertionExpression
                | ts.TemplateSpan
                | ts.TypeOfExpression
                | ts.VoidExpression).expression,
            true,
        );
}

Expected output

// https://github.com/snowcoders/sortier/issues/264
// Things to note:
// - Comment "Recurse through these..." is expected to match with DeleteExpression as there are multiple comments in the case block
// - Comment "Allow stringification..." stays on the 5th line of the case block as we don't move comments to the right of lines
switch ("wheee") {
    case ts.SyntaxKind.AsExpression:
    // Recurse through these, but ignore the immediate child because it is allowed to be 'any'.
    case ts.SyntaxKind.DeleteExpression:
    case ts.SyntaxKind.ExpressionStatement:
    case ts.SyntaxKind.TemplateSpan:
    case ts.SyntaxKind.TypeAssertionExpression: // Allow stringification (works on all values). Note: tagged templates handled differently.
    case ts.SyntaxKind.TypeOfExpression:
    case ts.SyntaxKind.VoidExpression:
        return this.visitNode(
            (node as
                | ts.ExpressionStatement
                | ts.AssertionExpression
                | ts.TemplateSpan
                | ts.TypeOfExpression
                | ts.VoidExpression).expression,
            true,
        );
    case ts.SyntaxKind.Identifier:
    case ts.SyntaxKind.ThisKeyword:
        return anyOk ? false : this.check(node as ts.Expression);
}

Actual output (or error message)

Build break due to broken comment

Double spread causes a crash

Input

return <input prop1={1} prop2={2} {...{}} {...{}}  prop3={3} prop4={4} />;

Actual:
at element.nodes.slice.sort (D:\Projects\sortier\src\sortJsxElement\index.ts:30:23)
at Array.sort (native)
at groupings.forEach.element (D:\Projects\sortier\src\sortJsxElement\index.ts:29:49)
at Array.forEach ()
at Object.sortJsxElement (D:\Projects\sortier\src\sortJsxElement\index.ts:27:15)
at Context.it (D:\Projects\sortier\src\sortJsxElement\index.test.ts:72:26)

TypeError: Expected `cwd` to be of type `string` but received type `undefined`

Language

All

Input

Running sortier results in the following failure when running with dir-glob 2.2.x

TypeError: Expected `cwd` to be of type `string` but received type `undefined`
    at module.exports.sync (/Users/ricpatel/dev/payx/website/node_modules/dir-glob/index.js:60:9)
    at globDirs (/Users/ricpatel/dev/payx/website/node_modules/globby/index.js:58:9)
    at getPattern (/Users/ricpatel/dev/payx/website/node_modules/globby/index.js:61:64)
    at globTasks.reduce (/Users/ricpatel/dev/payx/website/node_modules/globby/index.js:107:19)
    at Array.reduce (<anonymous>)
    at Function.module.exports.sync (/Users/ricpatel/dev/payx/website/node_modules/globby/index.js:106:26)
    at Object.run (/Users/ricpatel/dev/payx/website/node_modules/@snowcoders/sortier/dist/cli/index.js:17:18)
    at Object.<anonymous> (/Users/ricpatel/dev/payx/website/node_modules/@snowcoders/sortier/bin/index.js:5:24)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)

Possibly related to kevva/dir-glob#15 but still seeing the issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.