eslint / generator-eslint

A Yeoman generator to help with ESLint development
Other
228 stars 50 forks source link

Shouldn't mocha be listed as a devDependency? #32

Closed pmcelhaney closed 7 years ago

pmcelhaney commented 8 years ago

I wasn't able to get the tests to run until I installed mocha-cli globally and mocha locally.

npm install -g mocha-cli
npm install --save-dev mocha

Maybe I'm missing something, but shouldn't mocha be included as a dev dependency? And can we avoid depending on the presence of the mocha command by referencing ./node_modules/mocha/bin/mocha directly?

alberto commented 8 years ago

It's listed as a devDependency: https://github.com/eslint/generator-eslint/blob/master/package.json#L38

Did you have problems running npm test?

pmcelhaney commented 8 years ago

Weird. I'm not getting that when I install from Yeoman.

~/code/temp-yo-test
$ yo eslint:plugin
? What is your name? pm
? What is the plugin ID? issue-32
? Type a short description of this plugin: testing issue 32
? Does this plugin contain custom ESLint rules? Yes
? Does this plugin contain one or more processors? No
   create lib/index.js
   create package.json
   create README.md

~/code/temp-yo-test
$ cat package.json 
{
  "name": "eslint-plugin-issue-32",
  "version": "0.0.0",
  "description": "testing issue 32",
  "keywords": [
    "eslint",
    "eslintplugin",
    "eslint-plugin"
  ],
  "author": "pm",
  "main": "lib/index.js",
  "scripts": {
    "test": "mocha"
  },
  "dependencies": {
    "requireindex": "~1.1.0"
  },
  "devDependencies": {
    "eslint": "~1.2.0"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "license": "ISC"
}
pmcelhaney commented 8 years ago

Oh. You pointed to the package.json of this repo. It actually needs to be added to the template.

https://github.com/eslint/generator-eslint/blob/master/plugin/templates/_package.json#L19

alberto commented 8 years ago

Yeah, sorry, I thought you were talking about this package, not the generated output. You are right we should add mocha as a devDependency. But since it is run from npm test I don't think there will be a problem referencing the mocha command directly.