@storm-software/eslint
Version:
A package containing the base ESLint configuration used by Storm Software across many projects.
1,499 lines (1,474 loc) • 678 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var eslintFlatConfigUtils = require('eslint-flat-config-utils');
var localPkg = require('local-pkg');
var process2 = require('process');
var url$1 = require('url');
var cspellConfig = require('@cspell/eslint-plugin/recommended');
var fs3 = require('fs');
var path16 = require('path');
var defu = require('defu');
require('@cspell/eslint-plugin');
var default3 = require('@nx/eslint-plugin/nx.js');
var default4 = require('@vitest/eslint-plugin');
var Module = require('module');
var unrsResolver = require('unrs-resolver');
var eslintImportContext = require('eslint-import-context');
var debug = require('debug');
var eslint = require('eslint');
var stableHashX = require('stable-hash-x');
var types$1 = require('@typescript-eslint/types');
var vm = require('vm');
var braceExpansion = require('brace-expansion');
var semver = require('semver');
var isGlob = require('is-glob');
var eslintUnsupportedApi = require('eslint/use-at-your-own-risk');
var default5 = require('eslint-plugin-import-zod');
var default6 = require('eslint-plugin-n');
var default7 = require('eslint-plugin-no-only-tests');
var default8 = require('eslint-plugin-no-secrets');
var default9 = require('eslint-plugin-perfectionist');
var jsoncParser = require('jsonc-eslint-parser');
var yamlParser = require('yaml-eslint-parser');
var findUpSimple = require('find-up-simple');
var pnpmWorkspaceYaml = require('pnpm-workspace-yaml');
var pathe = require('pathe');
var tinyglobby = require('tinyglobby');
var default10 = require('eslint-plugin-prettier');
var default11 = require('eslint-plugin-unicorn');
var default12 = require('eslint-plugin-unused-imports');
var c12 = require('c12');
var chalk = require('chalk');
var promises = require('fs/promises');
var globalsLib = require('globals');
var utils = require('@typescript-eslint/utils');
var os = require('os');
var eslintMergeProcessors = require('eslint-merge-processors');
var devkit = require('@nx/devkit');
var config2 = require('eslint-plugin-prettier/recommended');
var eslintPluginRegexp = require('eslint-plugin-regexp');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var process2__default = /*#__PURE__*/_interopDefault(process2);
var cspellConfig__default = /*#__PURE__*/_interopDefault(cspellConfig);
var fs3__default = /*#__PURE__*/_interopDefault(fs3);
var path16__default = /*#__PURE__*/_interopDefault(path16);
var defu__default = /*#__PURE__*/_interopDefault(defu);
var default3__default = /*#__PURE__*/_interopDefault(default3);
var default4__default = /*#__PURE__*/_interopDefault(default4);
var Module__default = /*#__PURE__*/_interopDefault(Module);
var debug__default = /*#__PURE__*/_interopDefault(debug);
var vm__default = /*#__PURE__*/_interopDefault(vm);
var semver__namespace = /*#__PURE__*/_interopNamespace(semver);
var isGlob__default = /*#__PURE__*/_interopDefault(isGlob);
var eslintUnsupportedApi__default = /*#__PURE__*/_interopDefault(eslintUnsupportedApi);
var default5__default = /*#__PURE__*/_interopDefault(default5);
var default6__default = /*#__PURE__*/_interopDefault(default6);
var default7__default = /*#__PURE__*/_interopDefault(default7);
var default8__default = /*#__PURE__*/_interopDefault(default8);
var default9__default = /*#__PURE__*/_interopDefault(default9);
var jsoncParser__namespace = /*#__PURE__*/_interopNamespace(jsoncParser);
var yamlParser__namespace = /*#__PURE__*/_interopNamespace(yamlParser);
var default10__default = /*#__PURE__*/_interopDefault(default10);
var default11__default = /*#__PURE__*/_interopDefault(default11);
var default12__default = /*#__PURE__*/_interopDefault(default12);
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
var globalsLib__default = /*#__PURE__*/_interopDefault(globalsLib);
var os__default = /*#__PURE__*/_interopDefault(os);
var config2__default = /*#__PURE__*/_interopDefault(config2);
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
__defProp(target, "default", { value: mod, enumerable: true }) ,
mod
));
// ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__c6e5a1ff3e71b7415dce15be46368d04/node_modules/tsup/assets/cjs_shims.js
var getImportMetaUrl, importMetaUrl;
var init_cjs_shims = __esm({
"../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__c6e5a1ff3e71b7415dce15be46368d04/node_modules/tsup/assets/cjs_shims.js"() {
getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
}
});
// ../../node_modules/.pnpm/eslint-plugin-tsdoc@0.4.0_patch_hash=11b9fbe0e91a2ce3492e80b89a7502a9ff364683b23b9bdfc2c979d988e1682b/node_modules/eslint-plugin-tsdoc/lib/Debug.js
var require_Debug = __commonJS({
"../../node_modules/.pnpm/eslint-plugin-tsdoc@0.4.0_patch_hash=11b9fbe0e91a2ce3492e80b89a7502a9ff364683b23b9bdfc2c979d988e1682b/node_modules/eslint-plugin-tsdoc/lib/Debug.js"(exports) {
init_cjs_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Debug = void 0;
var Debug = class {
// To debug the plugin, temporarily uncomment the body of this function
static log(message2) {
}
};
exports.Debug = Debug;
}
});
// ../../node_modules/.pnpm/eslint-plugin-tsdoc@0.4.0_patch_hash=11b9fbe0e91a2ce3492e80b89a7502a9ff364683b23b9bdfc2c979d988e1682b/node_modules/eslint-plugin-tsdoc/lib/ConfigCache.js
var require_ConfigCache = __commonJS({
"../../node_modules/.pnpm/eslint-plugin-tsdoc@0.4.0_patch_hash=11b9fbe0e91a2ce3492e80b89a7502a9ff364683b23b9bdfc2c979d988e1682b/node_modules/eslint-plugin-tsdoc/lib/ConfigCache.js"(exports) {
init_cjs_shims();
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
if (k2 === void 0) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() {
return m[k];
} };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === void 0) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = exports && exports.__importStar || function(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) {
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
}
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigCache = void 0;
var tsdoc_config_1 = __require("@microsoft/tsdoc-config");
var path23 = __importStar(__require("path"));
var Debug_1 = require_Debug();
function _nullishCoalesce(lhs, rhsFn) {
if (lhs != null) {
return lhs;
} else {
return rhsFn();
}
}
var _fs = __require("fs");
var _path = __require("path");
var MAX_PATH_SEARCH_DEPTH3 = 30;
var depth3 = 0;
var ROOT_FILES = [
"storm-workspace.json",
"storm-workspace.json",
"storm-workspace.yaml",
"storm-workspace.yml",
"storm-workspace.js",
"storm-workspace.ts",
".storm-workspace.json",
".storm-workspace.yaml",
".storm-workspace.yml",
".storm-workspace.js",
".storm-workspace.ts",
"lerna.json",
"nx.json",
"turbo.json",
"npm-workspace.json",
"yarn-workspace.json",
"pnpm-workspace.json",
"npm-workspace.yaml",
"yarn-workspace.yaml",
"pnpm-workspace.yaml",
"npm-workspace.yml",
"yarn-workspace.yml",
"pnpm-workspace.yml",
"npm-lock.json",
"yarn-lock.json",
"pnpm-lock.json",
"npm-lock.yaml",
"yarn-lock.yaml",
"pnpm-lock.yaml",
"npm-lock.yml",
"yarn-lock.yml",
"pnpm-lock.yml",
"bun.lockb"
];
var ROOT_DIRECTORIES = [
".storm-workspace",
".nx",
".github",
".vscode",
".verdaccio"
];
function findWorkspaceRoot3(startPath) {
const _startPath = _nullishCoalesce(startPath, () => process.cwd());
if (ROOT_DIRECTORIES.some(
(endDirName) => _fs.existsSync.call(void 0, _path.join.call(void 0, _startPath, endDirName))
)) {
return _startPath;
}
if (ROOT_FILES.some(
(endFileName) => _fs.existsSync.call(void 0, _path.join.call(void 0, _startPath, endFileName))
)) {
return _startPath;
}
if (_startPath !== "/" && depth3++ < MAX_PATH_SEARCH_DEPTH3) {
const parent = _path.join.call(void 0, _startPath, "..");
return findWorkspaceRoot3(parent);
}
return void 0;
}
var CACHE_CHECK_INTERVAL_MS = 3 * 1e3;
var CACHE_EXPIRE_MS = 20 * 1e3;
var CACHE_MAX_SIZE = 100;
var ConfigCache = class _ConfigCache {
/**
* Node.js equivalent of performance.now().
*/
static _getTimeInMs() {
const [seconds, nanoseconds] = process.hrtime();
return seconds * 1e3 + nanoseconds / 1e6;
}
static getForSourceFile(sourceFilePath, tsConfigRootDir) {
const sourceFileFolder = path23.dirname(path23.resolve(sourceFilePath));
const configFilePath = tsConfigRootDir ? path23.join(tsConfigRootDir, tsdoc_config_1.TSDocConfigFile.FILENAME) : tsdoc_config_1.TSDocConfigFile.findConfigPathForFolder(sourceFileFolder);
const cacheKey = configFilePath || sourceFileFolder + "/";
Debug_1.Debug.log(`Cache key: "${cacheKey}"`);
const nowMs = _ConfigCache._getTimeInMs();
let cachedConfig = void 0;
cachedConfig = _ConfigCache._cachedConfigs.get(cacheKey);
if (cachedConfig) {
Debug_1.Debug.log("Cache hit");
const loadAgeMs = nowMs - cachedConfig.loadTimeMs;
const lastCheckAgeMs = nowMs - cachedConfig.lastCheckTimeMs;
if (loadAgeMs > CACHE_EXPIRE_MS || loadAgeMs < 0) {
Debug_1.Debug.log("Evicting because item is expired");
cachedConfig = void 0;
_ConfigCache._cachedConfigs.delete(cacheKey);
} else if (lastCheckAgeMs > CACHE_CHECK_INTERVAL_MS || lastCheckAgeMs < 0) {
Debug_1.Debug.log("Checking for modifications");
cachedConfig.lastCheckTimeMs = nowMs;
if (cachedConfig.configFile.checkForModifiedFiles()) {
Debug_1.Debug.log("Evicting because item was modified");
cachedConfig = void 0;
_ConfigCache._cachedConfigs.delete(cacheKey);
}
}
}
if (!cachedConfig) {
if (_ConfigCache._cachedConfigs.size > CACHE_MAX_SIZE) {
Debug_1.Debug.log("Clearing cache");
_ConfigCache._cachedConfigs.clear();
}
const configFile = tsdoc_config_1.TSDocConfigFile.loadFile(configFilePath);
if (configFile.fileNotFound) {
Debug_1.Debug.log(`File not found: "${configFilePath}"`);
} else {
Debug_1.Debug.log(`Loaded: "${configFilePath}"`);
}
cachedConfig = {
configFile,
lastCheckTimeMs: nowMs,
loadTimeMs: nowMs
};
_ConfigCache._cachedConfigs.set(cacheKey, cachedConfig);
}
return cachedConfig.configFile;
}
static _checkConfigFilePath(workspaceRoot, configFilePath) {
const workspaceRootPath = workspaceRoot ? workspaceRoot : "./";
if (!configFilePath) {
return void 0;
}
if (_fs.existsSync(configFilePath)) {
return configFilePath;
} else if (_fs.existsSync(
path23.join(
workspaceRootPath,
configFilePath
)
)) {
return path23.join(
workspaceRootPath,
configFilePath
);
} else if (_fs.existsSync(
path23.join(
workspaceRootPath,
"node_modules",
configFilePath
)
)) {
return path23.join(
workspaceRootPath,
"node_modules",
configFilePath
);
} else if (_fs.existsSync(
path23.join(
workspaceRootPath,
"node_modules",
"@storm-software",
"tsdoc",
configFilePath
)
)) {
return path23.join(
workspaceRootPath,
"node_modules",
"@storm-software",
"tsdoc",
configFilePath
);
} else if (_fs.existsSync(
path23.join(
workspaceRootPath,
"node_modules",
"@storm-software",
"tsdoc",
"config",
configFilePath
)
)) {
return path23.join(
workspaceRootPath,
"node_modules",
"@storm-software",
"tsdoc",
"config",
configFilePath
);
} else if (_fs.existsSync(
path23.join(
workspaceRootPath,
"node_modules",
"@storm-software",
"tsdoc",
"dist",
configFilePath
)
)) {
return path23.join(
workspaceRootPath,
"node_modules",
"@storm-software",
"tsdoc",
"dist",
configFilePath
);
}
return void 0;
}
static getStormConfigFile(options) {
const type = options && options.type ? options.type : "recommended";
const configFile = options && options.configFile ? options.configFile : void 0;
let workspaceRoot = "";
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
workspaceRoot = process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
}
if (!workspaceRoot) {
workspaceRoot = findWorkspaceRoot3();
}
let currentConfigFile = process.env.STORM_TSDOC_CONFIG_FILE ? process.env.STORM_TSDOC_CONFIG_FILE : configFile;
Debug_1.Debug.log(`Config file from user options: ${currentConfigFile || "(none)"}`);
let configFilePath = _ConfigCache._checkConfigFilePath(
workspaceRoot,
currentConfigFile
);
if (!configFilePath) {
currentConfigFile = `${((process.env.STORM_TSDOC_TYPE ? process.env.STORM_TSDOC_TYPE : type) || "recommended").replace(/\.jsonc?$/, "")}.json`;
Debug_1.Debug.log(`Config file from user options not found, trying: ${currentConfigFile}`);
configFilePath = _ConfigCache._checkConfigFilePath(
workspaceRoot,
currentConfigFile
);
if (!configFilePath) {
configFilePath = _ConfigCache._checkConfigFilePath(
workspaceRoot,
"recommended.json"
);
if (!configFilePath) {
configFilePath = _ConfigCache._checkConfigFilePath(
workspaceRoot,
"tsdoc.json"
);
}
}
}
const cacheKey = configFilePath || "missing-config-file";
Debug_1.Debug.log(`Storm Software Configuration Cache key: "${cacheKey}"`);
const nowMs = _ConfigCache._getTimeInMs();
let cachedConfig = void 0;
cachedConfig = _ConfigCache._cachedConfigs.get(cacheKey);
if (cachedConfig) {
Debug_1.Debug.log("Cache hit");
const loadAgeMs = nowMs - cachedConfig.loadTimeMs;
const lastCheckAgeMs = nowMs - cachedConfig.lastCheckTimeMs;
if (loadAgeMs > CACHE_EXPIRE_MS || loadAgeMs < 0) {
Debug_1.Debug.log("Evicting because item is expired");
cachedConfig = void 0;
_ConfigCache._cachedConfigs.delete(cacheKey);
} else if (lastCheckAgeMs > CACHE_CHECK_INTERVAL_MS || lastCheckAgeMs < 0) {
Debug_1.Debug.log("Checking for modifications");
cachedConfig.lastCheckTimeMs = nowMs;
if (cachedConfig.configFile.checkForModifiedFiles()) {
Debug_1.Debug.log("Evicting because item was modified");
cachedConfig = void 0;
_ConfigCache._cachedConfigs.delete(cacheKey);
}
}
}
if (!cachedConfig) {
if (_ConfigCache._cachedConfigs.size > CACHE_MAX_SIZE) {
Debug_1.Debug.log("Clearing cache");
_ConfigCache._cachedConfigs.clear();
}
const configFile2 = tsdoc_config_1.TSDocConfigFile.loadFile(configFilePath);
if (configFile2.fileNotFound) {
Debug_1.Debug.log(`File not found: "${configFilePath}"`);
} else {
Debug_1.Debug.log(`Loaded: "${configFilePath}"`);
}
cachedConfig = {
configFile: configFile2,
lastCheckTimeMs: nowMs,
loadTimeMs: nowMs
};
_ConfigCache._cachedConfigs.set(cacheKey, cachedConfig);
}
return cachedConfig.configFile;
}
};
exports.ConfigCache = ConfigCache;
ConfigCache._cachedConfigs = /* @__PURE__ */ new Map();
ConfigCache._cachedPaths = /* @__PURE__ */ new Map();
}
});
// ../../node_modules/.pnpm/eslint-plugin-tsdoc@0.4.0_patch_hash=11b9fbe0e91a2ce3492e80b89a7502a9ff364683b23b9bdfc2c979d988e1682b/node_modules/eslint-plugin-tsdoc/lib/index.js
var require_lib = __commonJS({
"../../node_modules/.pnpm/eslint-plugin-tsdoc@0.4.0_patch_hash=11b9fbe0e91a2ce3492e80b89a7502a9ff364683b23b9bdfc2c979d988e1682b/node_modules/eslint-plugin-tsdoc/lib/index.js"(exports, module) {
init_cjs_shims();
var tsdoc_1 = __require("@microsoft/tsdoc");
var Debug_1 = require_Debug();
var ConfigCache_1 = require_ConfigCache();
var tsdocMessageIds = {};
var defaultTSDocConfiguration = new tsdoc_1.TSDocConfiguration();
defaultTSDocConfiguration.allTsdocMessageIds.forEach((messageId) => {
tsdocMessageIds[messageId] = `${messageId}: {{unformattedText}}`;
});
var plugin5 = {
rules: {
// NOTE: The actual ESLint rule name will be "tsdoc/syntax". It is calculated by deleting "eslint-plugin-"
// from the NPM package name, and then appending this string.
syntax: {
meta: {
messages: Object.assign({
"error-loading-storm-config": `Error loading Storm Software's shared TSDoc config file:
{{details}}
Please ensure "@storm-software/tsdoc" is installed in the workspace root.`,
"error-loading-config-file": "Error loading TSDoc config file:\n{{details}}",
"error-applying-storm-config": "Error applying Storm Software's shared TSDoc configuration: {{details}}",
"error-applying-config": "Error applying TSDoc configuration: {{details}}"
}, tsdocMessageIds),
type: "problem",
docs: {
description: "Validates that TypeScript documentation comments conform to the TSDoc standard",
category: "Stylistic Issues",
recommended: true,
url: "https://tsdoc.org/pages/packages/eslint-plugin-tsdoc"
},
schema: [
{
type: "object",
properties: {
type: {
type: "string",
enum: ["typedoc", "api-extractor", "base", "core", "callouts", "recommended"],
description: "The TSDoc configuration type to use from '@storm-software/tsdoc'. Defaults to 'recommended' (@storm-software/tsdoc/recommended.json)."
},
configFile: {
type: "string",
description: "The TSDoc configuration file to use."
}
},
additionalProperties: false
}
]
},
defaultOptions: [
{
type: "recommended"
}
],
create: (context) => {
const tsdocConfiguration = new tsdoc_1.TSDocConfiguration();
const tsConfigDir = context.parserOptions.tsconfigRootDir;
const sourceFilePath = context.filename;
Debug_1.Debug.log(`Linting: "${sourceFilePath}"`);
try {
let tsdocConfigFile = {};
try {
const userOptions = context.options ? Array.isArray(context.options) ? context.options.length > 0 ? context.options[0] : {} : context.options : {};
const config3 = { type: userOptions.type || "recommended", configFile: userOptions.configFile };
Debug_1.Debug.log(`Using eslint-plugin-tsdoc config: ${JSON.stringify(config3, void 0, 2)}`);
tsdocConfigFile = ConfigCache_1.ConfigCache.getStormConfigFile(config3);
if (!tsdocConfigFile.fileNotFound) {
if (tsdocConfigFile.hasErrors) {
context.report({
loc: { line: 1, column: 1 },
messageId: "error-loading-storm-config",
data: {
details: tsdocConfigFile.getErrorSummary()
}
});
}
try {
tsdocConfigFile.configureParser(tsdocConfiguration);
} catch (e) {
context.report({
loc: { line: 1, column: 1 },
messageId: "error-applying-storm-config",
data: {
details: e.message
}
});
}
}
} catch (e) {
context.report({
loc: { line: 1, column: 1 },
messageId: "error-loading-storm-config",
data: {
details: `Unexpected exception: ${e.message}`
}
});
}
if (!tsdocConfigFile || tsdocConfigFile.fileNotFound || tsdocConfigFile.hasErrors) {
tsdocConfigFile = ConfigCache_1.ConfigCache.getForSourceFile(sourceFilePath, tsConfigDir);
if (!tsdocConfigFile.fileNotFound) {
if (tsdocConfigFile.hasErrors) {
context.report({
loc: { line: 1, column: 1 },
messageId: "error-loading-config-file",
data: {
details: tsdocConfigFile.getErrorSummary()
}
});
}
try {
tsdocConfigFile.configureParser(tsdocConfiguration);
} catch (e) {
context.report({
loc: { line: 1, column: 1 },
messageId: "error-applying-config",
data: {
details: e.message
}
});
}
}
}
} catch (e) {
context.report({
loc: { line: 1, column: 1 },
messageId: "error-loading-config-file",
data: {
details: `Unexpected exception: ${e.message}`
}
});
}
const tsdocParser = new tsdoc_1.TSDocParser(tsdocConfiguration);
const sourceCode = context.getSourceCode();
const checkCommentBlocks = function(node2) {
for (const comment of sourceCode.getAllComments()) {
if (comment.type !== "Block") {
continue;
}
if (!comment.range) {
continue;
}
const textRange = tsdoc_1.TextRange.fromStringRange(sourceCode.text, comment.range[0], comment.range[1]);
if (textRange.length < 5) {
continue;
}
if (textRange.buffer[textRange.pos + 2] !== "*") {
continue;
}
const parserContext = tsdocParser.parseRange(textRange);
for (const message2 of parserContext.log.messages) {
context.report({
loc: {
start: sourceCode.getLocFromIndex(message2.textRange.pos),
end: sourceCode.getLocFromIndex(message2.textRange.end)
},
messageId: message2.messageId,
data: {
unformattedText: message2.unformattedText
}
});
}
}
};
return {
Program: checkCommentBlocks
};
}
}
}
};
module.exports = plugin5;
}
});
// src/preset.ts
init_cjs_shims();
// src/configs/astro.ts
init_cjs_shims();
// src/utils/constants.ts
init_cjs_shims();
var ACRONYMS_LIST = [
"API",
"ASCII",
"CPU",
"CSS",
"DNS",
"EOF",
"GUID",
"HTML",
"HTTP",
"HTTPS",
"ID",
"IP",
"JSON",
"LHS",
"OEM",
"PP",
"QA",
"RAM",
"RHS",
"RPC",
"RSS",
"SLA",
"SMTP",
"SQL",
"SSH",
"SSL",
"TCP",
"TLS",
"TTL",
"UDP",
"UI",
"UID",
"UUID",
"URI",
"URL",
"UTF",
"VM",
"XML",
"XSS"
];
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
var GLOB_SRC_FILE = `*.${GLOB_SRC_EXT}`;
var GLOB_SRC = `**/${GLOB_SRC_FILE}`;
var GLOB_JSX_EXT = "?([cm])jsx";
var GLOB_JSX_FILE = `*.${GLOB_JSX_EXT}`;
var GLOB_JSX = `**/${GLOB_JSX_FILE}`;
var GLOB_TS_EXT = "?([cm])ts";
var GLOB_TS_FILE = `*.${GLOB_TS_EXT}`;
var GLOB_TS = `**/${GLOB_TS_FILE}`;
var GLOB_TSX_EXT = "?([cm])tsx";
var GLOB_TSX_FILE = `*.${GLOB_TSX_EXT}`;
var GLOB_TSX = `**/${GLOB_TSX_FILE}`;
var GLOB_CSS_EXT = "css";
var GLOB_CSS_FILE = `*.${GLOB_CSS_EXT}`;
var GLOB_CSS = `**/${GLOB_CSS_FILE}`;
var GLOB_POSTCSS_EXT = "{p,post}css";
var GLOB_POSTCSS_FILE = `*.${GLOB_POSTCSS_EXT}`;
var GLOB_POSTCSS = `**/${GLOB_POSTCSS_FILE}`;
var GLOB_LESS_EXT = "less";
var GLOB_LESS_FILE = `*.${GLOB_LESS_EXT}`;
var GLOB_LESS = `**/${GLOB_LESS_FILE}`;
var GLOB_SCSS_EXT = "scss";
var GLOB_SCSS_FILE = `*.${GLOB_SCSS_EXT}`;
var GLOB_SCSS = `**/${GLOB_SCSS_FILE}`;
var GLOB_JSON_EXT = "json";
var GLOB_JSON_FILE = `*.${GLOB_JSON_EXT}`;
var GLOB_JSON = `**/${GLOB_JSON_FILE}`;
var GLOB_JSON5_EXT = "json5";
var GLOB_JSON5_FILE = `*.${GLOB_JSON5_EXT}`;
var GLOB_JSON5 = `**/${GLOB_JSON5_FILE}`;
var GLOB_JSONC_EXT = "jsonc";
var GLOB_JSONC_FILE = `*.${GLOB_JSONC_EXT}`;
var GLOB_JSONC = `**/${GLOB_JSONC_FILE}`;
var GLOB_MARKDOWN_EXT = "md";
var GLOB_MARKDOWN_FILE = `*.${GLOB_MARKDOWN_EXT}`;
var GLOB_MARKDOWN = `**/${GLOB_MARKDOWN_FILE}`;
var GLOB_MDX_EXT = "mdx";
var GLOB_MDX_FILE = `*.${GLOB_MDX_EXT}`;
var GLOB_MDX = `**/${GLOB_MDX_FILE}`;
var GLOB_MARKDOWN_IN_MARKDOWN = `${GLOB_MARKDOWN}/${GLOB_MARKDOWN_FILE}`;
var GLOB_YAML_EXT = "y?(a)ml";
var GLOB_YAML_FILE = `*.${GLOB_YAML_EXT}`;
var GLOB_YAML = `**/${GLOB_YAML_FILE}`;
var GLOB_TOML_EXT = "toml";
var GLOB_TOML_FILE = `*.${GLOB_TOML_EXT}`;
var GLOB_TOML = `**/${GLOB_TOML_FILE}`;
var GLOB_XML_EXT = "xml";
var GLOB_XML_FILE = `*.${GLOB_XML_EXT}`;
var GLOB_XML = `**/${GLOB_XML_FILE}`;
var GLOB_SVG_EXT = "svg";
var GLOB_SVG_FILE = `*.${GLOB_SVG_EXT}`;
var GLOB_SVG = `**/${GLOB_SVG_FILE}`;
var GLOB_HTML_EXT = "htm?(l)";
var GLOB_HTML_FILE = `*.${GLOB_HTML_EXT}`;
var GLOB_HTML = `**/${GLOB_HTML_FILE}`;
var GLOB_ASTRO_EXT = "astro";
var GLOB_ASTRO_FILE = `*.${GLOB_ASTRO_EXT}`;
var GLOB_ASTRO = `**/${GLOB_ASTRO_FILE}`;
var GLOB_ASTRO_TS = `${GLOB_ASTRO}/*.ts`;
var GLOB_GRAPHQL_EXT = "{g,graph}ql";
var GLOB_GRAPHQL_FILE = `*.${GLOB_GRAPHQL_EXT}`;
var GLOB_GRAPHQL = `**/${GLOB_GRAPHQL_FILE}`;
var GLOB_TESTS = [
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
`**/*.spec.${GLOB_SRC_EXT}`,
`**/*.test.${GLOB_SRC_EXT}`,
`**/*.bench.${GLOB_SRC_EXT}`,
`**/*.benchmark.${GLOB_SRC_EXT}`
];
var GLOB_EXCLUDE = [
"**/.git",
"**/node_modules",
"**/dist",
"**/tmp",
"**/coverage",
"**/bench",
"**/__snapshots__",
"**/__test__",
"**/__mocks__",
"**/__generated__",
"**/.wrangler",
"**/.rolldown",
"**/.docusaurus",
"**/.tamagui",
"**/tamagui.css",
"**/.nx",
"**/.next",
"**/.storm",
"**/.powerlines",
"**/.shell-shock",
"**/.earthquake",
"**/.aftershock",
"**/workbox*.js",
"**/sw*.js",
"**/service-worker.js",
"**/fallback*.js",
"**/ios",
"**/.android",
"**/.DS_Store",
"**/Thumbs.db",
"**/.cspellcache",
"**/package-lock.*",
"**/npm-lock.*",
"**/pnpm-lock.*",
"**/bun.lockb",
"**/cargo.lock",
"**/next-env.d.ts",
"**/CODEOWNERS",
"**/yarn.lock",
"**/jest.preset.{js,ts,cjs,cts,mjs,mts,json}",
"**/vitest.preset.{js,ts,cjs,cts,mjs,mts,json}",
"**/jest.config.{js,ts,cjs,cts,mjs,mts,json}",
"**/vitest.config.{js,ts,cjs,cts,mjs,mts,json}",
"**/vitest.workspace.{js,ts,cjs,cts,mjs,mts,json}",
"**/*.spec.{ts,tsx}",
"**/*.test.{ts,tsx}",
"**/output",
"**/temp",
"**/.temp",
"**/.history",
"**/.vitepress/cache",
"**/.nuxt",
"**/.svelte-kit",
"**/.vercel",
"**/.changeset",
"**/.idea",
"**/.cache",
"**/.vite-inspect",
"**/.yarn",
"**/*.min.*",
"**/CHANGELOG*.md",
"**/CONTRIBUTING.md",
"**/SECURITY.md",
"**/CODE_OF_CONDUCT.md",
"**/PULL_REQUEST_TEMPLATE.md",
"**/LICENSE*",
"**/auto-import?(s).d.ts",
"**/components.d.ts",
"**/vite.config.*.timestamp-*",
"**/webpack.config.*.timestamp-*",
"**/rollup.config.*.timestamp-*",
"**/nx/**/schema.d.ts",
"**/nx/**/schema.json",
"**/nx/**/schema.md",
"**/nx/**/*.schema.d.ts",
"**/nx/**/*.schema.json",
"**/nx/**/*.schema.md",
"**/nx/**/generators/**/files",
".agents/**/*",
"**/.agents/**/*",
".claude/**/*",
"**/.claude/**/*",
".codex/**/*",
"**/.codex/**/*",
".cursor/**/*",
"**/.cursor/**/*",
".opencode/**/*",
"**/.opencode/**/*",
".nx/**/*",
"**/.nx/**/*"
];
// src/utils/helpers.ts
init_cjs_shims();
var scopeUrl = url$1.fileURLToPath(new URL(".", importMetaUrl));
var isCwdInScope = localPkg.isPackageExists("@storm-software/eslint");
var parserPlain = {
meta: {
name: "parser-plain"
},
parseForESLint: (code) => ({
ast: {
body: [],
comments: [],
loc: { end: code.length, start: 0 },
range: [0, code.length],
tokens: [],
type: "Program"
},
scopeManager: null,
services: { isPlain: true },
visitorKeys: {
Program: []
}
})
};
function isInGitHooksOrLintStaged() {
return !!(process2__default.default.env.GIT_PARAMS || process2__default.default.env.VSCODE_GIT_COMMAND || process2__default.default.env.npm_lifecycle_script?.startsWith("lint-staged") || process2__default.default.env.npm_lifecycle_script?.startsWith("lefthook") || process2__default.default.env.npm_lifecycle_script === "push");
}
function isInEditorEnv() {
if (process2__default.default.env.CI) return false;
if (isInGitHooksOrLintStaged()) return false;
return !!(process2__default.default.env.VSCODE_PID || process2__default.default.env.VSCODE_CWD || process2__default.default.env.JETBRAINS_IDE || process2__default.default.env.VIM || process2__default.default.env.NVIM);
}
async function interopDefault(m) {
const resolved = await m;
return resolved.default || resolved;
}
function isPackageInScope(name3) {
return localPkg.isPackageExists(name3, { paths: [scopeUrl] });
}
async function ensurePackages(packages) {
if (process2__default.default.env.CI || process2__default.default.stdout.isTTY === false || isCwdInScope === false)
return;
const nonExistingPackages = packages.filter(
(i) => i && !isPackageInScope(i)
);
if (nonExistingPackages.length === 0) return;
const p = await import('@clack/prompts');
const result = await p.confirm({
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(
", "
)}. Do you want to install them?`
});
if (result)
await import('@antfu/install-pkg').then(
(i) => i.installPackage(nonExistingPackages, { dev: true })
);
}
function renameRules(rules3, map) {
return Object.fromEntries(
Object.entries(rules3).map(([key, value]) => {
for (const [from, to] of Object.entries(map)) {
if (key.startsWith(`${from}/`))
return [to + key.slice(from.length), value];
}
return [key, value];
})
);
}
// src/configs/astro.ts
async function astro(options = {}) {
const { files = [GLOB_ASTRO], overrides = {}, stylistic: stylistic2 = true } = options;
const [pluginAstro, parserAstro, parserTs] = await Promise.all([
interopDefault(import('eslint-plugin-astro')),
interopDefault(import('astro-eslint-parser')),
interopDefault(import('@typescript-eslint/parser'))
]);
return [
{
name: "storm/astro/setup",
plugins: {
astro: pluginAstro
}
},
{
files,
languageOptions: {
globals: pluginAstro.environments.astro.globals,
parser: parserAstro,
parserOptions: {
extraFileExtensions: [".astro"],
parser: parserTs
},
sourceType: "module"
},
name: "storm/astro/rules",
processor: "astro/client-side-ts",
rules: {
// use recommended rules
"astro/missing-client-only-directive-value": "error",
"astro/no-conflict-set-directives": "error",
"astro/no-deprecated-astro-canonicalurl": "error",
"astro/no-deprecated-astro-fetchcontent": "error",
"astro/no-deprecated-astro-resolve": "error",
"astro/no-deprecated-getentrybyslug": "error",
"astro/no-set-html-directive": "off",
"astro/no-unused-define-vars-in-style": "error",
"astro/semi": "off",
"astro/valid-compile": "error",
...stylistic2 ? {
"style/indent": "off",
"style/jsx-closing-tag-location": "off",
"style/jsx-one-expression-per-line": "off",
"style/no-multiple-empty-lines": "off"
} : {},
...overrides
}
}
];
}
// src/configs/cspell.ts
init_cjs_shims();
// src/utils/correct-paths.ts
init_cjs_shims();
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
function normalizeWindowsPath(input = "") {
if (!input) {
return input;
}
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
}
var _UNC_REGEX = /^[/\\]{2}/;
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
var correctPaths = function(path23) {
if (!path23 || path23.length === 0) {
return ".";
}
path23 = normalizeWindowsPath(path23);
const isUNCPath = path23.match(_UNC_REGEX);
const isPathAbsolute = isAbsolute(path23);
const trailingSeparator = path23[path23.length - 1] === "/";
path23 = normalizeString(path23, !isPathAbsolute);
if (path23.length === 0) {
if (isPathAbsolute) {
return "/";
}
return trailingSeparator ? "./" : ".";
}
if (trailingSeparator) {
path23 += "/";
}
if (_DRIVE_LETTER_RE.test(path23)) {
path23 += "/";
}
if (isUNCPath) {
if (!isPathAbsolute) {
return `//./${path23}`;
}
return `//${path23}`;
}
return isPathAbsolute && !isAbsolute(path23) ? `/${path23}` : path23;
};
var joinPaths = function(...segments) {
let path23 = "";
for (const seg of segments) {
if (!seg) {
continue;
}
if (path23.length > 0) {
const pathTrailing = path23[path23.length - 1] === "/";
const segLeading = seg[0] === "/";
const both = pathTrailing && segLeading;
if (both) {
path23 += seg.slice(1);
} else {
path23 += pathTrailing || segLeading ? seg : `/${seg}`;
}
} else {
path23 += seg;
}
}
return correctPaths(path23);
};
function cwd() {
if (typeof process !== "undefined" && typeof process.cwd === "function") {
return process.cwd().replace(/\\/g, "/");
}
return "/";
}
var resolve = function(...arguments_) {
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
let resolvedPath = "";
let resolvedAbsolute = false;
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
const path23 = index >= 0 ? arguments_[index] : cwd();
if (!path23 || path23.length === 0) {
continue;
}
resolvedPath = `${path23}/${resolvedPath}`;
resolvedAbsolute = isAbsolute(path23);
}
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
return `/${resolvedPath}`;
}
return resolvedPath.length > 0 ? resolvedPath : ".";
};
function normalizeString(path23, allowAboveRoot) {
let res = "";
let lastSegmentLength = 0;
let lastSlash = -1;
let dots = 0;
let char = null;
for (let index = 0; index <= path23.length; ++index) {
if (index < path23.length) {
char = path23[index];
} else if (char === "/") {
break;
} else {
char = "/";
}
if (char === "/") {
if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
if (res.length > 2) {
const lastSlashIndex = res.lastIndexOf("/");
if (lastSlashIndex === -1) {
res = "";
lastSegmentLength = 0;
} else {
res = res.slice(0, lastSlashIndex);
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
}
lastSlash = index;
dots = 0;
continue;
} else if (res.length > 0) {
res = "";
lastSegmentLength = 0;
lastSlash = index;
dots = 0;
continue;
}
}
if (allowAboveRoot) {
res += res.length > 0 ? "/.." : "..";
lastSegmentLength = 2;
}
} else {
if (res.length > 0) {
res += `/${path23.slice(lastSlash + 1, index)}`;
} else {
res = path23.slice(lastSlash + 1, index);
}
lastSegmentLength = index - lastSlash - 1;
}
lastSlash = index;
dots = 0;
} else if (char === "." && dots !== -1) {
++dots;
} else {
dots = -1;
}
}
return res;
}
var isAbsolute = function(p) {
return _IS_ABSOLUTE_RE.test(p);
};
var relative = function(from, to) {
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
return _to.join("/");
}
const _fromCopy = [..._from];
for (const segment of _fromCopy) {
if (_to[0] !== segment) {
break;
}
_from.shift();
_to.shift();
}
return [..._from.map(() => ".."), ..._to].join("/");
};
// src/utils/find-workspace-root.ts
init_cjs_shims();
var MAX_PATH_SEARCH_DEPTH = 30;
var depth = 0;
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
const _startPath = startPath ?? process.cwd();
if (endDirectoryNames.some(
(endDirName) => fs3.existsSync(path16.join(_startPath, endDirName))
)) {
return _startPath;
}
if (endFileNames.some((endFileName) => fs3.existsSync(path16.join(_startPath, endFileName)))) {
return _startPath;
}
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
const parent = path16.join(_startPath, "..");
return findFolderUp(parent, endFileNames, endDirectoryNames);
}
return void 0;
}
var rootFiles = [
"storm-workspace.json",
"storm-workspace.json",
"storm-workspace.yaml",
"storm-workspace.yml",
"storm-workspace.js",
"storm-workspace.ts",
".storm-workspace.json",
".storm-workspace.yaml",
".storm-workspace.yml",
".storm-workspace.js",
".storm-workspace.ts",
"lerna.json",
"nx.json",
"turbo.json",
"npm-workspace.json",
"yarn-workspace.json",
"pnpm-workspace.json",
"npm-workspace.yaml",
"yarn-workspace.yaml",
"pnpm-workspace.yaml",
"npm-workspace.yml",
"yarn-workspace.yml",
"pnpm-workspace.yml",
"npm-lock.json",
"yarn-lock.json",
"pnpm-lock.json",
"npm-lock.yaml",
"yarn-lock.yaml",
"pnpm-lock.yaml",
"npm-lock.yml",
"yarn-lock.yml",
"pnpm-lock.yml",
"bun.lockb"
];
var rootDirectories = [
".storm-workspace",
".nx",
".github",
".vscode",
".verdaccio"
];
function findWorkspaceRootSafe(pathInsideMonorepo) {
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
return correctPaths(
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
);
}
return correctPaths(
findFolderUp(
process.cwd(),
rootFiles,
rootDirectories
)
);
}
function findWorkspaceRoot(pathInsideMonorepo) {
const result = findWorkspaceRootSafe();
if (!result) {
throw new Error(
`Cannot find workspace root upwards from known path. Files search list includes:
${rootFiles.join(
"\n"
)}
Path: ${process.cwd()}`
);
}
return result;
}
// src/configs/cspell.ts
async function cspell(options = {}) {
const { configFile = "./.vscode/cspell.json", overrides = {} } = options;
return [
{
name: "storm/cspell/rules",
...cspellConfig__default.default,
rules: {
...cspellConfig__default.default.rules,
"@cspell/spellchecker": [
"warn",
{
configFile: joinPaths(findWorkspaceRoot(), configFile),
generateSuggestions: true,
numSuggestions: 10,
autoFix: true
}
],
...overrides
}
}
];
}
// src/configs/disables.ts
init_cjs_shims();
async function disables() {
return [
{
files: [`**/scripts/${GLOB_SRC}`],
name: "storm/disables/scripts",
rules: {
"no-console": "off",
"ts/explicit-function-return-type": "off"
}
},
{
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
name: "storm/disables/cli",
rules: {
"no-console": "off"
}
},
{
files: ["**/*.d.?([cm])ts"],
name: "storm/disables/dts",
rules: {
"eslint-comments/no-unlimited-disable": "off",
"import/no-duplicates": "off",
"no-restricted-syntax": "off",
"unused-imports/no-unused-vars": "off"
}
},
{
files: ["**/*.js", "**/*.cjs"],
name: "storm/disables/cjs",
rules: {
"ts/no-require-imports": "off"
}
},
{
files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
name: "storm/disables/config-files",
rules: {
"no-console": "off",
"ts/explicit-function-return-type": "off"
}
}
];
}
// src/configs/formatters.ts
init_cjs_shims();
// src/configs/stylistic.ts
init_cjs_shims();
var StylisticConfigDefaults = {
indent: 2,
jsx: true,
quotes: "double",
semi: true
};
async function stylistic(options = {}) {
const {
indent = 2,
jsx: jsx2 = true,
overrides = {},
quotes = "double",
semi = true,
lineEndings = "unix"
} = {
...StylisticConfigDefaults,
...options
};
const pluginStylistic = await interopDefault(
import('@stylistic/eslint-plugin')
);
const config3 = pluginStylistic.configs.customize({
indent,
jsx: jsx2,
pluginName: "style",
quotes,
semi
});
return [
{
name: "storm/stylistic/rules",
plugins: {
style: pluginStylistic
},
rules: {
...config3.rules,
"style/lines-around-comment": "off",
"style/linebreak-style": ["error", lineEndings],
"style/comma-dangle": ["error", "never"],
"style/comma-style": ["error", "last"],
"style/quotes": ["error", quotes],
"style/semi": ["error", semi ? "always" : "never"],
"style/indent": ["error", indent, { SwitchCase: 1 }],
"style/operator-linebreak": [
"error",
"after",
{ overrides: { "=": "none", "?": "before", ":": "before" } }
],
"style/jsx-indent": ["error", indent],
"style/jsx-quotes": [
"error",
quotes === "single" ? "prefer-single" : "prefer-double"
],
"style/brace-style": ["error", "1tbs", { allowSingleLine: false }],
...overrides
}
}
];
}
// src/configs/formatters.ts
function mergePrettierOptions(options, overrides = {}) {
return {
...options,
...overrides,
plugins: [...overrides.plugins || [], ...options.plugins || []]
};
}
async function formatters(options = {}, stylistic2 = {}) {
if (options === true) {
const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
options = {
astro: isPackageInScope("prettier-plugin-astro"),
css: true,
graphql: true,
html: true,
markdown: true,
svg: isPrettierPluginXmlInScope,
xml: isPrettierPluginXmlInScope
};
}
await ensurePackages([
"eslint-plugin-format",
options.astro ? "prettier-plugin-astro" : void 0,
options.xml || options.svg ? "@prettier/plugin-xml" : void 0
]);
const {
indent = 2,
quotes = "double",
semi = true
} = {
...StylisticConfigDefaults,
...stylistic2
};
const prettierOptions = defu__default.default(
{
proseWrap: "always",
quoteProps: "preserve",
bracketSameLine: true,
bracketSpacing: true,
arrowParens: "avoid",
endOfLine: "lf",
printWidth: 120,
semi,
singleQuote: quotes === "single",
tabWidth: typeof indent === "number" ? indent : 2,
trailingComma: "none",
useTabs: indent === "tab"
},
options.prettierOptions ?? {}
);
const prettierXmlOptions = {
xmlQuoteAttributes: "double",
xmlSelfClosingSpace: true,
xmlSortAttributesByKey: false,
xmlWhitespaceSensitivity: "ignore"
};
const dprintOptions = defu__default.default(
{
indentWidth: typeof indent === "number" ? indent : 2,
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
useTabs: indent === "tab"
},
options.dprintOptions ?? {}
);
const pluginFormat = await interopDefault(import('eslint-plugin-format'));
const configs4 = [
{
name: "storm/formatter/setup",
plugins: {
format: pluginFormat
}
}
];
if (options.css) {
configs4.push(
{
files: [GLOB_CSS, GLOB_POSTCSS],
languageOptions: {
parser: parserPlain
},
name: "storm/formatter/css",
rules: {
"format/prettier": [
"error",
mergePrettierOptions(prettierOptions, {
parser: "css"
})
]
}
},
{
files: [GLOB_SCSS],
languageOptions: {
parser: parserPlain
},
name: "storm/formatter/scss",
rules: {
"format/prettier": [
"error",
mergePrettierOptions(prettierOptions, {