@r_masseater/msch 0.79.0 → 0.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,12 @@
1
1
  import { a as parent, c as toPosix, s as segments, t as baseName } from "./path-DUttmo2s.mjs";
2
+ import { n as VIDEO_INTROS } from "./config-C3jRfgJ9.mjs";
2
3
  import { Array, Match, Option, Predicate, Record, Schema, String as String$1, pipe } from "effect";
3
4
  import { isTypeNode } from "tsrs/ast/is";
4
5
  import { SymbolFlags } from "tsrs/sync";
5
6
  import { withTypeInformation } from "@r_masseater/oxlint-typed-rules";
6
7
  // src/features/define-lint-rules/model/get-or-insert-ast.ts
7
- const START = 0;
8
- const END = 1;
8
+ const START$2 = 0;
9
+ const END$1 = 1;
9
10
  const KEY = 0;
10
11
  const VALUE = 1;
11
12
  const ONE$2 = 1;
@@ -46,17 +47,17 @@ const decodeReturn = Schema.decodeUnknownOption(Schema.Struct({
46
47
  argument: RangedSchema
47
48
  }));
48
49
  const decodeTyped = Schema.decodeUnknownOption(Schema.Struct({ type: Schema.String }));
49
- const textOf = (scope) => (node) => String$1.slice(node.range[START], node.range[END])(scope.text);
50
- const textOfNode = (scope) => (node) => pipe(decodeRanged(node), Option.map(textOf(scope)));
50
+ const textOf$1 = (scope) => (node) => String$1.slice(node.range[START$2], node.range[END$1])(scope.text);
51
+ const textOfNode = (scope) => (node) => pipe(decodeRanged(node), Option.map(textOf$1(scope)));
51
52
  const accessOf = (scope) => (method) => (node) => pipe(decodeMemberCall(node), Option.filter((call) => call.callee.property.name === method), Option.flatMap((call) => pipe(Array.get(call.arguments, KEY), Option.map((key) => ({
52
- map: textOf(scope)(call.callee.object),
53
- key: textOf(scope)(key),
54
- value: pipe(Array.get(call.arguments, VALUE), Option.map(textOf(scope)))
53
+ map: textOf$1(scope)(call.callee.object),
54
+ key: textOf$1(scope)(key),
55
+ value: pipe(Array.get(call.arguments, VALUE), Option.map(textOf$1(scope)))
55
56
  })))));
56
57
  const sameEntry = (left) => (right) => left.map === right.map && left.key === right.key;
57
- const calleeMatches = (scope) => (pattern) => (node) => pipe(decodeCall(node), Option.filter((call) => pattern.test(textOf(scope)(call.callee))), Option.map((call) => call.arguments));
58
+ const calleeMatches = (scope) => (pattern) => (node) => pipe(decodeCall(node), Option.filter((call) => pattern.test(textOf$1(scope)(call.callee))), Option.map((call) => call.arguments));
58
59
  const expressionOf = (statement) => pipe(decodeExpressionStatement(statement), Option.map((found) => found.expression));
59
- const returnedText = (scope) => (statement) => pipe(decodeReturn(statement), Option.map((found) => textOf(scope)(found.argument)));
60
+ const returnedText = (scope) => (statement) => pipe(decodeReturn(statement), Option.map((found) => textOf$1(scope)(found.argument)));
60
61
  const bodyOf = (node) => pipe(decodeBlock(node), Option.map((block) => block.body));
