@open-xchange/linter-presets 1.31.2 → 1.32.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.
- package/CHANGELOG.md +11 -1
- package/dist/stylelint/index.d.mts +5 -2
- package/dist/stylelint/index.d.mts.map +1 -1
- package/dist/stylelint/index.mjs +72 -21
- package/dist/stylelint/index.mjs.map +1 -1
- package/docs/stylelint/README.md +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [1.32.0] - 2026-11-06
|
|
6
|
+
|
|
7
|
+
- changed: require NodeJS v24.15
|
|
8
|
+
- changed: (StyleLint) require StyleLint 18 (peer dependency `stylelint` raised to `^18.0.0`, `postcss` to `^8.5.0`)
|
|
9
|
+
- changed: (StyleLint) `@stylistic/stylelint-plugin` 6 checks SCSS and Less files with copies of its rules in syntax namespaces (e.g. `@stylistic/scss/indentation`); the options `stylistic` and `rules` apply to all namespaces, but inline directives in SCSS and Less files need the namespaced rule names
|
|
10
|
+
- changed: (StyleLint) disable the new rules of `stylelint-config-recommended` 19 that report valid preprocessor syntax (`value-no-invalid` for SCSS; `selector-no-invalid`, `selector-no-unmatchable`, and `value-no-invalid` for Less)
|
|
11
|
+
- fixed: (StyleLint) replace rule `declaration-block-single-line-max-declarations` removed in StyleLint 18 with `@stylistic/declaration-block-single-line-max-declarations`
|
|
12
|
+
- fixed: (StyleLint) extend the base packages of `stylelint-config-standard-scss` and `stylelint-config-standard-less` with their rules, as these packages still extend `stylelint-config-standard` 40 which enables the removed rule
|
|
13
|
+
|
|
5
14
|
## [1.31.2] - 2026-11-04
|
|
6
15
|
|
|
7
16
|
- chore: drop dependency `empathic`
|
|
@@ -951,7 +960,8 @@
|
|
|
951
960
|
- added: (ESLint) project configuration (core, js, ts, json, yaml, license, directives, promises, jsdoc, stylistic)
|
|
952
961
|
- added: (ESLint) environment presets (tsconfig, node, browser, jest, vitest, codecept, react, plugin)
|
|
953
962
|
|
|
954
|
-
[Unreleased]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.
|
|
963
|
+
[Unreleased]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.32.0...main
|
|
964
|
+
[1.32.0]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.31.2...linter-presets-1.32.0
|
|
955
965
|
[1.31.2]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.31.1...linter-presets-1.31.2
|
|
956
966
|
[1.31.1]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.31.0...linter-presets-1.31.1
|
|
957
967
|
[1.31.0]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.30.7...linter-presets-1.31.0
|
|
@@ -71,8 +71,11 @@ export interface ProjectOptions {
|
|
|
71
71
|
vue?: VueOptions;
|
|
72
72
|
/**
|
|
73
73
|
* Additional linter rules to be added to the global configuration. Rule
|
|
74
|
-
* names starting with `scss/` or `less/`
|
|
75
|
-
*
|
|
74
|
+
* names starting with `scss/` or `less/` (also `@stylistic/scss/` or
|
|
75
|
+
* `@stylistic/less/`) will automatically be assigned to the respective
|
|
76
|
+
* language override configuration. Rules of the `@stylistic` plugin without
|
|
77
|
+
* syntax namespace (e.g. `@stylistic/indentation`) will be applied to SCSS
|
|
78
|
+
* and Less files too.
|
|
76
79
|
*/
|
|
77
80
|
rules?: RuleRecord;
|
|
78
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/stylelint/index.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/stylelint/index.ts"],"mappings":";;;;YAeY,aAAa,YAAY;;;;iBAOpB;;;;;;EAOf;;;;;;;EAQA;;;;;iBAQe;;;;;;EAOf;;;;;EAMA,QAAQ;;;;;iBAQO;;;;;EAMf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;EAKA,YAAY;;;;EAKZ,MAAM;;;;;;;;;EAUN,QAAQ;;;;;;;;;;;;;wBAmDM,aAAa,SAAS,iBAAiB"}
|
package/dist/stylelint/index.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { t as PathResolver } from "../resolver-COtuVv5w.mjs";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
+
import standardLessConfig from "stylelint-config-standard-less";
|
|
4
|
+
import standardScssConfig from "stylelint-config-standard-scss";
|
|
5
|
+
import { rules } from "@stylistic/stylelint-config";
|
|
3
6
|
import { readFile } from "node:fs/promises";
|
|
4
7
|
import stylelint from "stylelint";
|
|
5
8
|
// src/stylelint/rules/license-header.ts
|
|
@@ -97,6 +100,28 @@ function resolvePackage(name) {
|
|
|
97
100
|
return fileURLToPath(import.meta.resolve(name));
|
|
98
101
|
}
|
|
99
102
|
// src/stylelint/index.ts
|
|
103
|
+
const STYLISTIC_RULE_RE = /^@stylistic\/([^/]+)$/;
|
|
104
|
+
const SCSS_DISABLED_RULES = { "value-no-invalid": null };
|
|
105
|
+
const LESS_DISABLED_RULES = {
|
|
106
|
+
"selector-no-invalid": null,
|
|
107
|
+
"selector-no-unmatchable": null,
|
|
108
|
+
"value-no-invalid": null
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Adds a namespace prefix to the names of all passed rules.
|
|
112
|
+
*
|
|
113
|
+
* @param rules
|
|
114
|
+
* The rule settings to be prefixed.
|
|
115
|
+
*
|
|
116
|
+
* @param prefix
|
|
117
|
+
* The namespace prefix for all rule names, without trailing slash.
|
|
118
|
+
*
|
|
119
|
+
* @returns
|
|
120
|
+
* The rule settings with prefixed rule names.
|
|
121
|
+
*/
|
|
122
|
+
function prefixRules(rules, prefix) {
|
|
123
|
+
return Object.fromEntries(Object.entries(rules).map(([name, rule]) => [`${prefix}/${name}`, rule]));
|
|
124
|
+
}
|
|
100
125
|
/**
|
|
101
126
|
* Generates a StyleLint configuration object targeting the source files in the
|
|
102
127
|
* entire project.
|
|
@@ -124,14 +149,42 @@ function defineConfig(options) {
|
|
|
124
149
|
...options.stylistic
|
|
125
150
|
};
|
|
126
151
|
const resolver = new PathResolver(options.root);
|
|
152
|
+
const standardScss = [
|
|
153
|
+
resolvePackage("stylelint-config-recommended-scss"),
|
|
154
|
+
{ rules: standardScssConfig.rules },
|
|
155
|
+
{ rules: SCSS_DISABLED_RULES }
|
|
156
|
+
];
|
|
127
157
|
const extensions = {
|
|
128
158
|
base: [resolvePackage("stylelint-config-standard"), resolvePackage("@stylistic/stylelint-config")],
|
|
129
|
-
scss:
|
|
130
|
-
less: [
|
|
131
|
-
|
|
159
|
+
scss: standardScss,
|
|
160
|
+
less: [
|
|
161
|
+
resolvePackage("stylelint-config-recommended-less"),
|
|
162
|
+
{ rules: standardLessConfig.rules },
|
|
163
|
+
{ rules: LESS_DISABLED_RULES }
|
|
164
|
+
],
|
|
165
|
+
vue: options.vue?.lang === "scss" ? [
|
|
166
|
+
resolvePackage("stylelint-config-standard-vue"),
|
|
167
|
+
...standardScss,
|
|
168
|
+
resolvePackage("stylelint-config-recommended-vue/scss"),
|
|
169
|
+
{ rules: prefixRules(rules, "@stylistic/scss") }
|
|
170
|
+
] : [resolvePackage("stylelint-config-standard-vue")]
|
|
132
171
|
};
|
|
133
172
|
if (options.tailwind) extensions.base.push(resolvePackage("stylelint-config-tailwindcss"));
|
|
134
|
-
const
|
|
173
|
+
const stylisticRules = {
|
|
174
|
+
"declaration-block-single-line-max-declarations": null,
|
|
175
|
+
"declaration-colon-newline-after": null,
|
|
176
|
+
indentation: [stylistic.indent, { ignore: ["inside-parens"] }],
|
|
177
|
+
"max-line-length": null,
|
|
178
|
+
"no-empty-first-line": null,
|
|
179
|
+
"selector-list-comma-newline-after": null,
|
|
180
|
+
"string-quotes": stylistic.quotes === "off" ? null : [stylistic.quotes, { avoidEscape: true }]
|
|
181
|
+
};
|
|
182
|
+
const customRules = Object.entries(options.rules ?? {});
|
|
183
|
+
for (const [name, rule] of customRules) {
|
|
184
|
+
const match = STYLISTIC_RULE_RE.exec(name);
|
|
185
|
+
if (match) stylisticRules[match[1]] = rule;
|
|
186
|
+
}
|
|
187
|
+
const rules$1 = {
|
|
135
188
|
base: {
|
|
136
189
|
"at-rule-empty-line-before": null,
|
|
137
190
|
"color-function-notation": ["modern", { ignore: ["with-var-inside"] }],
|
|
@@ -139,7 +192,6 @@ function defineConfig(options) {
|
|
|
139
192
|
"comment-empty-line-before": null,
|
|
140
193
|
"custom-property-empty-line-before": null,
|
|
141
194
|
"declaration-block-no-redundant-longhand-properties": [true, { ignoreShorthands: ["inset"] }],
|
|
142
|
-
"declaration-block-single-line-max-declarations": null,
|
|
143
195
|
"declaration-empty-line-before": null,
|
|
144
196
|
"function-url-no-scheme-relative": true,
|
|
145
197
|
"function-url-scheme-allowed-list": ["data"],
|
|
@@ -148,39 +200,38 @@ function defineConfig(options) {
|
|
|
148
200
|
"no-unknown-animations": true,
|
|
149
201
|
"rule-empty-line-before": null,
|
|
150
202
|
"shorthand-property-no-redundant-values": [true, { ignore: ["four-into-three-edge-values"] }],
|
|
151
|
-
"@stylistic
|
|
152
|
-
"@stylistic/indentation": [stylistic.indent, { ignore: ["inside-parens"] }],
|
|
153
|
-
"@stylistic/max-line-length": null,
|
|
154
|
-
"@stylistic/no-empty-first-line": null,
|
|
155
|
-
"@stylistic/selector-list-comma-newline-after": null,
|
|
156
|
-
"@stylistic/string-quotes": stylistic.quotes === "off" ? null : [stylistic.quotes, { avoidEscape: true }]
|
|
203
|
+
...prefixRules(stylisticRules, "@stylistic")
|
|
157
204
|
},
|
|
158
205
|
scss: {
|
|
159
206
|
"scss/dollar-variable-empty-line-before": null,
|
|
160
|
-
"scss/double-slash-comment-empty-line-before": null
|
|
207
|
+
"scss/double-slash-comment-empty-line-before": null,
|
|
208
|
+
...prefixRules(stylisticRules, "@stylistic/scss")
|
|
161
209
|
},
|
|
162
|
-
less: {},
|
|
163
|
-
vue: {
|
|
210
|
+
less: { ...prefixRules(stylisticRules, "@stylistic/less") },
|
|
211
|
+
vue: {
|
|
212
|
+
...options.vue?.lang === "scss" ? prefixRules(stylisticRules, "@stylistic/scss") : void 0,
|
|
213
|
+
...options.vue?.rules
|
|
214
|
+
}
|
|
164
215
|
};
|
|
165
|
-
|
|
166
|
-
const key = name.split("/")[0];
|
|
167
|
-
(rules[key] ?? rules.base)[name] = rule;
|
|
216
|
+
for (const [name, rule] of customRules) if (!STYLISTIC_RULE_RE.test(name)) {
|
|
217
|
+
const key = name.replace(/^@stylistic\//, "").split("/")[0];
|
|
218
|
+
(rules$1[key] ?? rules$1.base)[name] = rule;
|
|
168
219
|
}
|
|
169
220
|
const overrides = [
|
|
170
221
|
{
|
|
171
222
|
files: ["**/*.scss"],
|
|
172
223
|
extends: extensions.scss,
|
|
173
|
-
rules: rules.scss
|
|
224
|
+
rules: rules$1.scss
|
|
174
225
|
},
|
|
175
226
|
{
|
|
176
227
|
files: ["**/*.less"],
|
|
177
228
|
extends: extensions.less,
|
|
178
|
-
rules: rules.less
|
|
229
|
+
rules: rules$1.less
|
|
179
230
|
},
|
|
180
231
|
{
|
|
181
232
|
files: ["**/*.vue"],
|
|
182
233
|
extends: extensions.vue,
|
|
183
|
-
rules: rules.vue
|
|
234
|
+
rules: rules$1.vue
|
|
184
235
|
}
|
|
185
236
|
];
|
|
186
237
|
if (options.license) overrides.push({
|
|
@@ -195,7 +246,7 @@ function defineConfig(options) {
|
|
|
195
246
|
reportNeedlessDisables: true,
|
|
196
247
|
reportUnscopedDisables: true,
|
|
197
248
|
extends: extensions.base,
|
|
198
|
-
rules: rules.base,
|
|
249
|
+
rules: rules$1.base,
|
|
199
250
|
overrides
|
|
200
251
|
};
|
|
201
252
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["licensePlugin"],"sources":["../../src/stylelint/rules/license-header.ts","../../src/stylelint/package-utils.ts","../../src/stylelint/index.ts"],"sourcesContent":["\nimport { readFile } from 'node:fs/promises'\nimport stylelint from 'stylelint'\n\nconst { createPlugin, utils: { ruleMessages, validateOptions, report } } = stylelint\n\n// types ======================================================================\n\ntype RuleMeta = stylelint.RuleMeta\ntype RuleFunction = stylelint.RuleBase<string, unknown>\n\n// constants ==================================================================\n\nconst ruleName = 'license-header/header'\n\nconst messages = ruleMessages(ruleName, {\n rejectedMissing: 'Missing license header',\n rejectedInvalid: 'Invalid license header',\n})\n\nconst meta: RuleMeta = {\n url: 'https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/blob/main/packages/linter-presets/docs/stylelint/README.md',\n fixable: true,\n}\n\n/**\n * Cache for the contents of license header files, keyed by file path.\n */\nconst promiseCache = new Map<string, Promise<string>>()\n\n// functions ==================================================================\n\n/**\n * Reads the license header file once per file path.\n *\n * @param path\n * The path to the license header file.\n *\n * @returns\n * A promise that will resolve with the contents of the license header file.\n */\nconst readLicenseHeaderOnce = async (path: string): Promise<string> => {\n let promise = promiseCache.get(path)\n if (!promise) {\n promise = readFile(path, 'utf-8')\n promiseCache.set(path, promise)\n }\n return await promise\n}\n\n/**\n * Implementation of the linter rule.\n *\n * @param primary\n * The path to the license header file.\n *\n * @returns\n * The callback function for the linter.\n */\nconst ruleFunc: RuleFunction = (primary) => async (root, result) => {\n\n // validate rule options\n if (!validateOptions(result, ruleName, {\n actual: primary,\n possible: path => (typeof path === 'string') && (path.length > 0),\n })) return\n\n // find the first comment in the linted file\n type Comment = Parameters<Parameters<typeof root.walkComments>[0]>[0]\n let comment: Comment | undefined\n root.walkComments(node => {\n if (node.parent === root) comment = node // must be a top-level comment\n return false // always stop iteration after first comment\n })\n\n // read the license header file\n const license = await readLicenseHeaderOnce(primary)\n\n // exit successfully if comment found and matches the license header file\n if (comment) {\n // strip block comment markers for comparison\n const stripped = license.trim().replace(/^\\/\\*|\\*\\/$/g, '').trim()\n if (comment.text === stripped) return\n }\n\n // report missing or mismatching comment\n report({\n ruleName,\n result,\n message: comment ? messages.rejectedInvalid : messages.rejectedMissing,\n node: comment ?? root,\n fix: () => { root.prepend(license) },\n })\n}\n\n// exports ====================================================================\n\nexport default createPlugin(ruleName, Object.assign(ruleFunc, { meta, ruleName, messages }))\n","import { fileURLToPath } from 'node:url'\n\n// functions ==================================================================\n\n/**\n * Resolves the name of an extension or plugin package to the absolute path of\n * its entry file, as seen from this package.\n *\n * StyleLint resolves package names in the options `extends` and `plugins`\n * relative to the configuration file of the consumer project. With the strict\n * `node_modules` layout of pnpm, the packages installed as dependencies of\n * this package are not visible from there. An absolute path circumvents this\n * resolution. StyleLint resolves nested `extends` entries of the referenced\n * package relative to that package's own location, so the transitive packages\n * do not need any special handling.\n *\n * @param name\n * The name of the package to be resolved, optionally with a subpath (e.g.\n * 'stylelint-config-standard-vue/scss').\n *\n * @returns\n * The absolute path of the entry file of the package.\n */\nexport function resolvePackage(name: string): string {\n return fileURLToPath(import.meta.resolve(name))\n}\n","\nimport type { Config } from 'stylelint'\n\nimport licensePlugin from '@/stylelint/rules/license-header.ts'\nimport { resolvePackage } from '@/stylelint/package-utils.ts'\nimport { PathResolver } from '@/utils/resolver.ts'\n\n// types ======================================================================\n\n/**\n * Configuration for multiple rules.\n */\nexport type RuleRecord = NonNullable<Config['rules']>\n\n// ----------------------------------------------------------------------------\n\n/**\n * Configuration options for StyleLint code style rules.\n */\nexport interface StylisticOptions {\n\n /**\n * Default indentation size (number of space characters).\n *\n * @default 2\n */\n indent?: number\n\n /**\n * The quote character for string literals, or 'off' to disable the quote\n * check.\n *\n * @default 'single'\n */\n quotes?: 'single' | 'double' | 'off'\n}\n\n// ----------------------------------------------------------------------------\n\n/**\n * Configuration options for linting vue files.\n */\nexport interface VueOptions {\n\n /**\n * The language variant of `stylelint-config-standard-vue` to be used.\n *\n * @default 'css'\n */\n lang?: 'css' | 'scss'\n\n /**\n * Additional linter rules for Vue source files to be added to the global\n * configuration.\n */\n rules?: RuleRecord\n}\n\n// ----------------------------------------------------------------------------\n\n/**\n * Configuration options for linting the entire project with StyleLint.\n */\nexport interface ProjectOptions {\n\n /**\n * The URL of the StyleLint configuration file in the project root. Should\n * usually be set to `import.meta.url`.\n */\n root: string\n\n /**\n * Glob patterns for all files to be ignored by StyleLint (the patterns must\n * match files, plain directory names are not supported).\n */\n ignores?: string[]\n\n /**\n * Path to the template file containing the license header to be used in all\n * linted stylesheet files. May be a path relative to the project root.\n */\n license?: string\n\n /**\n * Whether the project uses TailwindCSS. If set, the configuration package\n * `stylelint-config-tailwindcss` will be added.\n */\n tailwind?: boolean\n\n /**\n * Configuration options for code style.\n */\n stylistic?: StylisticOptions\n\n /**\n * Options for linting styles in Vue files.\n */\n vue?: VueOptions\n\n /**\n * Additional linter rules to be added to the global configuration. Rule\n * names starting with `scss/` or `less/` will automatically be assigned to\n * the respective language override configuration.\n */\n rules?: RuleRecord\n}\n\n// functions ==================================================================\n\n/**\n * Generates a StyleLint configuration object targeting the source files in the\n * entire project.\n *\n * @param options\n * Project configuration options.\n *\n * @returns\n * The configuration object to be exported from the project's configuration\n * file (e.g. `stylelint.config.ts`).\n */\nexport function defineConfig(options: ProjectOptions): Config {\n\n const ignoreFiles: string[] = [\n 'node_modules/**/*',\n 'dist/**/*',\n 'output/**/*',\n 'coverage/**/*', // Vitest\n '.nuxt/**/*', // NuxtJS\n '.output/**/*', // NuxtJS\n ...(options.ignores ?? []),\n ]\n\n // resolve stylistic configuration options\n const stylistic: StylisticOptions = {\n indent: 2,\n quotes: 'single',\n ...options.stylistic,\n }\n\n // the resolver for relative file paths\n const resolver = new PathResolver(options.root)\n\n // custom extensions, grouped by language type (resolved to absolute paths,\n // see function 'resolvePackage' for details)\n const extensions = {\n base: [\n resolvePackage('stylelint-config-standard'),\n resolvePackage('@stylistic/stylelint-config'),\n ],\n scss: [\n resolvePackage('stylelint-config-standard-scss'),\n ],\n less: [\n resolvePackage('stylelint-config-standard-less'),\n ],\n vue: [\n resolvePackage((options.vue?.lang === 'scss') ? 'stylelint-config-standard-vue/scss' : 'stylelint-config-standard-vue'),\n ],\n } satisfies Record<string, Config['extends']>\n\n // add TailwindCSS extension if specified\n if (options.tailwind) {\n extensions.base.push(resolvePackage('stylelint-config-tailwindcss'))\n }\n\n // custom rules, grouped by language type\n const rules: Record<string, RuleRecord> = {\n base: {\n 'at-rule-empty-line-before': null,\n 'color-function-notation': ['modern', { ignore: ['with-var-inside'] }],\n 'color-hex-length': null,\n 'comment-empty-line-before': null,\n 'custom-property-empty-line-before': null,\n 'declaration-block-no-redundant-longhand-properties': [true, { ignoreShorthands: ['inset'] }], // Safari does not support 'inset'\n 'declaration-block-single-line-max-declarations': null,\n 'declaration-empty-line-before': null,\n 'function-url-no-scheme-relative': true,\n 'function-url-scheme-allowed-list': ['data'],\n 'media-feature-range-notation': 'prefix', // Safari 16.3 does not work with this notation\n 'no-descending-specificity': null,\n 'no-unknown-animations': true,\n 'rule-empty-line-before': null,\n 'shorthand-property-no-redundant-values': [true, { ignore: ['four-into-three-edge-values'] }],\n // override rules of @stylistic plugin\n '@stylistic/declaration-colon-newline-after': null,\n '@stylistic/indentation': [stylistic.indent, { ignore: ['inside-parens'] }],\n '@stylistic/max-line-length': null,\n '@stylistic/no-empty-first-line': null,\n '@stylistic/selector-list-comma-newline-after': null,\n '@stylistic/string-quotes': (stylistic.quotes === 'off') ? null : [stylistic.quotes, { avoidEscape: true }],\n },\n scss: {\n 'scss/dollar-variable-empty-line-before': null,\n 'scss/double-slash-comment-empty-line-before': null,\n },\n less: {},\n vue: {\n ...options.vue?.rules,\n },\n }\n\n // distribute custom rules by language type\n if (options.rules) {\n for (const [name, rule] of Object.entries(options.rules)) {\n const key = name.split('/')[0];\n (rules[key] ?? rules.base)[name] = rule as unknown\n }\n }\n\n // custom overrides\n const overrides: Config['overrides'] = [{\n files: ['**/*.scss'],\n extends: extensions.scss,\n rules: rules.scss,\n }, {\n files: ['**/*.less'],\n extends: extensions.less,\n rules: rules.less,\n }, {\n files: ['**/*.vue'],\n extends: extensions.vue,\n rules: rules.vue,\n }]\n\n // license header plugin\n if (options.license) {\n overrides.push({\n files: ['**/*.{css,scss,less}'], // not for Vue files\n plugins: licensePlugin,\n rules: {\n 'license-header/header': resolver.path(options.license),\n },\n })\n }\n\n return {\n\n // ignore certain files and folders\n ignoreFiles,\n\n // check inline directives\n reportDescriptionlessDisables: null,\n reportInvalidScopeDisables: true,\n reportNeedlessDisables: true,\n reportUnscopedDisables: true,\n\n // add all extensions, rules, and overrides configured above\n extends: extensions.base,\n rules: rules.base,\n overrides,\n }\n}\n"],"mappings":";;;;;AAIA,MAAM,EAAE,cAAc,OAAO,EAAE,cAAc,iBAAiB,aAAa;AAS3E,MAAM,WAAW;AAEjB,MAAM,WAAW,aAAa,UAAU;CACtC,iBAAiB;CACjB,iBAAiB;AACnB,CAAC;AAED,MAAM,OAAiB;CACrB,KAAK;CACL,SAAS;AACX;;;;AAKA,MAAM,+BAAe,IAAI,IAA6B;;;;;;;;;;AAatD,MAAM,wBAAwB,OAAO,SAAkC;CACrE,IAAI,UAAU,aAAa,IAAI,IAAI;CACnC,IAAI,CAAC,SAAS;EACZ,UAAU,SAAS,MAAM,OAAO;EAChC,aAAa,IAAI,MAAM,OAAO;CAChC;CACA,OAAO,MAAM;AACf;;;;;;;;;;AAWA,MAAM,YAA0B,YAAY,OAAO,MAAM,WAAW;CAGlE,IAAI,CAAC,gBAAgB,QAAQ,UAAU;EACrC,QAAQ;EACR,WAAU,SAAS,OAAO,SAAS,YAAc,KAAK,SAAS;CACjE,CAAC,GAAG;CAIJ,IAAI;CACJ,KAAK,cAAa,SAAQ;EACxB,IAAI,KAAK,WAAW,MAAM,UAAU;EACpC,OAAO;CACT,CAAC;CAGD,MAAM,UAAU,MAAM,sBAAsB,OAAO;CAGnD,IAAI,SAAS;EAEX,MAAM,WAAW,QAAQ,KAAK,CAAC,CAAC,QAAQ,gBAAgB,EAAE,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6BAA6B;GAC7B,yBAAyB;GACzB,0BAA0B;GAC1B,0CAA0C,CAAC,MAAM,EAAE,QAAQ,CAAC,6BAA6B,EAAE,CAAC;GAE5F,8CAA8C;GAC9C,0BAA0B,CAAC,UAAU,QAAQ,EAAE,QAAQ,CAAC,eAAe,EAAE,CAAC;GAC1E,8BAA8B;GAC9B,kCAAkC;GAClC,gDAAgD;GAChD,4BAA6B,UAAU,WAAW,QAAS,OAAO,CAAC,UAAU,QAAQ,EAAE,aAAa,KAAK,CAAC;EAC5G;EACA,MAAM;GACJ,0CAA0C;GAC1C,+CAA+C;EACjD;EACA,MAAM,CAAC;EACP,KAAK,EACH,GAAG,QAAQ,KAAK,MAClB;CACF;CAGA,IAAI,QAAQ,OACV,KAAK,MAAM,CAAC,MAAM,SAAS,OAAO,QAAQ,QAAQ,KAAK,GAAG;EACxD,MAAM,MAAM,KAAK,MAAM,GAAG,CAAC,CAAC;EAC5B,CAAC,MAAM,QAAQ,MAAM,KAAA,CAAM,QAAQ;CACrC;CAIF,MAAM,YAAiC;EAAC;GACtC,OAAO,CAAC,WAAW;GACnB,SAAS,WAAW;GACpB,OAAO,MAAM;EACf;EAAG;GACD,OAAO,CAAC,WAAW;GACnB,SAAS,WAAW;GACpB,OAAO,MAAM;EACf;EAAG;GACD,OAAO,CAAC,UAAU;GAClB,SAAS,WAAW;GACpB,OAAO,MAAM;EACf;CAAC;CAGD,IAAI,QAAQ,SACV,UAAU,KAAK;EACb,OAAO,CAAC,sBAAsB;EAC9B,SAASA;EACT,OAAO,EACL,yBAAyB,SAAS,KAAK,QAAQ,OAAO,EACxD;CACF,CAAC;CAGH,OAAO;EAGL;EAGA,+BAA+B;EAC/B,4BAA4B;EAC5B,wBAAwB;EACxB,wBAAwB;EAGxB,SAAS,WAAW;EACpB,OAAO,MAAM;EACb;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["stylisticConfigRules","rules","licensePlugin"],"sources":["../../src/stylelint/rules/license-header.ts","../../src/stylelint/package-utils.ts","../../src/stylelint/index.ts"],"sourcesContent":["\nimport { readFile } from 'node:fs/promises'\nimport stylelint from 'stylelint'\n\nconst { createPlugin, utils: { ruleMessages, validateOptions, report } } = stylelint\n\n// types ======================================================================\n\ntype RuleMeta = stylelint.RuleMeta\ntype RuleFunction = stylelint.RuleBase<string, unknown>\n\n// constants ==================================================================\n\nconst ruleName = 'license-header/header'\n\nconst messages = ruleMessages(ruleName, {\n rejectedMissing: 'Missing license header',\n rejectedInvalid: 'Invalid license header',\n})\n\nconst meta: RuleMeta = {\n url: 'https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/blob/main/packages/linter-presets/docs/stylelint/README.md',\n fixable: true,\n}\n\n/**\n * Cache for the contents of license header files, keyed by file path.\n */\nconst promiseCache = new Map<string, Promise<string>>()\n\n// functions ==================================================================\n\n/**\n * Reads the license header file once per file path.\n *\n * @param path\n * The path to the license header file.\n *\n * @returns\n * A promise that will resolve with the contents of the license header file.\n */\nconst readLicenseHeaderOnce = async (path: string): Promise<string> => {\n let promise = promiseCache.get(path)\n if (!promise) {\n promise = readFile(path, 'utf-8')\n promiseCache.set(path, promise)\n }\n return await promise\n}\n\n/**\n * Implementation of the linter rule.\n *\n * @param primary\n * The path to the license header file.\n *\n * @returns\n * The callback function for the linter.\n */\nconst ruleFunc: RuleFunction = (primary) => async (root, result) => {\n\n // validate rule options\n if (!validateOptions(result, ruleName, {\n actual: primary,\n possible: path => (typeof path === 'string') && (path.length > 0),\n })) return\n\n // find the first comment in the linted file\n type Comment = Parameters<Parameters<typeof root.walkComments>[0]>[0]\n let comment: Comment | undefined\n root.walkComments(node => {\n if (node.parent === root) comment = node // must be a top-level comment\n return false // always stop iteration after first comment\n })\n\n // read the license header file\n const license = await readLicenseHeaderOnce(primary)\n\n // exit successfully if comment found and matches the license header file\n if (comment) {\n // strip block comment markers for comparison\n const stripped = license.trim().replace(/^\\/\\*|\\*\\/$/g, '').trim()\n if (comment.text === stripped) return\n }\n\n // report missing or mismatching comment\n report({\n ruleName,\n result,\n message: comment ? messages.rejectedInvalid : messages.rejectedMissing,\n node: comment ?? root,\n fix: () => { root.prepend(license) },\n })\n}\n\n// exports ====================================================================\n\nexport default createPlugin(ruleName, Object.assign(ruleFunc, { meta, ruleName, messages }))\n","import { fileURLToPath } from 'node:url'\n\n// functions ==================================================================\n\n/**\n * Resolves the name of an extension or plugin package to the absolute path of\n * its entry file, as seen from this package.\n *\n * StyleLint resolves package names in the options `extends` and `plugins`\n * relative to the configuration file of the consumer project. With the strict\n * `node_modules` layout of pnpm, the packages installed as dependencies of\n * this package are not visible from there. An absolute path circumvents this\n * resolution. StyleLint resolves nested `extends` entries of the referenced\n * package relative to that package's own location, so the transitive packages\n * do not need any special handling.\n *\n * @param name\n * The name of the package to be resolved, optionally with a subpath (e.g.\n * 'stylelint-config-standard-vue/scss').\n *\n * @returns\n * The absolute path of the entry file of the package.\n */\nexport function resolvePackage(name: string): string {\n return fileURLToPath(import.meta.resolve(name))\n}\n","\nimport type { Config } from 'stylelint'\nimport standardLessConfig from 'stylelint-config-standard-less'\nimport standardScssConfig from 'stylelint-config-standard-scss'\nimport { rules as stylisticConfigRules } from '@stylistic/stylelint-config'\n\nimport licensePlugin from '@/stylelint/rules/license-header.ts'\nimport { resolvePackage } from '@/stylelint/package-utils.ts'\nimport { PathResolver } from '@/utils/resolver.ts'\n\n// types ======================================================================\n\n/**\n * Configuration for multiple rules.\n */\nexport type RuleRecord = NonNullable<Config['rules']>\n\n// ----------------------------------------------------------------------------\n\n/**\n * Configuration options for StyleLint code style rules.\n */\nexport interface StylisticOptions {\n\n /**\n * Default indentation size (number of space characters).\n *\n * @default 2\n */\n indent?: number\n\n /**\n * The quote character for string literals, or 'off' to disable the quote\n * check.\n *\n * @default 'single'\n */\n quotes?: 'single' | 'double' | 'off'\n}\n\n// ----------------------------------------------------------------------------\n\n/**\n * Configuration options for linting vue files.\n */\nexport interface VueOptions {\n\n /**\n * The language variant of `stylelint-config-standard-vue` to be used.\n *\n * @default 'css'\n */\n lang?: 'css' | 'scss'\n\n /**\n * Additional linter rules for Vue source files to be added to the global\n * configuration.\n */\n rules?: RuleRecord\n}\n\n// ----------------------------------------------------------------------------\n\n/**\n * Configuration options for linting the entire project with StyleLint.\n */\nexport interface ProjectOptions {\n\n /**\n * The URL of the StyleLint configuration file in the project root. Should\n * usually be set to `import.meta.url`.\n */\n root: string\n\n /**\n * Glob patterns for all files to be ignored by StyleLint (the patterns must\n * match files, plain directory names are not supported).\n */\n ignores?: string[]\n\n /**\n * Path to the template file containing the license header to be used in all\n * linted stylesheet files. May be a path relative to the project root.\n */\n license?: string\n\n /**\n * Whether the project uses TailwindCSS. If set, the configuration package\n * `stylelint-config-tailwindcss` will be added.\n */\n tailwind?: boolean\n\n /**\n * Configuration options for code style.\n */\n stylistic?: StylisticOptions\n\n /**\n * Options for linting styles in Vue files.\n */\n vue?: VueOptions\n\n /**\n * Additional linter rules to be added to the global configuration. Rule\n * names starting with `scss/` or `less/` (also `@stylistic/scss/` or\n * `@stylistic/less/`) will automatically be assigned to the respective\n * language override configuration. Rules of the `@stylistic` plugin without\n * syntax namespace (e.g. `@stylistic/indentation`) will be applied to SCSS\n * and Less files too.\n */\n rules?: RuleRecord\n}\n\n// constants ==================================================================\n\n// matches names of @stylistic rules without syntax namespace, and captures the short rule name\nconst STYLISTIC_RULE_RE = /^@stylistic\\/([^/]+)$/\n\n// rules of `stylelint-config-recommended` that report valid SCSS syntax\nconst SCSS_DISABLED_RULES: RuleRecord = {\n 'value-no-invalid': null, // e.g. keyword arguments in `rgba($color: #000, $alpha: 50%)`\n}\n\n// rules of `stylelint-config-recommended` that report valid Less syntax\nconst LESS_DISABLED_RULES: RuleRecord = {\n 'selector-no-invalid': null, // mixin definitions with parameters\n 'selector-no-unmatchable': null, // parent selector `&` resolving to pseudo-elements\n 'value-no-invalid': null, // variables, operations, and functions of Less\n}\n\n// helpers ====================================================================\n\n/**\n * Adds a namespace prefix to the names of all passed rules.\n *\n * @param rules\n * The rule settings to be prefixed.\n *\n * @param prefix\n * The namespace prefix for all rule names, without trailing slash.\n *\n * @returns\n * The rule settings with prefixed rule names.\n */\nfunction prefixRules(rules: RuleRecord, prefix: string): RuleRecord {\n return Object.fromEntries(Object.entries(rules).map(([name, rule]) => [`${prefix}/${name}`, rule]))\n}\n\n// functions ==================================================================\n\n/**\n * Generates a StyleLint configuration object targeting the source files in the\n * entire project.\n *\n * @param options\n * Project configuration options.\n *\n * @returns\n * The configuration object to be exported from the project's configuration\n * file (e.g. `stylelint.config.ts`).\n */\nexport function defineConfig(options: ProjectOptions): Config {\n\n const ignoreFiles: string[] = [\n 'node_modules/**/*',\n 'dist/**/*',\n 'output/**/*',\n 'coverage/**/*', // Vitest\n '.nuxt/**/*', // NuxtJS\n '.output/**/*', // NuxtJS\n ...(options.ignores ?? []),\n ]\n\n // resolve stylistic configuration options\n const stylistic: StylisticOptions = {\n indent: 2,\n quotes: 'single',\n ...options.stylistic,\n }\n\n // the resolver for relative file paths\n const resolver = new PathResolver(options.root)\n\n // The packages 'stylelint-config-standard-scss' and '-less' extend version 40\n // of 'stylelint-config-standard' which enables a rule removed in StyleLint 18\n // (reported as unknown rule in every file). Until they support StyleLint 18,\n // extend their base packages and add their own rules only, the package\n // 'stylelint-config-standard' is already extended for all languages.\n // TODO: extend the packages directly when they support StyleLint 18\n const standardScss = [\n resolvePackage('stylelint-config-recommended-scss'),\n { rules: standardScssConfig.rules },\n { rules: SCSS_DISABLED_RULES },\n ]\n\n // custom extensions, grouped by language type (packages resolved to absolute\n // paths, see function 'resolvePackage' for details)\n const extensions = {\n base: [\n resolvePackage('stylelint-config-standard'),\n resolvePackage('@stylistic/stylelint-config'),\n ],\n scss: standardScss,\n less: [\n resolvePackage('stylelint-config-recommended-less'),\n { rules: standardLessConfig.rules },\n { rules: LESS_DISABLED_RULES },\n ],\n vue: (options.vue?.lang === 'scss') ? [\n // replaces 'stylelint-config-standard-vue/scss' which extends 'stylelint-config-standard-scss'\n // (package 'stylelint-config-recommended-vue/scss' must follow to restore the syntax 'postcss-html')\n resolvePackage('stylelint-config-standard-vue'),\n ...standardScss,\n resolvePackage('stylelint-config-recommended-vue/scss'),\n // '@stylistic/stylelint-config' sets the SCSS namespace for `*.scss` files only\n { rules: prefixRules(stylisticConfigRules, '@stylistic/scss') },\n ] : [\n resolvePackage('stylelint-config-standard-vue'),\n ],\n } satisfies Record<string, Config['extends']>\n\n // add TailwindCSS extension if specified\n if (options.tailwind) {\n extensions.base.push(resolvePackage('stylelint-config-tailwindcss'))\n }\n\n // overrides for rules of the @stylistic plugin, by short rule name\n const stylisticRules: RuleRecord = {\n 'declaration-block-single-line-max-declarations': null,\n 'declaration-colon-newline-after': null,\n indentation: [stylistic.indent, { ignore: ['inside-parens'] }],\n 'max-line-length': null,\n 'no-empty-first-line': null,\n 'selector-list-comma-newline-after': null,\n 'string-quotes': (stylistic.quotes === 'off') ? null : [stylistic.quotes, { avoidEscape: true }],\n }\n\n // custom rules of the @stylistic plugin without syntax namespace apply to all languages\n const customRules = Object.entries(options.rules ?? {})\n for (const [name, rule] of customRules) {\n const match = STYLISTIC_RULE_RE.exec(name)\n if (match) { stylisticRules[match[1]] = rule as unknown }\n }\n\n // custom rules, grouped by language type (the @stylistic plugin checks SCSS\n // and Less files with copies of its rules in syntax namespaces, e.g.\n // '@stylistic/scss/indentation', the overrides must be set for all of them)\n const rules: Record<string, RuleRecord> = {\n base: {\n 'at-rule-empty-line-before': null,\n 'color-function-notation': ['modern', { ignore: ['with-var-inside'] }],\n 'color-hex-length': null,\n 'comment-empty-line-before': null,\n 'custom-property-empty-line-before': null,\n 'declaration-block-no-redundant-longhand-properties': [true, { ignoreShorthands: ['inset'] }], // Safari does not support 'inset'\n 'declaration-empty-line-before': null,\n 'function-url-no-scheme-relative': true,\n 'function-url-scheme-allowed-list': ['data'],\n 'media-feature-range-notation': 'prefix', // Safari 16.3 does not work with this notation\n 'no-descending-specificity': null,\n 'no-unknown-animations': true,\n 'rule-empty-line-before': null,\n 'shorthand-property-no-redundant-values': [true, { ignore: ['four-into-three-edge-values'] }],\n ...prefixRules(stylisticRules, '@stylistic'),\n },\n scss: {\n 'scss/dollar-variable-empty-line-before': null,\n 'scss/double-slash-comment-empty-line-before': null,\n ...prefixRules(stylisticRules, '@stylistic/scss'),\n },\n less: {\n ...prefixRules(stylisticRules, '@stylistic/less'),\n },\n vue: {\n ...((options.vue?.lang === 'scss') ? prefixRules(stylisticRules, '@stylistic/scss') : undefined),\n ...options.vue?.rules,\n },\n }\n\n // distribute the other custom rules by language type (namespace of the rule\n // name, e.g. 'scss/' or '@stylistic/scss/')\n for (const [name, rule] of customRules) {\n if (!STYLISTIC_RULE_RE.test(name)) {\n const key = name.replace(/^@stylistic\\//, '').split('/')[0];\n (rules[key] ?? rules.base)[name] = rule as unknown\n }\n }\n\n // custom overrides\n const overrides: Config['overrides'] = [{\n files: ['**/*.scss'],\n extends: extensions.scss,\n rules: rules.scss,\n }, {\n files: ['**/*.less'],\n extends: extensions.less,\n rules: rules.less,\n }, {\n files: ['**/*.vue'],\n extends: extensions.vue,\n rules: rules.vue,\n }]\n\n // license header plugin\n if (options.license) {\n overrides.push({\n files: ['**/*.{css,scss,less}'], // not for Vue files\n plugins: licensePlugin,\n rules: {\n 'license-header/header': resolver.path(options.license),\n },\n })\n }\n\n return {\n\n // ignore certain files and folders\n ignoreFiles,\n\n // check inline directives\n reportDescriptionlessDisables: null,\n reportInvalidScopeDisables: true,\n reportNeedlessDisables: true,\n reportUnscopedDisables: true,\n\n // add all extensions, rules, and overrides configured above\n extends: extensions.base,\n rules: rules.base,\n overrides,\n }\n}\n"],"mappings":";;;;;;;;AAIA,MAAM,EAAE,cAAc,OAAO,EAAE,cAAc,iBAAiB,aAAa;AAS3E,MAAM,WAAW;AAEjB,MAAM,WAAW,aAAa,UAAU;CACtC,iBAAiB;CACjB,iBAAiB;AACnB,CAAC;AAED,MAAM,OAAiB;CACrB,KAAK;CACL,SAAS;AACX;;;;AAKA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AAQ,SACV,UAAU,KAAK;EACb,OAAO,CAAC,sBAAsB;EAC9B,SAASC;EACT,OAAO,EACL,yBAAyB,SAAS,KAAK,QAAQ,OAAO,EACxD;CACF,CAAC;CAGH,OAAO;EAGL;EAGA,+BAA+B;EAC/B,4BAA4B;EAC5B,wBAAwB;EACxB,wBAAwB;EAGxB,SAAS,WAAW;EACpB,OAAOD,QAAM;EACb;CACF;AACF"}
|
package/docs/stylelint/README.md
CHANGED
|
@@ -39,7 +39,7 @@ function defineConfig(options: ProjectOptions): Config
|
|
|
39
39
|
| `vue` | `VueOptions` | | Configuration options for linting `<style>` elements in Vue single component files. |
|
|
40
40
|
| `vue.lang` | `'css'\|'scss'` | `'css'` | The style language used in the Vue files. |
|
|
41
41
|
| `vue.rules` | `RuleRecord` | `{}` | Additional linter rules for Vue files. |
|
|
42
|
-
| `rules` | `RuleRecord` | `{}` | Additional linter rules to be added to the global configuration. Rule names starting with `scss/` or `less/` will automatically be assigned to the respective language override configuration. |
|
|
42
|
+
| `rules` | `RuleRecord` | `{}` | Additional linter rules to be added to the global configuration. Rule names starting with `scss/` or `less/` (also `@stylistic/scss/` or `@stylistic/less/`) will automatically be assigned to the respective language override configuration. Rules of the `@stylistic` plugin without syntax namespace (e.g. `@stylistic/indentation`) will be applied to SCSS and Less files too. |
|
|
43
43
|
|
|
44
44
|
#### Built-in Ignore Globs
|
|
45
45
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-xchange/linter-presets",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
4
4
|
"description": "Configuration presets for ESLint and StyleLint",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=
|
|
12
|
+
"node": "^24.15.0 || >=26.0.0"
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"CHANGELOG.*"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/core": "^8.0
|
|
29
|
+
"@babel/core": "^8.1.0",
|
|
30
30
|
"@babel/eslint-parser": "^8.0.7",
|
|
31
31
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.8.1",
|
|
32
32
|
"@eslint-react/eslint-plugin": "^5.28.8",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@eslint/markdown": "^8.0.3",
|
|
39
39
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
40
40
|
"@stylistic/eslint-plugin-migrate": "^4.4.1",
|
|
41
|
-
"@stylistic/stylelint-config": "^
|
|
42
|
-
"@stylistic/stylelint-plugin": "^
|
|
41
|
+
"@stylistic/stylelint-config": "^6.0.0",
|
|
42
|
+
"@stylistic/stylelint-plugin": "^6.0.0",
|
|
43
43
|
"@types/json-schema": "^7.0.15",
|
|
44
44
|
"@types/picomatch": "^4.0.3",
|
|
45
45
|
"@vitest/eslint-plugin": "^1.6.28",
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"picomatch": "^4.0.7",
|
|
70
70
|
"postcss-html": "^2.0.0",
|
|
71
71
|
"stylelint-config-html": "^2.0.0",
|
|
72
|
-
"stylelint-config-recommended": "^
|
|
72
|
+
"stylelint-config-recommended": "^19.0.0",
|
|
73
73
|
"stylelint-config-recommended-less": "^4.2.1",
|
|
74
74
|
"stylelint-config-recommended-scss": "^17.0.1",
|
|
75
75
|
"stylelint-config-recommended-vue": "^2.0.0",
|
|
76
|
-
"stylelint-config-standard": "^
|
|
76
|
+
"stylelint-config-standard": "^41.0.0",
|
|
77
77
|
"stylelint-config-standard-less": "^4.1.0",
|
|
78
78
|
"stylelint-config-standard-scss": "^17.0.0",
|
|
79
79
|
"stylelint-config-standard-vue": "^2.0.0",
|
|
@@ -90,13 +90,13 @@
|
|
|
90
90
|
"@typescript-eslint/utils": "^8.72.1",
|
|
91
91
|
"eslint": "^10.14.0",
|
|
92
92
|
"jest": "^30.5.2",
|
|
93
|
-
"stylelint": "^
|
|
94
|
-
"vitest": "^5.0
|
|
93
|
+
"stylelint": "^18.0.0",
|
|
94
|
+
"vitest": "^5.1.0"
|
|
95
95
|
},
|
|
96
96
|
"peerDependencies": {
|
|
97
97
|
"eslint": "^9.35.0 || ^10.0.0",
|
|
98
|
-
"postcss": "^8.
|
|
99
|
-
"stylelint": "^
|
|
98
|
+
"postcss": "^8.5.0",
|
|
99
|
+
"stylelint": "^18.0.0",
|
|
100
100
|
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0"
|
|
101
101
|
},
|
|
102
102
|
"peerDependenciesMeta": {
|