-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add git init and precommit hook for eslint #47
Conversation
Well done @ceejtron. Seems that is everything ok. Let's wait for the reviewers. Thank you for your contribution ❤️ |
@@ -22,7 +22,18 @@ const func = (cwd, folderName) => { | |||
} | |||
|
|||
const addEslintFileSuccess = (cwd, folderName) => { | |||
const command = `npm i eslint eslint-config-airbnb babel-eslint --save-dev` | |||
const eslintDependencies = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice Refactor mate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, nice work! I'm pretty happy to see a new hook 💃
hooks/git/index.js
Outdated
stdio:'inherit', | ||
} | ||
|
||
return spawn(command, [], terminalOpts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, We tried to find if has some issue on create-react-app related with that and I've found this PR facebook/create-react-app#1288
So, looks like that will be added at some moment, what do you think about test if already has a git started? maybe just test if exists .git folder.
Nice, @ceejtron! This is really cool! In addition, can you add Thank you for the contribution. |
Added a check for .git as well as a commitlint hook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just 2 minor things, then you will merge it! 💃
hooks/git/index.js
Outdated
console.log('\n\n') | ||
return Promise.resolve(true) | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please use else in the same line? 😄
hooks/commitlint/index.js
Outdated
|
||
return spawn(command, [], terminalOpts) | ||
}) | ||
.then(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do that as one line
.then(() => loadPackageJsonFromPath(
${cwd}/${folderName}/package.json))
@jouderianjr I pushed the changes you asked for |
Awesome @ceejtron thanks for your work 💃 |
As per #43 this adds precommit hooks for eslint. In addition, this adds a new question for initializing a git repository since precommit hooks can't be automatically set up unless a git repository has already been initialized.