Просмотр исходного кода

Merge pull request #4214 from weseek/feat/7190-add-english-rules

Lintルールを追加しました
Yuki Takei 4 лет назад
Родитель
Сommit
83a69ecd08

+ 11 - 0
packages/app/src/components/PageEditor/CodeMirrorEditor.jsx

@@ -162,12 +162,16 @@ export default class CodeMirrorEditor extends AbstractEditor {
     this.isTextlintEnabled = true;
 
     this.textlintConfig = [
+      { name: 'no-unmatched-pair' },
       { name: 'common-misspellings' },
+      { name: 'date-weekday-mismatch' },
+      { name: 'en-capitalization' },
       { name: 'ja-hiragana-keishikimeishi' },
       { name: 'ja-no-abusage' },
       { name: 'ja-no-inappropriate-words' },
       { name: 'ja-no-mixed-period' },
       { name: 'ja-no-redundant-expression' },
+      { name: 'ja-unnatural-alphabet' },
       { name: 'max-comma' },
       { name: 'max-kanji-continuous-len' },
       { name: 'max-ten' },
@@ -176,8 +180,15 @@ export default class CodeMirrorEditor extends AbstractEditor {
       { name: 'no-doubled-joshi' },
       { name: 'no-dropping-the-ra' },
       { name: 'no-hankaku-kana' },
+      { name: 'no-kangxi-radicals' },
+      { name: 'no-mixed-zenkaku-and-hankaku-alphabet' },
+      { name: 'no-nfd' },
+      { name: 'no-surrogate-pair' },
+      { name: 'no-zero-width-spaces' },
+      { name: 'period-in-list-item' },
       { name: 'prefer-tari-tari' },
       { name: 'sentence-length' },
+      { name: 'use-si-units' },
     ];
 
     this.interceptorManager = new InterceptorManager();

+ 12 - 1
packages/codemirror-textlint/package.json

@@ -17,16 +17,20 @@
     "universal-bunyan": "^0.9.2"
   },
   "devDependencies": {
+    "@textlint-rule/textlint-rule-no-unmatched-pair": "^1.0.8",
     "@textlint/kernel": "^12.0.2",
     "@types/codemirror": "^5.60.2",
     "textlint-message-to-codemirror": "^1.0.0",
     "textlint-plugin-markdown": "^4.0.6",
     "textlint-rule-common-misspellings": "^1.0.1",
+    "textlint-rule-date-weekday-mismatch": "^1.0.6",
+    "textlint-rule-en-capitalization": "^2.0.3",
     "textlint-rule-ja-hiragana-keishikimeishi": "^1.1.0",
     "textlint-rule-ja-no-abusage": "^3.0.0",
     "textlint-rule-ja-no-inappropriate-words": "^2.0.0",
     "textlint-rule-ja-no-mixed-period": "^2.1.1",
     "textlint-rule-ja-no-redundant-expression": "^4.0.0",
+    "textlint-rule-ja-unnatural-alphabet": "^2.0.1",
     "textlint-rule-max-comma": "^2.0.2",
     "textlint-rule-max-kanji-continuous-len": "^1.1.1",
     "textlint-rule-max-ten": "^4.0.2",
@@ -35,8 +39,15 @@
     "textlint-rule-no-doubled-joshi": "^4.0.0",
     "textlint-rule-no-dropping-the-ra": "^3.0.0",
     "textlint-rule-no-hankaku-kana": "^1.0.2",
+    "textlint-rule-no-kangxi-radicals": "^0.2.0",
+    "textlint-rule-no-mixed-zenkaku-and-hankaku-alphabet": "^1.0.1",
+    "textlint-rule-no-nfd": "^1.0.2",
+    "textlint-rule-no-surrogate-pair": "^1.0.1",
+    "textlint-rule-no-zero-width-spaces": "^1.0.1",
+    "textlint-rule-period-in-list-item": "^0.3.2",
     "textlint-rule-prefer-tari-tari": "^1.0.3",
-    "textlint-rule-sentence-length": "^3.0.0"
+    "textlint-rule-sentence-length": "^3.0.0",
+    "textlint-rule-use-si-units": "^1.0.2"
   },
   "peerDependencies": {
     "codemirror": "^5.62.3"

+ 22 - 0
packages/codemirror-textlint/src/index.ts

@@ -1,11 +1,15 @@
 import { TextlintKernel, TextlintKernelRule, TextlintRuleOptions } from '@textlint/kernel';
 import textlintToCodeMirror from 'textlint-message-to-codemirror';
+import textlintRuleNoUnmatchedPair from '@textlint-rule/textlint-rule-no-unmatched-pair';
 import textlintRuleCommonMisspellings from 'textlint-rule-common-misspellings';
+import textlintRuleDateWeekdayMismatch from 'textlint-rule-date-weekday-mismatch';
+import textlintRuleEnCapitalization from 'textlint-rule-en-capitalization';
 import textlintRuleJaHiraganaKeishikimeishi from 'textlint-rule-ja-hiragana-keishikimeishi';
 import textlintRuleJaNoAbusage from 'textlint-rule-ja-no-abusage';
 import textlintRuleJaNoInappropriateWords from 'textlint-rule-ja-no-inappropriate-words';
 import textlintRuleJaNoMixedPeriod from 'textlint-rule-ja-no-mixed-period';
 import textlintRuleJaNoRedundantExpression from 'textlint-rule-ja-no-redundant-expression';
+import textlintRuleJaUnnaturalAlphabet from 'textlint-rule-ja-unnatural-alphabet';
 import textlintRuleMaxComma from 'textlint-rule-max-comma';
 import textlintRuleMaxKanjiContinuousLen from 'textlint-rule-max-kanji-continuous-len';
 import textlintRuleMaxTen from 'textlint-rule-max-ten';
@@ -14,8 +18,15 @@ import textlintRuleNoDoubledConjunction from 'textlint-rule-no-doubled-conjuncti
 import textlintRuleNoDoubledJoshi from 'textlint-rule-no-doubled-joshi';
 import textlintRuleNoDroppingTheRa from 'textlint-rule-no-dropping-the-ra';
 import textlintRuleNoHankakuKana from 'textlint-rule-no-hankaku-kana';
+import textlintRuleNoKangxiRadicals from 'textlint-rule-no-kangxi-radicals';
+import textlintRuleNoMixedZenkakuAndHankakuAlphabet from 'textlint-rule-no-mixed-zenkaku-and-hankaku-alphabet';
+import textlintRuleNoNfd from 'textlint-rule-no-nfd';
+import textlintRuleNoSurrogatePair from 'textlint-rule-no-surrogate-pair';
+import textlintRuleNoZeroWidthSpaces from 'textlint-rule-no-zero-width-spaces';
+import textlintRulePeriodInListItem from 'textlint-rule-period-in-list-item';
 import textlintRulePreferTariTari from 'textlint-rule-prefer-tari-tari';
 import textlintRuleSentenceLength from 'textlint-rule-sentence-length';
+import textlintRuleUseSiUnits from 'textlint-rule-use-si-units';
 
 import { AsyncLinter, Annotation } from 'codemirror/addon/lint/lint';
 import { loggerFactory } from './utils/logger';
@@ -30,12 +41,16 @@ type RuleExtension = {
 }
 
 const ruleModulesList = {
+  'no-unmatched-pair': textlintRuleNoUnmatchedPair,
   'common-misspellings': textlintRuleCommonMisspellings,
+  'date-weekday-mismatch': textlintRuleDateWeekdayMismatch,
+  'en-capitalization': textlintRuleEnCapitalization,
   'ja-hiragana-keishikimeishi': textlintRuleJaHiraganaKeishikimeishi,
   'ja-no-abusage': textlintRuleJaNoAbusage,
   'ja-no-inappropriate-words': textlintRuleJaNoInappropriateWords,
   'ja-no-mixed-period': textlintRuleJaNoMixedPeriod,
   'ja-no-redundant-expression': textlintRuleJaNoRedundantExpression,
+  'ja-unnatural-alphabet': textlintRuleJaUnnaturalAlphabet,
   'max-comma': textlintRuleMaxComma,
   'max-kanji-continuous-len': textlintRuleMaxKanjiContinuousLen,
   'max-ten': textlintRuleMaxTen,
@@ -44,8 +59,15 @@ const ruleModulesList = {
   'no-doubled-joshi': textlintRuleNoDoubledJoshi,
   'no-dropping-the-ra': textlintRuleNoDroppingTheRa,
   'no-hankaku-kana': textlintRuleNoHankakuKana,
+  'no-kangxi-radicals': textlintRuleNoKangxiRadicals,
+  'no-mixed-zenkaku-and-hankaku-alphabet': textlintRuleNoMixedZenkakuAndHankakuAlphabet,
+  'no-nfd': textlintRuleNoNfd,
+  'no-surrogate-pair': textlintRuleNoSurrogatePair,
+  'no-zero-width-spaces': textlintRuleNoZeroWidthSpaces,
+  'period-in-list-item': textlintRulePeriodInListItem,
   'prefer-tari-tari': textlintRulePreferTariTari,
   'sentence-length': textlintRuleSentenceLength,
+  'use-si-units': textlintRuleUseSiUnits,
 };
 
 const logger = loggerFactory('growi:codemirror:codemirror-textlint');

+ 0 - 9
packages/codemirror-textlint/utils/logger/index.ts

@@ -1,9 +0,0 @@
-import Logger from 'bunyan';
-import { createLogger } from 'universal-bunyan';
-
-export const loggerFactory = function(name: string): Logger {
-  return createLogger({
-    name,
-    config: { default: 'info' },
-  });
-};

Разница между файлами не показана из-за своего большого размера
+ 620 - 15
yarn.lock


Некоторые файлы не были показаны из-за большого количества измененных файлов