Sfoglia il codice sorgente

installed lint rules

Steven Fukase 4 anni fa
parent
commit
48c708dc44

+ 37 - 2
packages/app/src/client/util/codemirror/codemirror-textlint.ts

@@ -1,8 +1,26 @@
 import { TextlintKernel, TextlintKernelRule, TextlintRuleOptions } from '@textlint/kernel';
 import textlintToCodeMirror from 'textlint-message-to-codemirror';
-import textlintRuleMaxComma from 'textlint-rule-max-comma';
 import textlintRuleCommonMisspellings from 'textlint-rule-common-misspellings';
+import textlintRuleJaHiraganaFukushi from 'textlint-rule-ja-hiragana-fukushi';
+import textlintRuleJaHiraganaHojodoushi from 'textlint-rule-ja-hiragana-hojodoushi';
+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 textlintRuleMaxComma from 'textlint-rule-max-comma';
+import textlintRuleMaxKanjiContinuousLen from 'textlint-rule-max-kanji-continuous-len';
+import textlintRuleMaxTen from 'textlint-rule-max-ten';
+import textlintRuleNoDoubleNegativeJa from 'textlint-rule-no-double-negative-ja';
+import textlintRuleNoDoubledConjunction from 'textlint-rule-no-doubled-conjunction';
+import textlintRuleNoConjunctiveParticleGa from 'textlint-rule-no-doubled-conjunctive-particle-ga';
+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 textlintRuleNoKinshiYogo from 'textlint-rule-no-hoso-kinshi-yogo';
+import textlintRulePreferTariTari from 'textlint-rule-prefer-tari-tari';
+import textlintRuleSentenceLength from 'textlint-rule-sentence-length';
+
 import { AsyncLinter, Annotation } from 'codemirror/addon/lint/lint';
 import loggerFactory from '../../../utils/logger';
 
@@ -16,9 +34,26 @@ type RuleExtension = {
 }
 
 const ruleModulesList = {
-  'max-comma': textlintRuleMaxComma,
   'common-misspellings': textlintRuleCommonMisspellings,
+  'ja-hiragana-fukushi': textlintRuleJaHiraganaFukushi,
+  'ja-hiragana-hojodoushi': textlintRuleJaHiraganaHojodoushi,
+  'ja-hiragana-keishikimeishi': textlintRuleJaHiraganaKeishikimeishi,
+  'ja-no-abusage': textlintRuleJaNoAbusage,
+  'ja-no-inappropriate-words': textlintRuleJaNoInappropriateWords,
+  'ja-no-mixed-period': textlintRuleJaNoMixedPeriod,
+  'ja-no-redundant-expression': textlintRuleJaNoRedundantExpression,
+  'max-comma': textlintRuleMaxComma,
+  'max-kanji-continuous-len': textlintRuleMaxKanjiContinuousLen,
+  'max-ten': textlintRuleMaxTen,
+  'no-double-negative-ja': textlintRuleNoDoubleNegativeJa,
+  'no-doubled-conjunction': textlintRuleNoDoubledConjunction,
+  'no-doubled-conjunctive-particle-ga': textlintRuleNoConjunctiveParticleGa,
+  'no-doubled-joshi': textlintRuleNoDoubledJoshi,
   'no-dropping-the-ra': textlintRuleNoDroppingTheRa,
+  'no-hankaku-kana': textlintRuleNoHankakuKana,
+  'no-hoso-kinshi-yogo': textlintRuleNoKinshiYogo,
+  'prefer-tari-tari': textlintRulePreferTariTari,
+  'sentence-length': textlintRuleSentenceLength,
 };
 
 const logger = loggerFactory('growi:codemirror:codemirror-textlint');

+ 20 - 15
packages/app/src/components/PageEditor/CodeMirrorEditor.jsx

@@ -162,21 +162,26 @@ export default class CodeMirrorEditor extends AbstractEditor {
     this.isLintEnabled = true;
 
     this.textlintConfig = [
-      {
-        name: 'max-comma',
-      },
-      {
-        name: 'no-dropping-the-ra',
-      },
-      {
-        name: 'common-misspellings',
-        options: {
-          ignore: [
-            'isnt',
-            'yuo',
-          ],
-        },
-      },
+      { name: 'common-misspellings' },
+      { name: 'ja-hiragana-fukushi' },
+      { name: 'ja-hiragana-hojodoushi' },
+      { name: 'ja-hiragana-keishikimeishi' },
+      { name: 'ja-no-abusage' },
+      { name: 'ja-no-inappropriate-words' },
+      { name: 'ja-no-mixed-period' },
+      { name: 'ja-no-redundant-expression' },
+      { name: 'max-comma' },
+      { name: 'max-kanji-continuous-len' },
+      { name: 'max-ten' },
+      { name: 'no-double-negative-ja' },
+      { name: 'no-doubled-conjunction' },
+      { name: 'no-doubled-conjunctive-particle-ga' },
+      { name: 'no-doubled-joshi' },
+      { name: 'no-dropping-the-ra' },
+      { name: 'no-hankaku-kana' },
+      { name: 'no-hoso-kinshi-yogo' },
+      { name: 'prefer-tari-tari' },
+      { name: 'sentence-length' },
     ];
 
     this.interceptorManager = new InterceptorManager();