61
62
  const onlyStatement = (statement) => Option.match(bodyOf(statement), {
62
63
  onNone: () => Option.some(statement),
@@ -233,10 +234,10 @@ const completionOf = (resolved, path) => {
233
234
  const resolvedFileOf = (services, source) => pipe(Option.fromNullishOr(services.getSymbolAtLocation(source)), Option.flatMap((symbol) => Array.head(symbol.declarations)), Option.map((declaration) => declaration.getSourceFile().fileName));
234
235
  const fixedOf = (services, source) => pipe(partsOf(source.value), Option.filter(({ path }) => RELATIVE.test(path)), Option.flatMap(({ path, query }) => pipe(resolvedFileOf(services, source), Option.flatMap((resolved) => completionOf(resolved, String$1.replace(TRAILING_SEPARATORS, "")(path))), Option.map((completion) => `${String$1.replace(TRAILING_SEPARATORS, "")(path)}${completion}${query}`))));
235
236
  const quoteOf = (source) => pipe(Option.fromNullishOr(source.raw), Option.flatMap(String$1.charAt(FIRST)), Option.getOrElse(() => DEFAULT_QUOTE));
236
- const isStringLiteral = (node) => Predicate.isNotNull(node) && node.type === "Literal" && Predicate.isString(node.value);
237
+ const isStringLiteral$1 = (node) => Predicate.isNotNull(node) && node.type === "Literal" && Predicate.isString(node.value);
237
238
  const visitorOf$1 = (context, services) => {
238
239
  const check = (source) => {
239
- if (!isStringLiteral(source)) return;
240
+ if (!isStringLiteral$1(source)) return;
240
241
  const fixed = fixedOf(services, source);
241
242
  if (Option.isSome(fixed)) context.report({
242
243
  node: source,
@@ -584,7 +585,7 @@ const outermost = (node) => pipe(Option.fromNullishOr(node.parent), Option.filte
584
585
  onNone: () => node,
585
586
  onSome: outermost
586
587
  }));
587
- const unwrapped = (parameter) => {
588
+ const unwrapped$1 = (parameter) => {
588
589
  if (parameter.type === "TSParameterProperty") return parameter.parameter;
589
590
  return parameter;
590
591
  };
@@ -608,7 +609,7 @@ const describe = ({ path, mutability }) => `${subjectOf(path)} ${predicateOf(mut
608
609
  const visitorOf = (context, services) => {
609
610
  const partOf = writablePartOf(services.program.native);
610
611
  const check = ({ params }) => {
611
- for (const parameter of pipe(params, Array.map(unwrapped))) {
612
+ for (const parameter of pipe(params, Array.map(unwrapped$1))) {
612
613
  const part = pipe(annotatedType(services, parameter), Option.filter((type) => !isBrandedLiteralLike(type)), Option.flatMap(partOf));
613
614
  if (Option.isSome(part)) context.report({
614
615
  node: parameter,
@@ -629,6 +630,420 @@ const visitorOf = (context, services) => {
629
630
  TSMethodSignature: check
630
631
  };
631
632
  };
633
+ const readonlyParameters = typedRuleOf({
634
+ meta: {
635
+ type: "suggestion",
636
+ messages: { [MESSAGE_ID]: MESSAGE }
637
+ },
638
+ visitorOf
639
+ });
640
+ const CUTS = "cuts";
641
+ const START$1 = 0;
642
+ const END = 1;
643
+ const NEXT$2 = 1;
644
+ const keyOf = (property) => {
645
+ if (property.type !== "Property" || property.computed) return Option.none();
646
+ if (property.key.type === "Identifier") return Option.some(property.key.name);
647
+ if (property.key.type === "Literal" && Predicate.isString(property.key.value)) return Option.some(property.key.value);
648
+ return Option.none();
649
+ };
650
+ const propertyOf$1 = (key) => (object) => Array.findFirst(object.properties, (property) => property.type === "Property" && Option.contains(keyOf(property), key));
651
+ const propertiesOf = (object) => pipe(object.properties, Array.filter((property) => property.type === "Property"));
652
+ const isStringLiteral = (node) => Predicate.hasProperty(node, "type") && node["type"] === "Literal" && Predicate.hasProperty(node, "value") && Predicate.isString(node["value"]);
653
+ const unwrapped = (node) => {
654
+ if (node.type === "TSAsExpression" || node.type === "TSSatisfiesExpression" || node.type === "TSNonNullExpression") return unwrapped(node.expression);
655
+ return node;
656
+ };
657
+ const asObject = (node) => Option.liftPredicate(unwrapped(node), (value) => value.type === "ObjectExpression");
658
+ const asArray = (node) => Option.liftPredicate(unwrapped(node), (value) => value.type === "ArrayExpression");
659
+ const stringsOf = (node) => pipe(asArray(node), Option.map(({ elements }) => pipe(elements, Array.filter(isStringLiteral))), Option.getOrElse(() => []));
660
+ const saidOf = (property) => {
661
+ if (!Option.contains(keyOf(property), "say")) return [];
662
+ return stringsOf(property.value);
663
+ };
664
+ const quotedOf = (text) => pipe(text, String$1.replaceAll("\\", String.raw`\\`), String$1.replaceAll("\"", String.raw`\"`), String$1.replaceAll("\n", String.raw`\n`), (escaped) => `"${escaped}"`);
665
+ const removedRange = ({ object, property }) => {
666
+ const index = object.properties.indexOf(property);
667
+ const next = Array.get(object.properties, index + NEXT$2);
668
+ if (Option.isSome(next)) return [property.range[START$1], next.value.range[START$1]];
669
+ return pipe(Array.get(object.properties, index - NEXT$2), Option.map((previous) => [previous.range[END], property.range[END]]), Option.getOrElse(() => [property.range[START$1], property.range[END]]));
670
+ };
671
+ const declaratorsOf = (statement) => {
672
+ if (statement.type === "VariableDeclaration") return statement.declarations;
673
+ if (statement.type === "ExportNamedDeclaration") return pipe(Option.fromNullishOr(statement.declaration), Option.filter((declaration) => declaration.type === "VariableDeclaration"), Option.map(({ declarations }) => declarations), Option.getOrElse(() => []));
674
+ return [];
675
+ };
676
+ const declaredArray = (context, name) => pipe(context.sourceCode.ast.body, Array.flatMap(declaratorsOf), Array.findFirst(({ id }) => id.type === "Identifier" && id.name === name), Option.flatMap(({ init }) => Option.fromNullishOr(init)), Option.flatMap(asArray));
677
+ const objectsOf = ({ elements }) => pipe(elements, Array.filter(Predicate.isNotNull), Array.flatMap((element) => Option.toArray(asObject(element))));
678
+ const cutArrayOf = (context) => ({ value }) => {
679
+ if (value.type === "Identifier") return declaredArray(context, value.name);
680
+ return asArray(value);
681
+ };
682
+ const cutsOf = ({ context, script }) => pipe(propertyOf$1(CUTS)(script), Option.flatMap(cutArrayOf(context)), Option.map(objectsOf), Option.getOrElse(() => []));
683
+ const Texts = Schema.Record(Schema.String, Schema.String);
684
+ const optionsWith = ({ schema, fallback }) => (options) => pipe(Array.head(options), Option.flatMap(Schema.decodeUnknownOption(schema)), Option.getOrElse(() => fallback));
685
+ // src/features/define-lint-rules/model/video-readings.ts
686
+ const UNREAD = "unread";
687
+ const MESSAGES$2 = { [UNREAD]: "英字の語「{{word}}」の読みが readings にない。VOICEVOX は英字を1文字ずつ読むことがある" };
688
+ const READINGS = "readings";
689
+ const RUBY = /\{[^}]*\}/gu;
690
+ const WORD = /[A-Za-z][A-Za-z0-9+#.-]*/gu;
691
+ const isRead = (keys) => (word) => pipe(keys, Array.some((key) => String$1.includes(key)(word) || String$1.includes(word)(key)));
692
+ const wordsOf = (say) => pipe(String$1.replaceAll(RUBY, String$1.empty)(say), String$1.matchAll(WORD), Array.fromIterable, Array.map(([word]) => word), Array.dedupe);
693
+ const keysOf = ({ properties }) => pipe(properties, Array.flatMap((property) => Option.toArray(keyOf(property))));
694
+ const videoReadings = {
695
+ meta: {
696
+ type: "problem",
697
+ messages: MESSAGES$2
698
+ },
699
+ create: (context) => {
700
+ const keys = [];
701
+ const said = [];
702
+ return {
703
+ ObjectExpression: (object) => {
704
+ for (const node of propertiesOf(object)) {
705
+ said.push(...saidOf(node));
706
+ if (Option.contains(keyOf(node), READINGS)) keys.push(...pipe(asObject(node.value), Option.toArray, Array.flatMap(keysOf)));
707
+ }
708
+ },
709
+ "Program:exit": () => {
710
+ for (const literal of said) for (const word of pipe(wordsOf(literal.value), Array.filter((candidate) => !isRead(keys)(candidate)))) context.report({
711
+ node: literal,
712
+ messageId: UNREAD,
713
+ data: { word }
714
+ });
715
+ }
716
+ };
717
+ }
718
+ };
719
+ // src/features/define-lint-rules/model/video-say.ts
720
+ const FIX = "fix";
721
+ const BANNED = "banned";
722
+ const EMPHASIS = "emphasis";
723
+ const MESSAGES$1 = {
724
+ [FIX]: "「{{say}}」は日本語と英数字の間に空白があるか、決まった言葉を言い換えている。「{{fixed}}」と書く",
725
+ [BANNED]: "「{{say}}」に「{{word}}」がある。{{instead}}",
726
+ [EMPHASIS]: "「{{say}}」の太字(**)が{{count}}か所ある。{{max}}か所までにする"
727
+ };
728
+ const JAPANESE = String.raw`[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}ー々、。!?」』)]`;
729
+ const LATIN = "[A-Za-z0-9]";
730
+ const SPACE = "[  ]+";
731
+ const AFTER_JAPANESE = new RegExp(`(?<head>${JAPANESE}[*}]*)${SPACE}(?<tail>[*{]*${LATIN})`, "gu");
732
+ const BEFORE_JAPANESE = new RegExp(`(?<head>${LATIN}[*}]*)${SPACE}(?<tail>[*{]*${JAPANESE})`, "gu");
733
+ const KEPT = "$<head>$<tail>";
734
+ const OUTSIDE_RUBY = String.raw`(?![^{]*\})`;
735
+ const EMPHASIZED = /\*\*[^*]+\*\*/gu;
736
+ const SPECIAL = /[.*+?^${}()|[\]\\]/gu;
737
+ const ESCAPED = String.raw`\$&`;
738
+ const DEFAULT_MAX = 1;
739
+ const optionsOf$1 = optionsWith({
740
+ schema: Schema.Struct({
741
+ terms: Schema.optional(Texts),
742
+ banned: Schema.optional(Texts),
743
+ maxEmphasis: Schema.optional(Schema.Finite)
744
+ }),
745
+ fallback: {}
746
+ });
747
+ const unspacedOf = (say) => pipe(say, String$1.replaceAll(AFTER_JAPANESE, KEPT), String$1.replaceAll(BEFORE_JAPANESE, KEPT));
748
+ const outsideRuby = (word) => new RegExp(`${String$1.replaceAll(SPECIAL, ESCAPED)(word)}${OUTSIDE_RUBY}`, "gu");
749
+ const termedOf = (terms) => (say) => Array.reduce(Record.toEntries(terms), say, (text, [vague, precise]) => String$1.replaceAll(outsideRuby(vague), precise)(text));
750
+ const emphasisCount = (say) => Array.fromIterable(String$1.matchAll(EMPHASIZED)(say)).length;
751
+ const videoSay = {
752
+ meta: {
753
+ type: "suggestion",
754
+ fixable: "code",
755
+ messages: MESSAGES$1,
756
+ schema: [{
757
+ type: "object",
758
+ additionalProperties: true
759
+ }]
760
+ },
761
+ create: (context) => {
762
+ const { terms = {}, banned = {}, maxEmphasis = DEFAULT_MAX } = optionsOf$1(context.options);
763
+ const check = (literal) => {
764
+ const say = literal.value;
765
+ const fixed = termedOf(terms)(unspacedOf(say));
766
+ if (fixed !== say) context.report({
767
+ node: literal,
768
+ messageId: FIX,
769
+ data: {
770
+ say,
771
+ fixed
772
+ },
773
+ fix: (fixer) => fixer.replaceText(literal, quotedOf(fixed))
774
+ });
775
+ for (const [word, instead] of Record.toEntries(banned)) if (String$1.includes(word)(say)) context.report({
776
+ node: literal,
777
+ messageId: BANNED,
778
+ data: {
779
+ say,
780
+ word,
781
+ instead
782
+ }
783
+ });
784
+ const count = emphasisCount(say);
785
+ if (count > maxEmphasis) context.report({
786
+ node: literal,
787
+ messageId: EMPHASIS,
788
+ data: {
789
+ say,
790
+ count: String(count),
791
+ max: String(maxEmphasis)
792
+ }
793
+ });
794
+ };
795
+ return { ObjectExpression: (node) => {
796
+ for (const literal of pipe(propertiesOf(node), Array.flatMap(saidOf))) check(literal);
797
+ } };
798
+ }
799
+ };
800
+ // src/features/define-lint-rules/model/video-values.ts
801
+ const START = 0;
802
+ const NEXT$1 = 1;
803
+ const textOf = (context) => (node) => context.sourceCode.getText(node);
804
+ const valueTarget = (property) => pipe(asObject(property.value), Option.flatMap(({ properties }) => Array.findFirst(properties, (part) => part.type === "SpreadElement")), Option.match({
805
+ onNone: () => property.value,
806
+ onSome: ({ argument }) => argument
807
+ }));
808
+ const reportMissing = ({ context, object, before }, { key, expected, data }) => {
809
+ context.report({
810
+ node: object,
811
+ messageId: "value",
812
+ data,
813
+ fix: (fixer) => Option.match(before, {
814
+ onNone: () => fixer.insertTextAfterRange([object.range[START], object.range[START] + NEXT$1], ` ${key}: ${expected},`),
815
+ onSome: (node) => fixer.insertTextBefore(node, `${key}: ${expected},\n `)
816
+ })
817
+ });
818
+ };
819
+ const checkValue = (check) => ([key, expected]) => {
820
+ const { context, object, name } = check;
821
+ const data = {
822
+ series: name,
823
+ key,
824
+ expected
825
+ };
826
+ const property = propertyOf$1(key)(object);
827
+ if (Option.isNone(property)) {
828
+ reportMissing(check, {
829
+ key,
830
+ expected,
831
+ data
832
+ });
833
+ return;
834
+ }
835
+ const target = valueTarget(property.value);
836
+ if (textOf(context)(target) !== expected) context.report({
837
+ node: target,
838
+ messageId: "value",
839
+ data,
840
+ fix: (fixer) => fixer.replaceText(target, expected)
841
+ });
842
+ };
843
+ const checkValues = (check) => {
844
+ for (const entry of Record.toEntries(check.values)) checkValue(check)(entry);
845
+ };
846
+ // src/features/define-lint-rules/model/video-intro.ts
847
+ const ID = "id";
848
+ const AT = "at";
849
+ const INTRO = "intro";
850
+ const PART = "|";
851
+ const NEXT = 1;
852
+ const isIntro = (cut) => pipe(propertyOf$1(ID)(cut), Option.exists(({ value }) => isStringLiteral(value) && value.value === INTRO));
853
+ const partedLines = (cut) => pipe(propertyOf$1("say")(cut), Option.map(({ value }) => stringsOf(value)), Option.getOrElse(() => []), Array.filter(({ value }) => String$1.includes(PART)(value)));
854
+ const checkBeats = ({ context, name }, cut) => {
855
+ if (Option.isNone(propertyOf$1(AT)(cut)) || Array.isReadonlyArrayEmpty(partedLines(cut))) context.report({
856
+ node: cut,
857
+ messageId: "beats",
858
+ data: { series: name }
859
+ });
860
+ };
861
+ const checkPlain = ({ context, name }, cut) => {
862
+ const data = { series: name };
863
+ for (const property of Option.toArray(propertyOf$1(AT)(cut))) context.report({
864
+ node: property,
865
+ messageId: "plainBeats",
866
+ data,
867
+ fix: (fixer) => fixer.removeRange(removedRange({
868
+ object: cut,
869
+ property
870
+ }))
871
+ });
872
+ for (const line of partedLines(cut)) context.report({
873
+ node: line,
874
+ messageId: "plainParts",
875
+ data,
876
+ fix: (fixer) => fixer.replaceText(line, quotedOf(String$1.replaceAll(PART, String$1.empty)(line.value)))
877
+ });
878
+ };
879
+ const checkIntro = (check) => {
880
+ const { context, script, name, rule } = check;
881
+ const intro = Array.findFirst(cutsOf({
882
+ context,
883
+ script
884
+ }), isIntro);
885
+ if (Option.isNone(intro)) {
886
+ context.report({
887
+ node: script,
888
+ messageId: "noIntro",
889
+ data: { series: name }
890
+ });
891
+ return;
892
+ }
893
+ if (rule === "beats") {
894
+ checkBeats(check, intro.value);
895
+ return;
896
+ }
897
+ checkPlain(check, intro.value);
898
+ };
899
+ const checkAfterIntro = ({ context, script, name, values }) => {
900
+ const cuts = cutsOf({
901
+ context,
902
+ script
903
+ });
904
+ const next = pipe(Array.findFirstIndex(cuts, isIntro), Option.flatMap((index) => Array.get(cuts, index + NEXT)));
905
+ for (const cut of Option.toArray(next)) checkValues({
906
+ context,
907
+ object: cut,
908
+ values,
909
+ name,
910
+ before: Option.none()
911
+ });
912
+ };
913
+ // src/features/define-lint-rules/model/video-series.ts
914
+ const MESSAGES = {
915
+ unknown: "series「{{series}}」の決まりがない。{{known}} のどれかにする",
916
+ value: "{{series}} の {{key}} は {{expected}} にする",
917
+ banned: "{{key}} を使わない。{{reason}}",
918
+ voice: "{{series}} に出ない話者 {{voice}} が話している",
919
+ opener: "{{series}} の最初の台詞は {{voice}} が言う",
920
+ closer: "{{series}} の最後の台詞は {{voice}} が言う",
921
+ noIntro: "{{series}} は最初のカットを intro にする",
922
+ plainBeats: "{{series}} のイントロは音ハメしない。at を外す",
923
+ plainParts: "{{series}} のイントロは句に分けず、1つの台詞で読む",
924
+ beats: "{{series}} のイントロは「|」で句に分け、at で各句の頭を拍に置く"
925
+ };
926
+ const SERIES = "series";
927
+ const VOICE = "voice";
928
+ const SeriesSchema = Schema.Struct({
929
+ values: Schema.optional(Texts),
930
+ voices: Schema.String.pipe(Schema.Array, Schema.optional),
931
+ opener: Schema.optional(Schema.String),
932
+ closer: Schema.optional(Schema.String),
933
+ intro: Schema.optional(Schema.Literals(VIDEO_INTROS)),
934
+ afterIntro: Schema.optional(Texts)
935
+ });
936
+ const optionsOf = optionsWith({
937
+ schema: Schema.Struct({
938
+ series: Schema.Record(Schema.String, SeriesSchema),
939
+ banned: Schema.optional(Texts)
940
+ }),
941
+ fallback: { series: {} }
942
+ });
943
+ const voiceOf = (context, object) => Option.map(propertyOf$1(VOICE)(object), ({ value }) => textOf(context)(value));
944
+ const speakerOf = ({ context, script }) => (cut) => Option.orElse(voiceOf(context, cut), () => voiceOf(context, script));
945
+ const checkCast = (check, cuts) => {
946
+ const { context, name, series } = check;
947
+ const voices = series.voices ?? [];
948
+ if (Array.isReadonlyArrayEmpty(voices)) return;
949
+ for (const cut of cuts) for (const voice of Option.toArray(speakerOf(check)(cut))) if (!voices.includes(voice)) context.report({
950
+ node: cut,
951
+ messageId: "voice",
952
+ data: {
953
+ series: name,
954
+ voice
955
+ }
956
+ });
957
+ };
958
+ const checkEnds = (check, cuts) => {
959
+ const { context, name, series } = check;
960
+ const ends = [[
961
+ "opener",
962
+ series.opener,
963
+ Array.head(cuts)
964
+ ], [
965
+ "closer",
966
+ series.closer,
967
+ Array.last(cuts)
968
+ ]];
969
+ for (const [messageId, voice, cut] of ends) for (const [expected, end] of Option.toArray(Option.all([Option.fromNullishOr(voice), cut]))) if (!Option.contains(speakerOf(check)(end), expected)) context.report({
970
+ node: end,
971
+ messageId,
972
+ data: {
973
+ series: name,
974
+ voice: expected
975
+ }
976
+ });
977
+ };
978
+ const checkVoices = (check) => {
979
+ const cuts = cutsOf({
980
+ context: check.context,
981
+ script: check.script
982
+ });
983
+ checkCast(check, cuts);
984
+ checkEnds(check, cuts);
985
+ };
986
+ const checkBanned = (context, { object, banned }) => {
987
+ for (const property of propertiesOf(object)) for (const reason of Option.toArray(Option.flatMap(keyOf(property), (key) => Record.get(banned, key)))) context.report({
988
+ node: property,
989
+ messageId: "banned",
990
+ data: {
991
+ key: textOf(context)(property.key),
992
+ reason
993
+ },
994
+ fix: (fixer) => fixer.removeRange(removedRange({
995
+ object,
996
+ property
997
+ }))
998
+ });
999
+ };
1000
+ const seriesNameOf = (script) => pipe(propertyOf$1(SERIES)(script), Option.map(({ value }) => value), Option.filter(isStringLiteral));
1001
+ const checkSeries = (check) => {
1002
+ const { context, script, name, series } = check;
1003
+ checkValues({
1004
+ context,
1005
+ object: script,
1006
+ values: series.values ?? {},
1007
+ name,
1008
+ before: propertyOf$1(CUTS)(script)
1009
+ });
1010
+ checkAfterIntro({
1011
+ context,
1012
+ script,
1013
+ name,
1014
+ values: series.afterIntro ?? {}
1015
+ });
1016
+ checkVoices(check);
1017
+ for (const rule of Option.toArray(Option.fromNullishOr(check.series.intro))) checkIntro({
1018
+ context: check.context,
1019
+ script: check.script,
1020
+ name: check.name,
1021
+ rule
1022
+ });
1023
+ };
1024
+ const checkScript = (context, { script, options }) => {
1025
+ for (const literal of Option.toArray(seriesNameOf(script))) {
1026
+ const name = literal.value;
1027
+ const series = Record.get(options.series, name);
1028
+ if (Option.isNone(series)) {
1029
+ context.report({
1030
+ node: literal,
1031
+ messageId: "unknown",
1032
+ data: {
1033
+ series: name,
1034
+ known: Array.join(Record.keys(options.series), ", ")
1035
+ }
1036
+ });
1037
+ return;
1038
+ }
1039
+ checkSeries({
1040
+ context,
1041
+ script,
1042
+ name,
1043
+ series: series.value
1044
+ });
1045
+ }
1046
+ };
632
1047
  // src/features/define-lint-rules/model/coded-rules.ts
633
1048
  const CODED_RULES = {
634
1049
  "array-from-async": arrayFromAsync,
@@ -637,13 +1052,33 @@ const CODED_RULES = {
637
1052
  "get-or-insert": getOrInsert,
638
1053
  "inline-exports": inlineExports,
639
1054
  "mcp-tool-layer": mcpToolLayer,
640
- "readonly-parameters": typedRuleOf({
1055
+ "readonly-parameters": readonlyParameters,
1056
+ "video-readings": videoReadings,
1057
+ "video-say": videoSay,
1058
+ "video-series": {
641
1059
  meta: {
642
- type: "suggestion",
643
- messages: { [MESSAGE_ID]: MESSAGE }
1060
+ type: "problem",
1061
+ fixable: "code",
1062
+ messages: MESSAGES,
1063
+ schema: [{
1064
+ type: "object",
1065
+ additionalProperties: true
1066
+ }]
644
1067
  },
645
- visitorOf
646
- })
1068
+ create: (context) => {
1069
+ const options = optionsOf(context.options);
1070
+ return { ObjectExpression: (object) => {
1071
+ checkBanned(context, {
1072
+ object,
1073
+ banned: options.banned ?? {}
1074
+ });
1075
+ if (Option.isSome(propertyOf$1("cuts")(object))) checkScript(context, {
1076
+ script: object,
1077
+ options
1078
+ });
1079
+ } };
1080
+ }
1081
+ }
647
1082
  };
648
1083
  // src/features/define-lint-rules/model/intent-rule.ts
649
1084
  const NAMESPACE = "*";