This repository has been archived by the owner on Jun 16, 2021. It is now read-only.
forked from streamich/git-cz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: ♻️ @jeromefitz/codestyle, prep for ts
lint: 🚨 update to codebase with new codestyle ✅️ all good prune: 🔥 renovate.json 🤷️ lint: 🚨 put back old rules (except where noted) and plugins Let's move "slowly" I guess typo: ✏️ lint-fix now since these scripts got updated
- Loading branch information
1 parent
4ad6b62
commit f88e83a
Showing
50 changed files
with
1,019 additions
and
761 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
tab_width = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.js] | ||
quote_type = single | ||
|
||
[{*.c,*.cc,*.h,*.hh,*.cpp,*.hpp,*.m,*.mm,*.mpp,*.js,*.java,*.go,*.rs,*.php,*.ng,*.jsx,*.ts,*.d,*.cs,*.swift}] | ||
curly_bracket_next_line = false | ||
spaces_around_operators = true | ||
spaces_around_brackets = outside | ||
# close enough to 1TB | ||
indent_brace_style = K&R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
/* eslint-disable filenames/match-regex */ | ||
const config = require('@jeromefitz/codestyle/.prettierrc.js') | ||
|
||
module.exports = { | ||
arrowParens: 'always', | ||
bracketSpacing: false, | ||
endOfLine: 'auto', | ||
printWidth: 85, | ||
semi: true, | ||
singleQuote: true, | ||
tabWidth: 2, | ||
trailingComma: 'all', | ||
}; | ||
...config, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#!/usr/bin/env node | ||
|
||
// eslint-disable-next-line import/no-unassigned-import, filenames/match-regex | ||
require('../dist/cli'); | ||
/* eslint-disable filenames/match-regex */ | ||
/* eslint-disable import/no-unassigned-import */ | ||
|
||
require('../dist/cli') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -513,4 +513,4 @@ | |
"semver": null | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./dist/cz'); | ||
module.exports = require('./dist/cz') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,76 @@ | ||
const chalk = require('chalk'); | ||
const InputPrompt = require('inquirer/lib/prompts/input'); | ||
const chalk = require('chalk') | ||
const InputPrompt = require('inquirer/lib/prompts/input') | ||
|
||
class LimitedInputPrompt extends InputPrompt { | ||
constructor(...args) { | ||
super(...args); | ||
super(...args) | ||
|
||
if (!this.opt.maxLength) { | ||
this.throwParamError('maxLength'); | ||
this.throwParamError('maxLength') | ||
} | ||
this.originalMessage = this.opt.message; | ||
this.spacer = new Array(this.opt.maxLength).fill('-').join(''); | ||
this.originalMessage = this.opt.message | ||
this.spacer = new Array(this.opt.maxLength).fill('-').join('') | ||
|
||
if (this.opt.leadingLabel) { | ||
if (typeof this.opt.leadingLabel === 'function') { | ||
this.leadingLabel = ' ' + this.opt.leadingLabel(this.answers); | ||
this.leadingLabel = ' ' + this.opt.leadingLabel(this.answers) | ||
} else { | ||
this.leadingLabel = ' ' + this.opt.leadingLabel; | ||
this.leadingLabel = ' ' + this.opt.leadingLabel | ||
} | ||
} else { | ||
this.leadingLabel = ''; | ||
this.leadingLabel = '' | ||
} | ||
|
||
this.leadingLength = this.leadingLabel.length; | ||
this.leadingLength = this.leadingLabel.length | ||
} | ||
|
||
remainingChar() { | ||
return this.opt.maxLength - this.leadingLength - this.rl.line.length; | ||
return this.opt.maxLength - this.leadingLength - this.rl.line.length | ||
} | ||
|
||
onKeypress() { | ||
if (this.rl.line.length > this.opt.maxLength - this.leadingLength) { | ||
this.rl.line = this.rl.line.slice(0, this.opt.maxLength - this.leadingLength); | ||
this.rl.cursor--; | ||
this.rl.line = this.rl.line.slice(0, this.opt.maxLength - this.leadingLength) | ||
this.rl.cursor-- | ||
} | ||
|
||
this.render(); | ||
this.render() | ||
} | ||
|
||
getCharsLeftText() { | ||
const chars = this.remainingChar(); | ||
const chars = this.remainingChar() | ||
|
||
if (chars > 15) { | ||
return chalk.green(`${chars} chars left`); | ||
return chalk.green(`${chars} chars left`) | ||
} else if (chars > 5) { | ||
return chalk.yellow(`${chars} chars left`); | ||
return chalk.yellow(`${chars} chars left`) | ||
} else { | ||
return chalk.red(`${chars} chars left`); | ||
return chalk.red(`${chars} chars left`) | ||
} | ||
} | ||
|
||
render(error) { | ||
let bottomContent = ''; | ||
let message = this.getQuestion(); | ||
let appendContent = ''; | ||
const isFinal = this.status === 'answered'; | ||
let bottomContent = '' | ||
let message = this.getQuestion() | ||
let appendContent = '' | ||
const isFinal = this.status === 'answered' | ||
|
||
if (isFinal) { | ||
appendContent = this.answer; | ||
appendContent = this.answer | ||
} else { | ||
appendContent = this.rl.line; | ||
appendContent = this.rl.line | ||
} | ||
|
||
message = `${message}\n\n[${this.spacer}] ${this.getCharsLeftText()}\n\n${ | ||
this.leadingLabel | ||
} ${appendContent}`; | ||
} ${appendContent}` | ||
|
||
if (error) { | ||
bottomContent = chalk.red('>> ') + error; | ||
bottomContent = chalk.red('>> ') + error | ||
} | ||
|
||
this.screen.render(message, bottomContent); | ||
this.screen.render(message, bottomContent) | ||
} | ||
} | ||
|
||
module.exports = LimitedInputPrompt; | ||
module.exports = LimitedInputPrompt |
Oops, something went wrong.