UNPKG

eslint-plugin-comment-length

Version:

An ESLint plugin that provides rules that limit the line length of your comments

1 lines 4.33 kB
{"version":3,"file":"typings.options.cjs","sources":["../../src/typings.options.ts"],"sourcesContent":["import type { JSONSchema4 } from \"@typescript-eslint/utils/json-schema\";\n\nexport type Options = {\n /**\n * specifies how the auto-fix wrapping mechanism functions.\n *\n * - \"overflow-only\" ensures that only overflowing lines are reflowed to new\n * lines,\n *\n * - whereas \"compact\" tries to produce as compact blocks as possible,\n * potentially merging multiple nearby lines even though no overflow was\n * occuring on the lines.\n *\n * - Finally, \"compact-on-overflow\" attempts to produce as compact blocks as\n * possible, however only when overflow within a block has been detected.\n *\n * @default overflow-only\n */\n mode: \"overflow-only\" | \"compact-on-overflow\" | \"compact\";\n\n /**\n * specifies the maxmium length that a comment is allowed to take\n *\n * @default 80\n */\n maxLength: number;\n\n /**\n * attempts to wrap at logical pauses in comments based on where punctuation\n * is found.\n *\n * This will often wrap the text sooner than if this was disabled,\n * but it potentially makes it easier to read comments.\n *\n * @default false\n */\n logicalWrap: boolean;\n\n /**\n * if set to true, then overflow lines including comments will be ignored\n *\n * @default true\n */\n ignoreUrls: boolean;\n\n /**\n * attempts to avoid reflowing comments that contains code as this may break\n * the semantic meaning of the code.\n *\n * NB: This option causes ESLint to be run on comment content in an attempt\n * to see if the code inside is parsable, which may have a significant\n * performance impact depending on the parser used.\n *\n * @default false\n */\n ignoreCommentsWithCode: boolean;\n\n /**\n * in case you are using tabs to indent your code, then this plugin needs to\n * know the configured tab size, in order to properly determine when a\n * comment exceeds the configured max length.\n *\n * If you are using VSCode, then this option should match the\n * `editor.tabSize` option.\n *\n * @default 2\n */\n tabSize: number;\n\n /**\n * by default semantic comments such as // eslint-disable* will be ignored by\n * this plugin as they may alter the functionality of other programs.\n *\n * In case you need to add additional variants of comments that should be\n * ignored by this plugin, then they can be added through this option.\n *\n * @example\n * semanticComments: [\"i18n-extract-keys\", \"i18n-extract-mark-context\"]\n */\n semanticComments?: string[];\n};\n\nexport type RuleOptions = [Options];\n\nexport const defaultOptions = [\n {\n mode: \"overflow-only\",\n maxLength: 80,\n ignoreUrls: true,\n ignoreCommentsWithCode: false,\n tabSize: 2,\n logicalWrap: false,\n semanticComments: [],\n },\n] satisfies RuleOptions;\n\nexport const optionsSchema = [\n {\n type: \"object\",\n properties: {\n mode: {\n type: \"string\",\n enum: [\"overflow-only\", \"compact-on-overflow\", \"compact\"],\n },\n maxLength: { type: \"integer\" },\n ignoreUrls: { type: \"boolean\" },\n ignoreCommentsWithCode: { type: \"boolean\" },\n tabSize: { type: \"integer\" },\n logicalWrap: { type: \"boolean\" },\n semanticComments: {\n type: \"array\",\n items: { type: \"string\" },\n },\n },\n },\n] satisfies [JSONSchema4];\n"],"names":[],"mappings":";;AAoFO,MAAM,cAAiB,GAAA;AAAA,EAC5B;AAAA,IACE,IAAM,EAAA,eAAA;AAAA,IACN,SAAW,EAAA,EAAA;AAAA,IACX,UAAY,EAAA,IAAA;AAAA,IACZ,sBAAwB,EAAA,KAAA;AAAA,IACxB,OAAS,EAAA,CAAA;AAAA,IACT,WAAa,EAAA,KAAA;AAAA,IACb,kBAAkB,EAAC;AAAA,GACrB;AACF,EAAA;AAEO,MAAM,aAAgB,GAAA;AAAA,EAC3B;AAAA,IACE,IAAM,EAAA,QAAA;AAAA,IACN,UAAY,EAAA;AAAA,MACV,IAAM,EAAA;AAAA,QACJ,IAAM,EAAA,QAAA;AAAA,QACN,IAAM,EAAA,CAAC,eAAiB,EAAA,qBAAA,EAAuB,SAAS,CAAA;AAAA,OAC1D;AAAA,MACA,SAAA,EAAW,EAAE,IAAA,EAAM,SAAU,EAAA;AAAA,MAC7B,UAAA,EAAY,EAAE,IAAA,EAAM,SAAU,EAAA;AAAA,MAC9B,sBAAA,EAAwB,EAAE,IAAA,EAAM,SAAU,EAAA;AAAA,MAC1C,OAAA,EAAS,EAAE,IAAA,EAAM,SAAU,EAAA;AAAA,MAC3B,WAAA,EAAa,EAAE,IAAA,EAAM,SAAU,EAAA;AAAA,MAC/B,gBAAkB,EAAA;AAAA,QAChB,IAAM,EAAA,OAAA;AAAA,QACN,KAAA,EAAO,EAAE,IAAA,EAAM,QAAS,EAAA;AAAA,OAC1B;AAAA,KACF;AAAA,GACF;AACF;;;;;"}