Skip to content

Commit 9f87209

Browse files
committed
remove(main): remove typo check (close #2)
#2
1 parent 90b88a8 commit 9f87209

6 files changed

Lines changed: 4 additions & 82 deletions

File tree

.git_consistent

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ subject:
6666
firstLatter: lower
6767
dotAtEnd: false
6868
nonAscii: false
69-
issueKeyword
69+
issueKeyword:
7070
type: branch
7171
required: false
7272
description: 'Github issue link'

README.adoc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -246,18 +246,6 @@ Date: Sat Feb 10 17:40:33 2018 +0900
246246
This is test.
247247
----
248248

249-
250-
==== spell check
251-
252-
With `-t` option.
253-
254-
[source,shell]
255-
----
256-
$ git consistent -t --type="feat" --scope="" --subject="this is some text we want to ceck for typos"
257-
git commit -m "feat: this is some text we want to ceck for typos"
258-
Is 'ceck' misspelled? Did you mean that? 'check', 'ceca', 'neck', 'cock', 'deck', 'peck', 'heck', 'beck', 'Peck', 'Beck', 'Keck'
259-
----
260-
261249
==== emoji
262250

263251
[source,yml]
@@ -412,9 +400,6 @@ link:https://github.com/isuke/git-consistent/blob/master/sample_type_list.adoc[s
412400
| `-S, --silent`
413401
| don't show commit command
414402

415-
| `-t, --typo-check`
416-
| check spell
417-
418403
| `-V, --version`
419404
| output the version number
420405
|===

git-consistent

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ try {
6767
.option(`-D, --dry-run`, 'run dry-run mode')
6868
.option(`-i, --interactive`, 'run interactive mode')
6969
.option(`-S, --silent`, "don't show commit command")
70-
.option(`-t, --typo-check`, "check spell")
70+
.option(`-t, --typo-check`, "[Already deleted this function] check spell")
7171
.option(`--gen-config`, "generate config files")
7272
.version(version)
7373

lib/main.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ const fs = require('fs')
33
const _ = require('lodash')
44
const execSync = require('child_process').execSync
55
const inquirer = require('inquirer');
6-
const spellcheck = require('nodehun-sentences')
7-
const nodehun = require('nodehun')
86
const emoji = require('node-emoji')
97

108
const colors = require('./colors')
@@ -30,23 +28,6 @@ const checkAddedFile = () => {
3028
if (_.isEmpty(addedFiles)) throw new Error(`no changes added to commit.`)
3129
}
3230

33-
const checkSpell = (message) => {
34-
const dictionaryBase = path.dirname(require.resolve('dictionary-en-us'))
35-
const hunspell = new nodehun(
36-
fs.readFileSync(path.join(dictionaryBase, 'index.aff')),
37-
fs.readFileSync(path.join(dictionaryBase, 'index.dic'))
38-
)
39-
40-
spellcheck(hunspell, message, (e, typos) => {
41-
if (e) throw e
42-
43-
_.forEach(typos, (typo) => {
44-
process.stdout.write(`${colors.warning}Is '${typo.word}' misspelled? ${colors.reset}`)
45-
console.log(`${colors.warning}Did you mean that? ${typo.suggestions.map((s) => { return `'${s}'` }).join(', ')}${colors.reset}`)
46-
})
47-
})
48-
}
49-
5031
const createChoicesNames = (values) => {
5132
const maxLength = _(values).map('name').map((n) => { return n.length }).max()
5233

@@ -249,7 +230,7 @@ module.exports = (program, template, definitions, terms) => {
249230
if (!program.dryRun) checkAddedFile()
250231

251232
replaceTerms(program, template, definitions, terms, (commitMessage) => {
252-
if (program.typoCheck) checkSpell(commitMessage)
233+
if (program.typoCheck) console.log(`${colors.warning}[Already Deleted Warning] '--typo-check' option is already deleted. sorry.${colors.reset}`)
253234

254235
gitCommit(commitMessage.trim(), program.duet, program.silent, program.dryRun)
255236
})

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,10 @@
2121
"dependencies": {
2222
"commander": "^2.14.1",
2323
"csv-parse": "^2.0.4",
24-
"dictionary-en-us": "^2.0.0",
2524
"inquirer": "^5.1.0",
2625
"js-yaml": "^3.10.0",
2726
"lodash": "^4.17.5",
2827
"node-emoji": "^1.8.1",
29-
"nodehun": "^2.0.11",
30-
"nodehun-sentences": "^1.0.4",
3128
"prompt-sync": "^4.1.5"
3229
}
3330
}

yarn.lock

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@ argparse@^1.0.7:
2222
dependencies:
2323
sprintf-js "~1.0.2"
2424

25-
array-unique@^0.1.1:
26-
version "0.1.1"
27-
resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.1.1.tgz#b2dc8ec765d306537d7291e0e621e849d2573cf9"
28-
29-
async@^2.1.4:
30-
version "2.6.0"
31-
resolved "https://registry.yarnpkg.com/async/-/async-2.6.0.tgz#61a29abb6fcc026fea77e56d1c6ec53a795951f4"
32-
dependencies:
33-
lodash "^4.14.0"
34-
3525
chalk@^2.0.0:
3626
version "2.3.2"
3727
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.2.tgz#250dc96b07491bfd601e648d66ddf5f60c7a5c65"
@@ -72,10 +62,6 @@ csv-parse@^2.0.4:
7262
version "2.0.4"
7363
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-2.0.4.tgz#5b469596766ee07f2cbd71aced7ae76b3c73c901"
7464

75-
dictionary-en-us@^2.0.0:
76-
version "2.0.0"
77-
resolved "https://registry.yarnpkg.com/dictionary-en-us/-/dictionary-en-us-2.0.0.tgz#b9135f403444bb5e4b3cf465fb7d3f2fd276a839"
78-
7965
escape-string-regexp@^1.0.5:
8066
version "1.0.5"
8167
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
@@ -106,10 +92,6 @@ iconv-lite@^0.4.17:
10692
version "0.4.19"
10793
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b"
10894

109-
in-publish@^2.0.0:
110-
version "2.0.0"
111-
resolved "https://registry.yarnpkg.com/in-publish/-/in-publish-2.0.0.tgz#e20ff5e3a2afc2690320b6dc552682a9c7fadf51"
112-
11395
inquirer@^5.1.0:
11496
version "5.1.0"
11597
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-5.1.0.tgz#19da508931892328abbbdd4c477f1efc65abfd67"
@@ -147,7 +129,7 @@ lodash.toarray@^4.4.0:
147129
version "4.4.0"
148130
resolved "https://registry.yarnpkg.com/lodash.toarray/-/lodash.toarray-4.4.0.tgz#24c4bfcd6b2fba38bfd0594db1179d8e9b656561"
149131

150-
lodash@^4.14.0, lodash@^4.17.5, lodash@^4.3.0:
132+
lodash@^4.17.5, lodash@^4.3.0:
151133
version "4.17.5"
152134
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
153135

@@ -165,19 +147,6 @@ node-emoji@^1.8.1:
165147
dependencies:
166148
lodash.toarray "^4.4.0"
167149

168-
nodehun-sentences@^1.0.4:
169-
version "1.0.4"
170-
resolved "https://registry.yarnpkg.com/nodehun-sentences/-/nodehun-sentences-1.0.4.tgz#a4aef2d7707d7d568133806e957a6a4ab9eb9106"
171-
dependencies:
172-
async "^2.1.4"
173-
in-publish "^2.0.0"
174-
partial "^0.0.3"
175-
unique-words "^1.0.0"
176-
177-
nodehun@^2.0.11:
178-
version "2.0.11"
179-
resolved "https://registry.yarnpkg.com/nodehun/-/nodehun-2.0.11.tgz#cbba5595720f325fb247fb0e7e2018a56f7ed188"
180-
181150
onetime@^2.0.0:
182151
version "2.0.1"
183152
resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"
@@ -188,10 +157,6 @@ os-tmpdir@~1.0.2:
188157
version "1.0.2"
189158
resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
190159

191-
partial@^0.0.3:
192-
version "0.0.3"
193-
resolved "https://registry.yarnpkg.com/partial/-/partial-0.0.3.tgz#2d107bed98fcea8d28d7665495b39e61dfcd18c6"
194-
195160
prompt-sync@^4.1.5:
196161
version "4.1.5"
197162
resolved "https://registry.yarnpkg.com/prompt-sync/-/prompt-sync-4.1.5.tgz#709ac182388b0e9a4a45b5683ed0449ed19f3eb8"
@@ -255,9 +220,3 @@ tmp@^0.0.33:
255220
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
256221
dependencies:
257222
os-tmpdir "~1.0.2"
258-
259-
unique-words@^1.0.0:
260-
version "1.0.0"
261-
resolved "https://registry.yarnpkg.com/unique-words/-/unique-words-1.0.0.tgz#40b26a19f98061663c813cd97a1a20a7f8b55990"
262-
dependencies:
263-
array-unique "^0.1.1"

0 commit comments

Comments
 (0)