forked from public/fvtt-cthulhu-eternal
1 line
30 KiB
Plaintext
1 line
30 KiB
Plaintext
|
{"version":3,"file":"checkExamples.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_eslint","_interopRequireWildcard","_semver","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","CLIEngine","eslint","zeroBasedLineIndexAdjust","likelyNestedJSDocIndentSpace","preTagSpaceLength","firstLinePrefixLength","hasCaptionRegex","escapeStringRegexp","str","replaceAll","countChars","ch","match","RegExp","length","defaultMdRules","defaultExpressionRules","quotes","semi","strict","getLinesCols","text","matchLines","colDelta","slice","lastIndexOf","_default","exports","iterateJsdoc","report","utils","context","globalState","semver","gte","ESLint","version","column","line","Map","matchingFileNameMap","options","exampleCodeRegex","rejectExampleCodeRegex","checkDefaults","checkParams","checkProperties","noDefaultExampleRules","checkEslintrc","matchingFileName","matchingFileNameDefaults","matchingFileNameParams","matchingFileNameProperties","paddedIndent","baseConfig","configFile","allowInlineConfig","reportUnusedDisableDirectives","captionRequired","rulePaths","mdRules","undefined","expressionRules","getRegexFromString","checkSource","filename","defaultFileName","rules","lines","cols","skipInit","source","targetTagName","sources","tag","push","nonJSPrefacingCols","nonJSPrefacingLines","string","checkRules","cliConfig","useEslintrc","cliConfigStr","JSON","stringify","src","fileNameMapKey","file","cliFile","cli","config","getConfigForFile","results","messages","executeOnText","number","codeStartLine","codeStartCol","message","severity","ruleId","startLine","startCol","targetSource","getFilenameInfo","ext","jsFileName","getFilename","includes","replace","filenameInfo","forEachPreferredTag","description","trim","getTagDescription","tagName","getPreferredTagName","hasTag","matchingFilenameInfo","test","startingIndex","lastStringCount","exampleCode","lastIndex","exec","index","n0","n1","preMatch","preMatchLines","nonJSPreface","nonJSPrefaceLineCount","idx","indexOf","charsInLastLine","global","iterateAllJsdocs","meta","docs","url","schema","additionalProperties","properties","type","module"],"sources":["../../src/rules/checkExamples.js"],"sourcesContent":["// Todo: When replace `CLIEngine` with `ESLint` when feature set complete per https://github.com/eslint/eslint/issues/14745\n// https://github.com/eslint/eslint/blob/master/docs/user-guide/migrating-to-7.0.0.md#-the-cliengine-class-has-been-deprecated\nimport iterateJsdoc from '../iterateJsdoc.js';\nimport eslint, {\n ESLint,\n} from 'eslint';\nimport semver from 'semver';\n\nconst {\n // @ts-expect-error Older ESLint\n CLIEngine,\n} = eslint;\n\nconst zeroBasedLineIndexAdjust = -1;\nconst likelyNestedJSDocIndentSpace = 1;\nconst preTagSpaceLength = 1;\n\n// If a space is present, we should ignore it\nconst firstLinePrefixLength = preTagSpaceLength;\n\nconst hasCaptionRegex = /^\\s*<caption>([\\s\\S]*?)<\\/caption>/u;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst escapeStringRegexp = (str) => {\n return str.replaceAll(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n};\n\n/**\n * @param {string} str\n * @param {string} ch\n * @returns {import('../iterateJsdoc.js').Integer}\n */\nconst countChars = (str, ch) => {\n return (str.match(new RegExp(escapeStringRegexp(ch), 'gu')) || []).length;\n};\n\n/** @type {import('eslint').Linter.RulesRecord} */\nconst defaultMdRules = {\n // \"always\" newline rule at end unlikely in sample code\n 'eol-last': 0,\n\n // Wouldn't generally expect example paths to resolve relative to JS file\n 'import/no-unresolved': 0,\n\n // Snippets likely too short to always include import/export info\n 'import/unambiguous': 0,\n\n 'jsdoc/require-file-overview': 0,\n\n // The end of a multiline comment would end the comment the example is in.\n 'jsdoc/require-jsdoc': 0,\n\n // Unlikely to have inadvertent debugging within examples\n 'no-console': 0,\n\n // Often wish to start `@example` co
|