jozefizso / generator-license

Yeoman Generator - License
MIT License
59 stars 20 forks source link

WIP: ESLintrc #57

Closed ek9 closed 7 years ago

ek9 commented 7 years ago

This commit adds eslintrc support ( #54 )

As we haven't discussed and decided on which code style to use, I have added xo-space (https://github.com/sindresorhus/eslint-config-xo-space) config as I believe this one is a decent choice.

As it throws a lot of linting errors, before doing refactoring of the code, I would like to get a review if this code is appropriate. We can keep the discussion on #54 issue.

Also, this is a WIP PR, partially based on #56 as it allows for easy integration. If #56 is merged, then this will only be 1 extra commit: https://github.com/ek9/generator-license/commit/7d8f7d683fdbd704ce2e6f00a8d86ce735ee19fa

SBoudrias commented 7 years ago

I'd prefer we don't use gulp. Maybe we can move the test runner to jest as it should be a pretty easy drop-in replacement for mocha.

SBoudrias commented 7 years ago

You can base yourself on this other generator for the ESLint setting https://github.com/SBoudrias/generator-jest/blob/master/package.json#L49

Also, if you feel like it, you could also add nsp check on the same PR given it's pretty similar setup.

ek9 commented 7 years ago

Just a quick comment:

There is no reason for eslint --fix to run AFTER the tests have passed. A standard developers workflow is:

  1. Edit code
  2. Run tests
  3. If tests pass, commit the code.

Now bringing eslint --fix in between steps 2 and 3 most of the time will introduce undesired changes. --fix should never be run automatically, especially as a posttest or pretest. The reason is simple - you should never combine code styling with functional changes together in one commit.