Giter Site home page Giter Site logo

create-xo's Introduction

create-xo

Add XO to your project

CLI

npm init xo [options]

Example:

npm init xo --space --no-semicolon

API

Usage

import createXo from 'create-xo';

await createXo();

createXo(options?)

Returns a Promise.

options

Type: object

cwd

Type: string
Default: process.cwd()

The current working directory.

args

Type: string[]
Default: CLI arguments (process.argv.slice(2))

The options to put in XO's config in package.json.

For instance, with the arguments ['--space', '--env=node'], the following will be put in package.json:

{
	"name": "awesome-package",
	"xo": {
		"space": true,
		"envs": [
			"node"
		]
	}
}

create-xo's People

Contributors

07gond avatar cbargren avatar dflupu avatar dimava avatar haroenv avatar joakimbeng avatar kevva avatar ntwb avatar richienb avatar sindresorhus 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

create-xo's Issues

Generate .editorconfig file

I think it's a good practice to have an .editorconfig file and it is supported by most editor and I usually have to copy it everytime I start a new project.

It would be nice if xo --init could generate an .editorconfig file automatically, or have an option to generate it.

Initializing in a workspace fails

Running the init command in a workspace repository fails because of a missing -W flag. The following error is printed:

Error: Command failed: yarn add --dev xo
error Running this command will add the dependency to the workspace root rather than workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).
yarn add v1.2.1
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

at Promise.all.then.arr (/Users/chrisbargren/Projects/my-workspace/node_modules/xo-init/node_modules/execa/index.js:201:11)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

Windows 10 | Error: spawn npm ENOENT

Steps to reproduce:

  • npm i -g xo
  • cd to project directory
  • xo --init --space --esnext --env=node

Node: v4.0.0
NPM: 2.14.2

Error:

Error: spawn npm ENOENT
    at exports._errnoException (util.js:837:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at doNTCallback2 (node.js:429:9)
    at process._tickCallback (node.js:343:17)
    at Function.Module.runMain (module.js:477:11)
    at startup (node.js:117:18)
    at node.js:951:3

In the package.json all rules are added, except for the xo in the dependencies section (logically expect ▪️).

question: how about using npm lifecycle scripts?

I myself prefer having the ability to run the linting on a project as a separate task without running the tests, e.g. npm run lint. And then automatically running the linting before the tests using the pretest lifecycle script in package.json.

So what do you think about adding xo to its own script and also add a pretest script, for instance like this:

{
  "scripts": {
    "lint": "xo",
    "pretest": "npm run -s lint"
  }
}

Instead of adding it to the test script like now. What's your opinion on this?

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.