From 96bc0a126f8c505f7b5560d0d850becc716d8312 Mon Sep 17 00:00:00 2001 From: Taehwan Noh Date: Thu, 28 Feb 2019 19:35:52 +0900 Subject: [PATCH 1/3] Add more terms to terminology rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 예시, 애플리케이션, 함수 컴포넌트, 생명주기 are added. --- textlint/rules/terminology.js | 20 ++++++++++++++++++++ textlint/tests/terminology.spec.js | 25 ++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/textlint/rules/terminology.js b/textlint/rules/terminology.js index 679ada59d..2d3d34025 100644 --- a/textlint/rules/terminology.js +++ b/textlint/rules/terminology.js @@ -51,4 +51,24 @@ const terms = [ expressions: [/써드파티/], message: 'third party는 서드파티가 올바른 표현입니다', }, + { + value: '예시', + expressions: [/예제/], + message: 'example은 예시로 표현합니다.', + }, + { + value: '애플리케이션', + expressions: [/응용프로그램/, /어플리케이션/], + message: 'application은 애플리케이션으로 표현합니다.', + }, + { + value: '함수 컴포넌트', + expressions: [/함수형 컴포넌트/], + message: 'function(al) component는 함수 컴포넌트로 표현합니다.', + }, + { + value: '생명주기', + expressions: [/라이프사이클/], + message: 'life cycle은 생명주기로 표현합니다.', + }, ].map(term => ({...term, expressions: g(term.expressions)})); diff --git a/textlint/tests/terminology.spec.js b/textlint/tests/terminology.spec.js index 313b69ae1..5995c8108 100644 --- a/textlint/tests/terminology.spec.js +++ b/textlint/tests/terminology.spec.js @@ -4,7 +4,14 @@ const rule = require('../rules/terminology'); const tester = new TextLintTester(); tester.run('terminology', rule, { - valid: ['메서드', '서드파티'], + valid: [ + '메서드', + '서드파티', + '예시', + '애플리케이션', + '함수 컴포넌트', + '생명주기', + ], invalid: [ { text: '한 문장에 연속하는 용어 메소드와 메소드와 메쏘드를 테스트합니다.', @@ -14,5 +21,21 @@ tester.run('terminology', rule, { text: '써드파티', errors: [{index: 0}], }, + { + text: '예제', + errors: [{index: 0}], + }, + { + text: '응용프로그램과 어플리케이션', + errors: [{index: 0}, {index: 8}], + }, + { + text: '함수형 컴포넌트', + errors: [{index: 0}], + }, + { + text: '라이프사이클', + errors: [{index: 0}], + }, ], }); From 87fbc34da6c21354326c90db8096f45bf41fd2af Mon Sep 17 00:00:00 2001 From: Taehwan Noh Date: Thu, 28 Feb 2019 19:48:09 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Fix=20=EC=84=9C=EB=93=9C=ED=8C=8C=ED=8B=B0?= =?UTF-8?q?=20to=20=EC=84=9C=EB=93=9C=20=ED=8C=8C=ED=8B=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See 서드^파티 in below link. https://opendict.korean.go.kr/dictionary/view?sense_no=1251028 --- textlint/rules/terminology.js | 8 +++++--- textlint/tests/terminology.spec.js | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/textlint/rules/terminology.js b/textlint/rules/terminology.js index 2d3d34025..086e5c6b4 100644 --- a/textlint/rules/terminology.js +++ b/textlint/rules/terminology.js @@ -42,14 +42,16 @@ const g = args => args.map(arg => new RegExp(arg, 'g')); */ const terms = [ { + // http://www.korean.go.kr/front/onlineQna/onlineQnaView.do?mn_id=61&qna_seq=11976 value: '메서드', expressions: [/메소드/, /메쏘드/], message: 'method는 메서드가 올바른 표현입니다', }, { - value: '서드파티', - expressions: [/써드파티/], - message: 'third party는 서드파티가 올바른 표현입니다', + // https://opendict.korean.go.kr/dictionary/view?sense_no=1251028 + value: '서드 파티', + expressions: [/서드파티/, /써드파티/, /써드 파티/], + message: 'third party는 서드 파티가 올바른 표현입니다', }, { value: '예시', diff --git a/textlint/tests/terminology.spec.js b/textlint/tests/terminology.spec.js index 5995c8108..ed48113ae 100644 --- a/textlint/tests/terminology.spec.js +++ b/textlint/tests/terminology.spec.js @@ -6,7 +6,7 @@ const tester = new TextLintTester(); tester.run('terminology', rule, { valid: [ '메서드', - '서드파티', + '서드 파티', '예시', '애플리케이션', '함수 컴포넌트', @@ -18,8 +18,8 @@ tester.run('terminology', rule, { errors: [{index: 14}, {index: 19}, {index: 24}], }, { - text: '써드파티', - errors: [{index: 0}], + text: '서드파티와 써드파티와 써드 파티', + errors: [{index: 0}, {index: 6}, {index: 12}], }, { text: '예제', From ab7d4733fe09b8e97ee26c75feb4cb56cb63844f Mon Sep 17 00:00:00 2001 From: Taehwan Noh Date: Thu, 28 Feb 2019 19:58:52 +0900 Subject: [PATCH 3/3] Add test:textlint-cli script for verifying textlint cli result This is only for one-time testing in the local machine. I will not include this script in the CircleCI step. --- lint-staged.config.js | 5 ++++- package.json | 3 ++- textlint/fixtures/terminology.md | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 textlint/fixtures/terminology.md diff --git a/lint-staged.config.js b/lint-staged.config.js index 47aa3d39c..ebab41a43 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -1,3 +1,6 @@ module.exports = { - '*.md': ['textlint --rulesdir textlint/rules'], + linters: { + '*.md': ['textlint --rulesdir textlint/rules'], + }, + ignore: ['textlint/fixtures/*'], }; diff --git a/package.json b/package.json index 2a606c72f..f12d295d4 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,8 @@ "prettier": "yarn format:source && yarn format:examples", "prettier:diff": "yarn nit:source && yarn nit:examples", "reset": "rimraf ./.cache", - "test:textlint": "mocha textlint/tests/**/*.spec.js" + "test:textlint": "mocha textlint/tests/**/*.spec.js", + "test:textlint-cli": "textlint --rulesdir textlint/rules textlint/fixtures/*.md --format stylish" }, "devDependencies": { "@babel/preset-flow": "^7.0.0", diff --git a/textlint/fixtures/terminology.md b/textlint/fixtures/terminology.md new file mode 100644 index 000000000..6e6a015e9 --- /dev/null +++ b/textlint/fixtures/terminology.md @@ -0,0 +1,10 @@ +# Terminology Fixtures + +> Markdown for verifying textlint CLI result + +- 메서드 +- 서드파티와 써드파티와 써드 파티 +- 예제 +- 응용프로그램과 어플리케이션 +- 함수형 컴포넌트 +- 라이프사이클