@culur/config-stylelint 1.7.1 → 1.7.2
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 +17 -0
- package/dist/factory-B33e_UAZ.mjs.map +1 -1
- package/dist/factory-BNS_YTTh.cjs.map +1 -1
- package/dist/factory.d.cts +0 -1
- package/dist/factory.d.mts +0 -1
- package/dist/shareable-configs/auto.cjs.map +1 -1
- package/dist/shareable-configs/none.cjs.map +1 -1
- package/dist/shareable-configs/sass-vue.cjs.map +1 -1
- package/dist/shareable-configs/sass.cjs.map +1 -1
- package/dist/shareable-configs/tailwind3-sass-vue.cjs.map +1 -1
- package/dist/shareable-configs/tailwind3-sass.cjs.map +1 -1
- package/dist/shareable-configs/tailwind3.cjs.map +1 -1
- package/dist/shareable-configs/tailwind4-vue.cjs.map +1 -1
- package/dist/shareable-configs/tailwind4.cjs.map +1 -1
- package/dist/shareable-configs/vue.cjs.map +1 -1
- package/package.json +6 -6
- package/src/utils/utils.ts +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @culur/config-stylelint
|
|
2
2
|
|
|
3
|
+
## 1.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ⚙️ Update dependencies ([`fec7e09`](https://github.com/culur/culur/commit/fec7e098fcd063b1d4d2d81d36d9a2acc0cb5073)) ([@renovate](https://github.com/apps/renovate)):
|
|
8
|
+
|
|
9
|
+
- `dependencies`:
|
|
10
|
+
- `stylelint-scss@^7.2.0`
|
|
11
|
+
- `devDependencies`:
|
|
12
|
+
- `postcss@^8.5.23`
|
|
13
|
+
- `stylelint@^17.14.1`
|
|
14
|
+
|
|
15
|
+
- 📦 Format code ([#525](https://github.com/culur/culur/pull/525) [`509e8ce`](https://github.com/culur/culur/commit/509e8ce660d7a765ce9cd0c32aad71b1c1a5fe8e)) ([@renovate](https://github.com/apps/renovate)).
|
|
16
|
+
|
|
17
|
+
- 📦 Update workspace dependencies:
|
|
18
|
+
- [`@culur/utils-packages@1.3.1`](https://github.com/culur/culur/tree/main/packages/utils-packages#readme)
|
|
19
|
+
|
|
3
20
|
## 1.7.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory-B33e_UAZ.mjs","names":[],"sources":["../src/utils/utils.ts","../src/rules/at-rule-no-unknown.ts","../src/rules/declaration-block-no-redundant-longhand-properties.ts","../src/rules/function-no-unknown.ts","../src/rules/import-notation.ts","../src/rules/order.ts","../src/rules/selector-pseudo-class-no-unknown.ts","../src/configs/css.ts","../src/rules/dollar-variable-pattern.ts","../src/configs/scss.ts","../src/configs/shared.ts","../src/configs/vue.ts","../src/factory.ts"],"sourcesContent":["import type { Config, ConfigRuleSettings } from 'stylelint';\n\n// import type Primary, Secondary from stylelint\n\ntype StringOrRegex = string | RegExp;\ntype OneOrMany<S> = S | S[];\n\nexport type Primary =\n | number\n | true\n | OneOrMany<StringOrRegex>\n | Record<string, any>;\nexport type Secondary = Record<string, any>;\n\nexport const defineRule = <\n PrimaryOption extends Primary,\n SecondaryOptions extends Secondary = object,\n>(\n rule: ConfigRuleSettings<PrimaryOption, SecondaryOptions>,\n) => rule;\n\nexport const defineRules = <TRules extends Config['rules']>(rule: TRules) =>\n rule;\n\n// clone function mergeConfigs from stylelint repository\nexport const mergeConfigs = (\n ...configsOrNull: (Config | undefined | null | false)[]\n) => {\n const configs = configsOrNull.filter((c): c is Config => !!c);\n\n return {\n plugins: [...new Set(configs.flatMap(c => c.plugins ?? []))],\n overrides: [...new Set(configs.flatMap(c => c.overrides ?? []))],\n extends: configs\n .flatMap(c => c.extends ?? [])\n .filter((item, index, arr) => arr.lastIndexOf(item) === index),\n rules: configs.reduce(\n (acc, config) => ({ ...acc, ...config.rules }),\n {} as Config['rules'],\n ),\n ...configs.reduce(\n (\n acc,\n { plugins: _p, overrides: _o, extends: _e, rules: _r, ...config },\n ) => ({ ...acc, ...config }),\n {} as Config,\n ),\n };\n};\n\nexport const isInRange = (\n version: false | number | undefined,\n ...versions: number[]\n) => typeof version === 'number' && versions.includes(version);\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules } from '~/utils';\n\nconst getIgnoreAtRulesByTailwindVersion = (\n tailwindVersion: false | number | undefined,\n) => {\n switch (tailwindVersion) {\n // https://tailwindcss-v0.netlify.app//docs/functions-and-directives\n case 0:\n return [\n // Directives\n 'tailwind',\n 'apply',\n\n 'variants',\n 'responsive',\n 'screen',\n ];\n\n // https://v1.tailwindcss.com/docs/functions-and-directives\n // https://v2.tailwindcss.com/docs/functions-and-directives\n case 1:\n case 2:\n return [\n // Directives\n 'tailwind',\n 'apply',\n 'layer', // new\n\n 'variants',\n 'responsive',\n 'screen',\n ];\n\n // https://v3.tailwindcss.com/docs/functions-and-directives\n case 3:\n return [\n // Directives\n 'tailwind',\n 'layer',\n 'apply',\n 'config', // new\n ];\n\n // https://tailwindcss.com/docs/functions-and-directives\n case 4:\n return [\n // Directives\n 'import',\n 'theme',\n 'source',\n 'utility',\n 'variant',\n 'custom-variant',\n 'apply',\n 'reference',\n\n // Compatibility\n 'config',\n 'plugin',\n ];\n\n default:\n return [];\n }\n};\n\nexport const atRuleNoUnknownRule = (packages: Partial<Packages>) =>\n defineRule<true, { ignoreAtRules: (string | RegExp)[] }>([\n true,\n { ignoreAtRules: getIgnoreAtRulesByTailwindVersion(packages.tailwind) },\n ]);\n\nexport const atRuleNoUnknownCSS = (packages: Partial<Packages>) =>\n defineRules({\n 'at-rule-no-unknown': atRuleNoUnknownRule(packages),\n });\n\nexport const atRuleNoUnknownSCSS = (packages: Partial<Packages>) =>\n defineRules({\n 'at-rule-no-unknown': null,\n 'scss/at-rule-no-unknown': atRuleNoUnknownRule(packages),\n });\n","import { defineRule, defineRules } from '~/utils';\n\nexport const declarationBlockNoRedundantLonghandPropertiesRule = defineRule<\n true,\n { ignoreShorthands?: (string | RegExp)[] }\n>([true, { ignoreShorthands: ['grid-template'] }]);\n\nexport const declarationBlockNoRedundantLonghandProperties = defineRules({\n 'declaration-block-no-redundant-longhand-properties':\n declarationBlockNoRedundantLonghandPropertiesRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules } from '~/utils';\n\nconst getIgnoreFunctionsByTailwindVersion = (\n tailwindVersion: false | number | undefined,\n) => {\n switch (tailwindVersion) {\n // https://tailwindcss-v0.netlify.app//docs/functions-and-directives\n case 0:\n return ['config'];\n\n // https://v1.tailwindcss.com/docs/functions-and-directives\n case 1:\n return ['theme'];\n\n // https://v2.tailwindcss.com/docs/functions-and-directives\n case 2:\n return ['screen', 'theme'];\n\n // https://v3.tailwindcss.com/docs/functions-and-directives\n case 3:\n return ['theme', 'screen'];\n\n // https://tailwindcss.com/docs/functions-and-directives\n case 4:\n return ['--alpha', '--spacing', 'theme'];\n\n default:\n return [];\n }\n};\n\nconst sassFunctionRegex = /^(list|math|color)\\..+/;\nconst getIgnoreFunctions = (packages: Partial<Packages>) => [\n // https://tailwindcss.com\n ...getIgnoreFunctionsByTailwindVersion(packages.tailwind),\n\n // https://sass-lang.com/documentation/modules/list\n // https://sass-lang.com/documentation/modules/math\n // https://sass-lang.com/documentation/modules/color\n ...(packages.sass //\n ? [sassFunctionRegex]\n : []),\n\n // https://vuejs.org/api/sfc-css-features.html#v-bind-in-css\n ...(packages.vue //\n ? ['v-bind']\n : []),\n];\n\nexport function functionNoUnknownRule(packages: Partial<Packages>) {\n return defineRule<true, { ignoreFunctions: (string | RegExp)[] }>([\n true,\n { ignoreFunctions: getIgnoreFunctions(packages) },\n ]);\n}\n\nexport const functionNoUnknown = (packages: Partial<Packages>) =>\n defineRules({\n 'function-no-unknown': functionNoUnknownRule(packages),\n });\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRules, isInRange } from '~/utils';\n\nexport const importNotationCSS = (packages: Partial<Packages>) =>\n defineRules(\n isInRange(packages.tailwind, 4) //\n ? { 'import-notation': null }\n : {},\n );\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules, isInRange } from '~/utils';\n\n// https://github.com/hudochenkov/stylelint-order/blob/master/rules/order/README.md#options\n\ntype Keyword =\n | 'custom-properties' /**/ // Custom properties (e.g. --property: 10px;)\n | 'dollar-variables' /***/ // Dollar variables (e.g. $variable)\n | 'at-variables' /*******/ // At-variables (e.g. @variable available in Less syntax)\n | 'declarations' /*******/ // CSS declarations (e.g. display: block)\n | 'rules' /**************/ // Nested rules (e.g. a { span {} })\n | 'at-rules' /***********/ // Nested at-rules (e.g. div { @media () {} })\n | 'less-mixins'; /*******/ // Mixins in Less syntax (e.g. .mixin();)\n\ninterface AtRule {\n type: 'at-rule';\n name?: string;\n parameter?: string | RegExp;\n hasBlock?: boolean;\n}\n\ninterface Rule {\n type: 'rule';\n selector?: string | RegExp;\n name?: string;\n}\n\ntype PrimaryOption = Array<Keyword | AtRule | Rule>;\ninterface SecondaryOptions {\n unspecified?: 'top' | 'bottom' | 'ignore';\n}\n\nconst definePrimaryOption = (...options: (PrimaryOption[number] | false | undefined)[]) =>\n options.filter((option): option is PrimaryOption[number] => !!option);\n\nconst blockRuleRegex = /^&::[\\w-]+/;\n\nexport const orderRule = (packages: Partial<Packages>) =>\n defineRule<PrimaryOption, SecondaryOptions>([\n definePrimaryOption(\n //! import\n packages.sass /**********************************/ && { type: 'at-rule', name: 'use' }, // scss: @use 'path/path';\n packages.sass /**********************************/ && { type: 'at-rule', name: 'forward' }, // scss: @forward 'path/path';\n packages.sass /**********************************/ && { type: 'at-rule', name: 'import' }, // scss: @import 'path/path';\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'import' }, // tailwind 4: @import \"tailwindcss\";\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'source' }, // tailwind 4: @source \"../node_modules/@culur/ui-lib\";\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'reference' }, // tailwind 4: @reference \"../../app.css\";\n\n //! root\n isInRange(packages.tailwind, 0, 1, 2, 3) /*******/ && { type: 'at-rule', name: 'tailwind' }, // tailwind 0,1,2,3 : @tailwind base;\n isInRange(packages.tailwind, 3, 4) /*************/ && { type: 'at-rule', name: 'config' }, // tailwind 3,4: @config 'tailwind.custom.config.js'\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'plugin' }, // tailwind 4: @plugin '@tailwindcss/typography'\n isInRange(packages.tailwind, 1, 2, 3) /**********/ && { type: 'at-rule', name: 'layer' }, // tailwind 1,2,3 : @layer base {}\n\n //! variables\n 'dollar-variables', // css: $variable: 10px;\n 'at-variables', // css: @variable: 10px;\n { type: 'at-rule', hasBlock: false }, // css: @variable: 10px;\n 'custom-properties', // css: --property: 10px;\n\n //! tailwind\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'theme' }, // tailwind 4: @theme {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'custom-variant' }, // tailwind 4: @custom-variant pointer-coarse (@media (pointer: coarse));\n\n //! functions, methods\n packages.sass /**********************************/ && { type: 'at-rule', name: 'function' }, // scss: @function sum() {}\n packages.sass /**********************************/ && { type: 'at-rule', name: 'mixin' }, // scss: @mixin mixin-name {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'utility' }, // tailwind 4: @utility tab-4 { tab-size: 4; }\n\n //! declarations\n packages.sass /**********************************/ && { type: 'at-rule', name: 'extend' }, // scss: @extend .class-name;\n packages.sass /**********************************/ && { type: 'at-rule', name: 'include' }, // scss: @include mixin-name;\n isInRange(packages.tailwind, 0, 1, 2, 3, 4) /****/ && { type: 'at-rule', name: 'apply' }, // tailwind 0,1,2,3,4: @apply p-3;\n 'less-mixins', // less: .mixin();\n 'declarations', // css: display: block;\n\n //! block rules\n { type: 'rule', selector: blockRuleRegex }, // css: &::after {}\n 'rules', // css: child-component {}\n\n //! blocks nested\n packages.sass && { type: 'at-rule', name: 'at-root' }, // scss: @at-root selector { /* content */ }\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'responsive' }, // tailwind 0,1,2 : @responsive {}\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'variants' }, // tailwind 0,1,2 : @variants hover {}\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'screen' }, // tailwind 0,1,2 : @screen sm {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'variants' }, // tailwind 4: @variant dark {}\n { type: 'at-rule', hasBlock: true }, // css: @media () {}\n ),\n {\n unspecified: 'bottom',\n },\n ]);\n\nexport const order = (packages: Partial<Packages>) =>\n defineRules({\n 'order/order': orderRule(packages),\n });\n","import { defineRule, defineRules } from '~/utils';\n\nexport const selectorPseudoClassNoUnknownRule = defineRule<\n true,\n { ignorePseudoClasses?: (string | RegExp)[] }\n>([true, { ignorePseudoClasses: ['global', 'local'] }]);\n\nexport const selectorPseudoClassNoUnknown = defineRules({\n 'selector-pseudo-class-no-unknown': selectorPseudoClassNoUnknownRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { atRuleNoUnknownCSS } from '~/rules/at-rule-no-unknown';\nimport { declarationBlockNoRedundantLonghandProperties } from '~/rules/declaration-block-no-redundant-longhand-properties';\nimport { functionNoUnknown } from '~/rules/function-no-unknown';\nimport { importNotationCSS } from '~/rules/import-notation';\nimport { order } from '~/rules/order';\nimport { selectorPseudoClassNoUnknown } from '~/rules/selector-pseudo-class-no-unknown';\n\nexport const configCss = (packages: Partial<Packages>): Config => ({\n extends: ['stylelint-config-standard', 'stylelint-config-clean-order'],\n plugins: ['stylelint-order', 'stylelint-selector-bem-pattern'],\n rules: {\n ...atRuleNoUnknownCSS(packages),\n ...declarationBlockNoRedundantLonghandProperties,\n ...functionNoUnknown(packages),\n ...importNotationCSS(packages),\n ...order(packages),\n ...selectorPseudoClassNoUnknown,\n 'declaration-empty-line-before': null,\n },\n});\n","import { defineRule, defineRules } from '~/utils';\n\ntype PrimaryOption = string;\ninterface SecondaryOptions {\n message: string;\n}\n\nexport const dollarVariablePatternRule = defineRule<\n PrimaryOption,\n SecondaryOptions\n>([\n '^(-{0,2}?[a-z][a-z0-9]*)(-[a-z0-9]+)*$',\n { message: 'Expected variable to be kebab-case' },\n]);\n\nexport const dollarVariablePatternSCSS = defineRules({\n 'scss/dollar-variable-pattern': dollarVariablePatternRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { atRuleNoUnknownSCSS } from '~/rules/at-rule-no-unknown';\nimport { dollarVariablePatternSCSS } from '~/rules/dollar-variable-pattern';\n\nexport const configScss = (packages: Partial<Packages>): Config => ({\n extends: ['stylelint-config-standard-scss'],\n rules: {\n ...atRuleNoUnknownSCSS(packages),\n ...dollarVariablePatternSCSS,\n },\n});\n","import type { Config } from 'stylelint';\n\nexport const configShared = (): Config => ({\n extends: ['stylelint-config-html'],\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\n\nexport const configVue = (packages: Partial<Packages>): Config => ({\n extends: [\n packages.sass\n ? 'stylelint-config-standard-vue/scss'\n : 'stylelint-config-standard-vue',\n ],\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { configCss } from './configs/css';\nimport { configScss } from './configs/scss';\nimport { configShared } from './configs/shared';\nimport { configVue } from './configs/vue';\nimport { mergeConfigs } from './utils';\n\nexport default function defineConfig(\n packages?: Partial<Packages>,\n config?: Config,\n): Config {\n const packages_ = packages ?? {};\n\n return mergeConfigs(\n configShared(),\n configCss(packages_),\n packages_.sass && configScss(packages_),\n packages_.vue && configVue(packages_),\n config,\n );\n}\n"],"mappings":";AAcA,MAAa,cAIX,SACG;AAEL,MAAa,eAA+C,SAC1D;AAGF,MAAa,gBACX,GAAG,kBACA;CACH,MAAM,UAAU,cAAc,QAAQ,MAAmB,CAAC,CAAC,CA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ACF;AACF"}
|
|
1
|
+
{"version":3,"file":"factory-B33e_UAZ.mjs","names":[],"sources":["../src/utils/utils.ts","../src/rules/at-rule-no-unknown.ts","../src/rules/declaration-block-no-redundant-longhand-properties.ts","../src/rules/function-no-unknown.ts","../src/rules/import-notation.ts","../src/rules/order.ts","../src/rules/selector-pseudo-class-no-unknown.ts","../src/configs/css.ts","../src/rules/dollar-variable-pattern.ts","../src/configs/scss.ts","../src/configs/shared.ts","../src/configs/vue.ts","../src/factory.ts"],"sourcesContent":["import type { Config, ConfigRuleSettings } from 'stylelint';\n\n// import type Primary, Secondary from stylelint\n\ntype StringOrRegex = string | RegExp;\ntype OneOrMany<S> = S | S[];\n\nexport type Primary =\n number | true | OneOrMany<StringOrRegex> | Record<string, any>;\nexport type Secondary = Record<string, any>;\n\nexport const defineRule = <\n PrimaryOption extends Primary,\n SecondaryOptions extends Secondary = object,\n>(\n rule: ConfigRuleSettings<PrimaryOption, SecondaryOptions>,\n) => rule;\n\nexport const defineRules = <TRules extends Config['rules']>(rule: TRules) =>\n rule;\n\n// clone function mergeConfigs from stylelint repository\nexport const mergeConfigs = (\n ...configsOrNull: (Config | undefined | null | false)[]\n) => {\n const configs = configsOrNull.filter((c): c is Config => !!c);\n\n return {\n plugins: [...new Set(configs.flatMap(c => c.plugins ?? []))],\n overrides: [...new Set(configs.flatMap(c => c.overrides ?? []))],\n extends: configs\n .flatMap(c => c.extends ?? [])\n .filter((item, index, arr) => arr.lastIndexOf(item) === index),\n rules: configs.reduce(\n (acc, config) => ({ ...acc, ...config.rules }),\n {} as Config['rules'],\n ),\n ...configs.reduce(\n (\n acc,\n { plugins: _p, overrides: _o, extends: _e, rules: _r, ...config },\n ) => ({ ...acc, ...config }),\n {} as Config,\n ),\n };\n};\n\nexport const isInRange = (\n version: false | number | undefined,\n ...versions: number[]\n) => typeof version === 'number' && versions.includes(version);\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules } from '~/utils';\n\nconst getIgnoreAtRulesByTailwindVersion = (\n tailwindVersion: false | number | undefined,\n) => {\n switch (tailwindVersion) {\n // https://tailwindcss-v0.netlify.app//docs/functions-and-directives\n case 0:\n return [\n // Directives\n 'tailwind',\n 'apply',\n\n 'variants',\n 'responsive',\n 'screen',\n ];\n\n // https://v1.tailwindcss.com/docs/functions-and-directives\n // https://v2.tailwindcss.com/docs/functions-and-directives\n case 1:\n case 2:\n return [\n // Directives\n 'tailwind',\n 'apply',\n 'layer', // new\n\n 'variants',\n 'responsive',\n 'screen',\n ];\n\n // https://v3.tailwindcss.com/docs/functions-and-directives\n case 3:\n return [\n // Directives\n 'tailwind',\n 'layer',\n 'apply',\n 'config', // new\n ];\n\n // https://tailwindcss.com/docs/functions-and-directives\n case 4:\n return [\n // Directives\n 'import',\n 'theme',\n 'source',\n 'utility',\n 'variant',\n 'custom-variant',\n 'apply',\n 'reference',\n\n // Compatibility\n 'config',\n 'plugin',\n ];\n\n default:\n return [];\n }\n};\n\nexport const atRuleNoUnknownRule = (packages: Partial<Packages>) =>\n defineRule<true, { ignoreAtRules: (string | RegExp)[] }>([\n true,\n { ignoreAtRules: getIgnoreAtRulesByTailwindVersion(packages.tailwind) },\n ]);\n\nexport const atRuleNoUnknownCSS = (packages: Partial<Packages>) =>\n defineRules({\n 'at-rule-no-unknown': atRuleNoUnknownRule(packages),\n });\n\nexport const atRuleNoUnknownSCSS = (packages: Partial<Packages>) =>\n defineRules({\n 'at-rule-no-unknown': null,\n 'scss/at-rule-no-unknown': atRuleNoUnknownRule(packages),\n });\n","import { defineRule, defineRules } from '~/utils';\n\nexport const declarationBlockNoRedundantLonghandPropertiesRule = defineRule<\n true,\n { ignoreShorthands?: (string | RegExp)[] }\n>([true, { ignoreShorthands: ['grid-template'] }]);\n\nexport const declarationBlockNoRedundantLonghandProperties = defineRules({\n 'declaration-block-no-redundant-longhand-properties':\n declarationBlockNoRedundantLonghandPropertiesRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules } from '~/utils';\n\nconst getIgnoreFunctionsByTailwindVersion = (\n tailwindVersion: false | number | undefined,\n) => {\n switch (tailwindVersion) {\n // https://tailwindcss-v0.netlify.app//docs/functions-and-directives\n case 0:\n return ['config'];\n\n // https://v1.tailwindcss.com/docs/functions-and-directives\n case 1:\n return ['theme'];\n\n // https://v2.tailwindcss.com/docs/functions-and-directives\n case 2:\n return ['screen', 'theme'];\n\n // https://v3.tailwindcss.com/docs/functions-and-directives\n case 3:\n return ['theme', 'screen'];\n\n // https://tailwindcss.com/docs/functions-and-directives\n case 4:\n return ['--alpha', '--spacing', 'theme'];\n\n default:\n return [];\n }\n};\n\nconst sassFunctionRegex = /^(list|math|color)\\..+/;\nconst getIgnoreFunctions = (packages: Partial<Packages>) => [\n // https://tailwindcss.com\n ...getIgnoreFunctionsByTailwindVersion(packages.tailwind),\n\n // https://sass-lang.com/documentation/modules/list\n // https://sass-lang.com/documentation/modules/math\n // https://sass-lang.com/documentation/modules/color\n ...(packages.sass //\n ? [sassFunctionRegex]\n : []),\n\n // https://vuejs.org/api/sfc-css-features.html#v-bind-in-css\n ...(packages.vue //\n ? ['v-bind']\n : []),\n];\n\nexport function functionNoUnknownRule(packages: Partial<Packages>) {\n return defineRule<true, { ignoreFunctions: (string | RegExp)[] }>([\n true,\n { ignoreFunctions: getIgnoreFunctions(packages) },\n ]);\n}\n\nexport const functionNoUnknown = (packages: Partial<Packages>) =>\n defineRules({\n 'function-no-unknown': functionNoUnknownRule(packages),\n });\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRules, isInRange } from '~/utils';\n\nexport const importNotationCSS = (packages: Partial<Packages>) =>\n defineRules(\n isInRange(packages.tailwind, 4) //\n ? { 'import-notation': null }\n : {},\n );\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules, isInRange } from '~/utils';\n\n// https://github.com/hudochenkov/stylelint-order/blob/master/rules/order/README.md#options\n\ntype Keyword =\n | 'custom-properties' /**/ // Custom properties (e.g. --property: 10px;)\n | 'dollar-variables' /***/ // Dollar variables (e.g. $variable)\n | 'at-variables' /*******/ // At-variables (e.g. @variable available in Less syntax)\n | 'declarations' /*******/ // CSS declarations (e.g. display: block)\n | 'rules' /**************/ // Nested rules (e.g. a { span {} })\n | 'at-rules' /***********/ // Nested at-rules (e.g. div { @media () {} })\n | 'less-mixins'; /*******/ // Mixins in Less syntax (e.g. .mixin();)\n\ninterface AtRule {\n type: 'at-rule';\n name?: string;\n parameter?: string | RegExp;\n hasBlock?: boolean;\n}\n\ninterface Rule {\n type: 'rule';\n selector?: string | RegExp;\n name?: string;\n}\n\ntype PrimaryOption = Array<Keyword | AtRule | Rule>;\ninterface SecondaryOptions {\n unspecified?: 'top' | 'bottom' | 'ignore';\n}\n\nconst definePrimaryOption = (...options: (PrimaryOption[number] | false | undefined)[]) =>\n options.filter((option): option is PrimaryOption[number] => !!option);\n\nconst blockRuleRegex = /^&::[\\w-]+/;\n\nexport const orderRule = (packages: Partial<Packages>) =>\n defineRule<PrimaryOption, SecondaryOptions>([\n definePrimaryOption(\n //! import\n packages.sass /**********************************/ && { type: 'at-rule', name: 'use' }, // scss: @use 'path/path';\n packages.sass /**********************************/ && { type: 'at-rule', name: 'forward' }, // scss: @forward 'path/path';\n packages.sass /**********************************/ && { type: 'at-rule', name: 'import' }, // scss: @import 'path/path';\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'import' }, // tailwind 4: @import \"tailwindcss\";\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'source' }, // tailwind 4: @source \"../node_modules/@culur/ui-lib\";\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'reference' }, // tailwind 4: @reference \"../../app.css\";\n\n //! root\n isInRange(packages.tailwind, 0, 1, 2, 3) /*******/ && { type: 'at-rule', name: 'tailwind' }, // tailwind 0,1,2,3 : @tailwind base;\n isInRange(packages.tailwind, 3, 4) /*************/ && { type: 'at-rule', name: 'config' }, // tailwind 3,4: @config 'tailwind.custom.config.js'\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'plugin' }, // tailwind 4: @plugin '@tailwindcss/typography'\n isInRange(packages.tailwind, 1, 2, 3) /**********/ && { type: 'at-rule', name: 'layer' }, // tailwind 1,2,3 : @layer base {}\n\n //! variables\n 'dollar-variables', // css: $variable: 10px;\n 'at-variables', // css: @variable: 10px;\n { type: 'at-rule', hasBlock: false }, // css: @variable: 10px;\n 'custom-properties', // css: --property: 10px;\n\n //! tailwind\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'theme' }, // tailwind 4: @theme {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'custom-variant' }, // tailwind 4: @custom-variant pointer-coarse (@media (pointer: coarse));\n\n //! functions, methods\n packages.sass /**********************************/ && { type: 'at-rule', name: 'function' }, // scss: @function sum() {}\n packages.sass /**********************************/ && { type: 'at-rule', name: 'mixin' }, // scss: @mixin mixin-name {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'utility' }, // tailwind 4: @utility tab-4 { tab-size: 4; }\n\n //! declarations\n packages.sass /**********************************/ && { type: 'at-rule', name: 'extend' }, // scss: @extend .class-name;\n packages.sass /**********************************/ && { type: 'at-rule', name: 'include' }, // scss: @include mixin-name;\n isInRange(packages.tailwind, 0, 1, 2, 3, 4) /****/ && { type: 'at-rule', name: 'apply' }, // tailwind 0,1,2,3,4: @apply p-3;\n 'less-mixins', // less: .mixin();\n 'declarations', // css: display: block;\n\n //! block rules\n { type: 'rule', selector: blockRuleRegex }, // css: &::after {}\n 'rules', // css: child-component {}\n\n //! blocks nested\n packages.sass && { type: 'at-rule', name: 'at-root' }, // scss: @at-root selector { /* content */ }\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'responsive' }, // tailwind 0,1,2 : @responsive {}\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'variants' }, // tailwind 0,1,2 : @variants hover {}\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'screen' }, // tailwind 0,1,2 : @screen sm {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'variants' }, // tailwind 4: @variant dark {}\n { type: 'at-rule', hasBlock: true }, // css: @media () {}\n ),\n {\n unspecified: 'bottom',\n },\n ]);\n\nexport const order = (packages: Partial<Packages>) =>\n defineRules({\n 'order/order': orderRule(packages),\n });\n","import { defineRule, defineRules } from '~/utils';\n\nexport const selectorPseudoClassNoUnknownRule = defineRule<\n true,\n { ignorePseudoClasses?: (string | RegExp)[] }\n>([true, { ignorePseudoClasses: ['global', 'local'] }]);\n\nexport const selectorPseudoClassNoUnknown = defineRules({\n 'selector-pseudo-class-no-unknown': selectorPseudoClassNoUnknownRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { atRuleNoUnknownCSS } from '~/rules/at-rule-no-unknown';\nimport { declarationBlockNoRedundantLonghandProperties } from '~/rules/declaration-block-no-redundant-longhand-properties';\nimport { functionNoUnknown } from '~/rules/function-no-unknown';\nimport { importNotationCSS } from '~/rules/import-notation';\nimport { order } from '~/rules/order';\nimport { selectorPseudoClassNoUnknown } from '~/rules/selector-pseudo-class-no-unknown';\n\nexport const configCss = (packages: Partial<Packages>): Config => ({\n extends: ['stylelint-config-standard', 'stylelint-config-clean-order'],\n plugins: ['stylelint-order', 'stylelint-selector-bem-pattern'],\n rules: {\n ...atRuleNoUnknownCSS(packages),\n ...declarationBlockNoRedundantLonghandProperties,\n ...functionNoUnknown(packages),\n ...importNotationCSS(packages),\n ...order(packages),\n ...selectorPseudoClassNoUnknown,\n 'declaration-empty-line-before': null,\n },\n});\n","import { defineRule, defineRules } from '~/utils';\n\ntype PrimaryOption = string;\ninterface SecondaryOptions {\n message: string;\n}\n\nexport const dollarVariablePatternRule = defineRule<\n PrimaryOption,\n SecondaryOptions\n>([\n '^(-{0,2}?[a-z][a-z0-9]*)(-[a-z0-9]+)*$',\n { message: 'Expected variable to be kebab-case' },\n]);\n\nexport const dollarVariablePatternSCSS = defineRules({\n 'scss/dollar-variable-pattern': dollarVariablePatternRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { atRuleNoUnknownSCSS } from '~/rules/at-rule-no-unknown';\nimport { dollarVariablePatternSCSS } from '~/rules/dollar-variable-pattern';\n\nexport const configScss = (packages: Partial<Packages>): Config => ({\n extends: ['stylelint-config-standard-scss'],\n rules: {\n ...atRuleNoUnknownSCSS(packages),\n ...dollarVariablePatternSCSS,\n },\n});\n","import type { Config } from 'stylelint';\n\nexport const configShared = (): Config => ({\n extends: ['stylelint-config-html'],\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\n\nexport const configVue = (packages: Partial<Packages>): Config => ({\n extends: [\n packages.sass\n ? 'stylelint-config-standard-vue/scss'\n : 'stylelint-config-standard-vue',\n ],\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { configCss } from './configs/css';\nimport { configScss } from './configs/scss';\nimport { configShared } from './configs/shared';\nimport { configVue } from './configs/vue';\nimport { mergeConfigs } from './utils';\n\nexport default function defineConfig(\n packages?: Partial<Packages>,\n config?: Config,\n): Config {\n const packages_ = packages ?? {};\n\n return mergeConfigs(\n configShared(),\n configCss(packages_),\n packages_.sass && configScss(packages_),\n packages_.vue && configVue(packages_),\n config,\n );\n}\n"],"mappings":";AAWA,MAAa,cAIX,SACG;AAEL,MAAa,eAA+C,SAC1D;AAGF,MAAa,gBACX,GAAG,kBACA;CACH,MAAM,UAAU,cAAc,QAAQ,MAAmB,CAAC,CAAC,CAAC;CAE5D,OAAO;EACL,SAAS,CAAC,GAAG,IAAI,IAAI,QAAQ,SAAQ,MAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;EAC3D,WAAW,CAAC,GAAG,IAAI,IAAI,QAAQ,SAAQ,MAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CA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E,MAAM;EAAW,UAAU;CAAK;AACpC,GACA,EACE,aAAa,SACf,CACF,CAAC;AAEH,MAAa,SAAS,aACpB,YAAY,EACV,eAAe,UAAU,QAAQ,EACnC,CAAC;ACzFH,MAAa,+BAA+B,YAAY,EACtD,oCAN8C,WAG9C,CAAC,MAAM,EAAE,qBAAqB,CAAC,UAAU,OAAO,EAAE,CAAC,CAGf,EACtC,CAAC;;;ACAD,MAAa,aAAa,cAAyC;CACjE,SAAS,CAAC,6BAA6B,8BAA8B;CACrE,SAAS,CAAC,mBAAmB,gCAAgC;CAC7D,OAAO;EACL,GAAG,mBAAmB,QAAQ;EAC9B,GAAG;EACH,GAAG,kBAAkB,QAAQ;EAC7B,GAAG,kBAAkB,QAAQ;EAC7B,GAAG,MAAM,QAAQ;EACjB,GAAG;EACH,iCAAiC;CACnC;AACF;ACNA,MAAa,4BAA4B,YAAY,EACnD,gCATuC,WAGvC,CACA,0CACA,EAAE,SAAS,qCAAqC,CAClD,CAGkC,EAClC,CAAC;;;ACZD,MAAa,cAAc,cAAyC;CAClE,SAAS,CAAC,gCAAgC;CAC1C,OAAO;EACL,GAAG,oBAAoB,QAAQ;EAC/B,GAAG;CACL;AACF;;;ACTA,MAAa,sBAA8B,EACzC,SAAS,CAAC,uBAAuB,EACnC;;;ACDA,MAAa,aAAa,cAAyC,EACjE,SAAS,CACP,SAAS,OACL,uCACA,+BACN,EACF;;;ACDA,SAAwB,aACtB,UACA,QACQ;CACR,MAAM,YAAY,YAAY,CAAC;CAE/B,OAAO,aACL,aAAa,GACb,UAAU,SAAS,GACnB,UAAU,QAAQ,WAAW,SAAS,GACtC,UAAU,OAAO,UAAU,SAAS,GACpC,MACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory-BNS_YTTh.cjs","names":[],"sources":["../src/utils/utils.ts","../src/rules/at-rule-no-unknown.ts","../src/rules/declaration-block-no-redundant-longhand-properties.ts","../src/rules/function-no-unknown.ts","../src/rules/import-notation.ts","../src/rules/order.ts","../src/rules/selector-pseudo-class-no-unknown.ts","../src/configs/css.ts","../src/rules/dollar-variable-pattern.ts","../src/configs/scss.ts","../src/configs/shared.ts","../src/configs/vue.ts","../src/factory.ts"],"sourcesContent":["import type { Config, ConfigRuleSettings } from 'stylelint';\n\n// import type Primary, Secondary from stylelint\n\ntype StringOrRegex = string | RegExp;\ntype OneOrMany<S> = S | S[];\n\nexport type Primary =\n | number\n | true\n | OneOrMany<StringOrRegex>\n | Record<string, any>;\nexport type Secondary = Record<string, any>;\n\nexport const defineRule = <\n PrimaryOption extends Primary,\n SecondaryOptions extends Secondary = object,\n>(\n rule: ConfigRuleSettings<PrimaryOption, SecondaryOptions>,\n) => rule;\n\nexport const defineRules = <TRules extends Config['rules']>(rule: TRules) =>\n rule;\n\n// clone function mergeConfigs from stylelint repository\nexport const mergeConfigs = (\n ...configsOrNull: (Config | undefined | null | false)[]\n) => {\n const configs = configsOrNull.filter((c): c is Config => !!c);\n\n return {\n plugins: [...new Set(configs.flatMap(c => c.plugins ?? []))],\n overrides: [...new Set(configs.flatMap(c => c.overrides ?? []))],\n extends: configs\n .flatMap(c => c.extends ?? [])\n .filter((item, index, arr) => arr.lastIndexOf(item) === index),\n rules: configs.reduce(\n (acc, config) => ({ ...acc, ...config.rules }),\n {} as Config['rules'],\n ),\n ...configs.reduce(\n (\n acc,\n { plugins: _p, overrides: _o, extends: _e, rules: _r, ...config },\n ) => ({ ...acc, ...config }),\n {} as Config,\n ),\n };\n};\n\nexport const isInRange = (\n version: false | number | undefined,\n ...versions: number[]\n) => typeof version === 'number' && versions.includes(version);\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules } from '~/utils';\n\nconst getIgnoreAtRulesByTailwindVersion = (\n tailwindVersion: false | number | undefined,\n) => {\n switch (tailwindVersion) {\n // https://tailwindcss-v0.netlify.app//docs/functions-and-directives\n case 0:\n return [\n // Directives\n 'tailwind',\n 'apply',\n\n 'variants',\n 'responsive',\n 'screen',\n ];\n\n // https://v1.tailwindcss.com/docs/functions-and-directives\n // https://v2.tailwindcss.com/docs/functions-and-directives\n case 1:\n case 2:\n return [\n // Directives\n 'tailwind',\n 'apply',\n 'layer', // new\n\n 'variants',\n 'responsive',\n 'screen',\n ];\n\n // https://v3.tailwindcss.com/docs/functions-and-directives\n case 3:\n return [\n // Directives\n 'tailwind',\n 'layer',\n 'apply',\n 'config', // new\n ];\n\n // https://tailwindcss.com/docs/functions-and-directives\n case 4:\n return [\n // Directives\n 'import',\n 'theme',\n 'source',\n 'utility',\n 'variant',\n 'custom-variant',\n 'apply',\n 'reference',\n\n // Compatibility\n 'config',\n 'plugin',\n ];\n\n default:\n return [];\n }\n};\n\nexport const atRuleNoUnknownRule = (packages: Partial<Packages>) =>\n defineRule<true, { ignoreAtRules: (string | RegExp)[] }>([\n true,\n { ignoreAtRules: getIgnoreAtRulesByTailwindVersion(packages.tailwind) },\n ]);\n\nexport const atRuleNoUnknownCSS = (packages: Partial<Packages>) =>\n defineRules({\n 'at-rule-no-unknown': atRuleNoUnknownRule(packages),\n });\n\nexport const atRuleNoUnknownSCSS = (packages: Partial<Packages>) =>\n defineRules({\n 'at-rule-no-unknown': null,\n 'scss/at-rule-no-unknown': atRuleNoUnknownRule(packages),\n });\n","import { defineRule, defineRules } from '~/utils';\n\nexport const declarationBlockNoRedundantLonghandPropertiesRule = defineRule<\n true,\n { ignoreShorthands?: (string | RegExp)[] }\n>([true, { ignoreShorthands: ['grid-template'] }]);\n\nexport const declarationBlockNoRedundantLonghandProperties = defineRules({\n 'declaration-block-no-redundant-longhand-properties':\n declarationBlockNoRedundantLonghandPropertiesRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules } from '~/utils';\n\nconst getIgnoreFunctionsByTailwindVersion = (\n tailwindVersion: false | number | undefined,\n) => {\n switch (tailwindVersion) {\n // https://tailwindcss-v0.netlify.app//docs/functions-and-directives\n case 0:\n return ['config'];\n\n // https://v1.tailwindcss.com/docs/functions-and-directives\n case 1:\n return ['theme'];\n\n // https://v2.tailwindcss.com/docs/functions-and-directives\n case 2:\n return ['screen', 'theme'];\n\n // https://v3.tailwindcss.com/docs/functions-and-directives\n case 3:\n return ['theme', 'screen'];\n\n // https://tailwindcss.com/docs/functions-and-directives\n case 4:\n return ['--alpha', '--spacing', 'theme'];\n\n default:\n return [];\n }\n};\n\nconst sassFunctionRegex = /^(list|math|color)\\..+/;\nconst getIgnoreFunctions = (packages: Partial<Packages>) => [\n // https://tailwindcss.com\n ...getIgnoreFunctionsByTailwindVersion(packages.tailwind),\n\n // https://sass-lang.com/documentation/modules/list\n // https://sass-lang.com/documentation/modules/math\n // https://sass-lang.com/documentation/modules/color\n ...(packages.sass //\n ? [sassFunctionRegex]\n : []),\n\n // https://vuejs.org/api/sfc-css-features.html#v-bind-in-css\n ...(packages.vue //\n ? ['v-bind']\n : []),\n];\n\nexport function functionNoUnknownRule(packages: Partial<Packages>) {\n return defineRule<true, { ignoreFunctions: (string | RegExp)[] }>([\n true,\n { ignoreFunctions: getIgnoreFunctions(packages) },\n ]);\n}\n\nexport const functionNoUnknown = (packages: Partial<Packages>) =>\n defineRules({\n 'function-no-unknown': functionNoUnknownRule(packages),\n });\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRules, isInRange } from '~/utils';\n\nexport const importNotationCSS = (packages: Partial<Packages>) =>\n defineRules(\n isInRange(packages.tailwind, 4) //\n ? { 'import-notation': null }\n : {},\n );\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules, isInRange } from '~/utils';\n\n// https://github.com/hudochenkov/stylelint-order/blob/master/rules/order/README.md#options\n\ntype Keyword =\n | 'custom-properties' /**/ // Custom properties (e.g. --property: 10px;)\n | 'dollar-variables' /***/ // Dollar variables (e.g. $variable)\n | 'at-variables' /*******/ // At-variables (e.g. @variable available in Less syntax)\n | 'declarations' /*******/ // CSS declarations (e.g. display: block)\n | 'rules' /**************/ // Nested rules (e.g. a { span {} })\n | 'at-rules' /***********/ // Nested at-rules (e.g. div { @media () {} })\n | 'less-mixins'; /*******/ // Mixins in Less syntax (e.g. .mixin();)\n\ninterface AtRule {\n type: 'at-rule';\n name?: string;\n parameter?: string | RegExp;\n hasBlock?: boolean;\n}\n\ninterface Rule {\n type: 'rule';\n selector?: string | RegExp;\n name?: string;\n}\n\ntype PrimaryOption = Array<Keyword | AtRule | Rule>;\ninterface SecondaryOptions {\n unspecified?: 'top' | 'bottom' | 'ignore';\n}\n\nconst definePrimaryOption = (...options: (PrimaryOption[number] | false | undefined)[]) =>\n options.filter((option): option is PrimaryOption[number] => !!option);\n\nconst blockRuleRegex = /^&::[\\w-]+/;\n\nexport const orderRule = (packages: Partial<Packages>) =>\n defineRule<PrimaryOption, SecondaryOptions>([\n definePrimaryOption(\n //! import\n packages.sass /**********************************/ && { type: 'at-rule', name: 'use' }, // scss: @use 'path/path';\n packages.sass /**********************************/ && { type: 'at-rule', name: 'forward' }, // scss: @forward 'path/path';\n packages.sass /**********************************/ && { type: 'at-rule', name: 'import' }, // scss: @import 'path/path';\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'import' }, // tailwind 4: @import \"tailwindcss\";\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'source' }, // tailwind 4: @source \"../node_modules/@culur/ui-lib\";\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'reference' }, // tailwind 4: @reference \"../../app.css\";\n\n //! root\n isInRange(packages.tailwind, 0, 1, 2, 3) /*******/ && { type: 'at-rule', name: 'tailwind' }, // tailwind 0,1,2,3 : @tailwind base;\n isInRange(packages.tailwind, 3, 4) /*************/ && { type: 'at-rule', name: 'config' }, // tailwind 3,4: @config 'tailwind.custom.config.js'\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'plugin' }, // tailwind 4: @plugin '@tailwindcss/typography'\n isInRange(packages.tailwind, 1, 2, 3) /**********/ && { type: 'at-rule', name: 'layer' }, // tailwind 1,2,3 : @layer base {}\n\n //! variables\n 'dollar-variables', // css: $variable: 10px;\n 'at-variables', // css: @variable: 10px;\n { type: 'at-rule', hasBlock: false }, // css: @variable: 10px;\n 'custom-properties', // css: --property: 10px;\n\n //! tailwind\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'theme' }, // tailwind 4: @theme {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'custom-variant' }, // tailwind 4: @custom-variant pointer-coarse (@media (pointer: coarse));\n\n //! functions, methods\n packages.sass /**********************************/ && { type: 'at-rule', name: 'function' }, // scss: @function sum() {}\n packages.sass /**********************************/ && { type: 'at-rule', name: 'mixin' }, // scss: @mixin mixin-name {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'utility' }, // tailwind 4: @utility tab-4 { tab-size: 4; }\n\n //! declarations\n packages.sass /**********************************/ && { type: 'at-rule', name: 'extend' }, // scss: @extend .class-name;\n packages.sass /**********************************/ && { type: 'at-rule', name: 'include' }, // scss: @include mixin-name;\n isInRange(packages.tailwind, 0, 1, 2, 3, 4) /****/ && { type: 'at-rule', name: 'apply' }, // tailwind 0,1,2,3,4: @apply p-3;\n 'less-mixins', // less: .mixin();\n 'declarations', // css: display: block;\n\n //! block rules\n { type: 'rule', selector: blockRuleRegex }, // css: &::after {}\n 'rules', // css: child-component {}\n\n //! blocks nested\n packages.sass && { type: 'at-rule', name: 'at-root' }, // scss: @at-root selector { /* content */ }\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'responsive' }, // tailwind 0,1,2 : @responsive {}\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'variants' }, // tailwind 0,1,2 : @variants hover {}\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'screen' }, // tailwind 0,1,2 : @screen sm {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'variants' }, // tailwind 4: @variant dark {}\n { type: 'at-rule', hasBlock: true }, // css: @media () {}\n ),\n {\n unspecified: 'bottom',\n },\n ]);\n\nexport const order = (packages: Partial<Packages>) =>\n defineRules({\n 'order/order': orderRule(packages),\n });\n","import { defineRule, defineRules } from '~/utils';\n\nexport const selectorPseudoClassNoUnknownRule = defineRule<\n true,\n { ignorePseudoClasses?: (string | RegExp)[] }\n>([true, { ignorePseudoClasses: ['global', 'local'] }]);\n\nexport const selectorPseudoClassNoUnknown = defineRules({\n 'selector-pseudo-class-no-unknown': selectorPseudoClassNoUnknownRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { atRuleNoUnknownCSS } from '~/rules/at-rule-no-unknown';\nimport { declarationBlockNoRedundantLonghandProperties } from '~/rules/declaration-block-no-redundant-longhand-properties';\nimport { functionNoUnknown } from '~/rules/function-no-unknown';\nimport { importNotationCSS } from '~/rules/import-notation';\nimport { order } from '~/rules/order';\nimport { selectorPseudoClassNoUnknown } from '~/rules/selector-pseudo-class-no-unknown';\n\nexport const configCss = (packages: Partial<Packages>): Config => ({\n extends: ['stylelint-config-standard', 'stylelint-config-clean-order'],\n plugins: ['stylelint-order', 'stylelint-selector-bem-pattern'],\n rules: {\n ...atRuleNoUnknownCSS(packages),\n ...declarationBlockNoRedundantLonghandProperties,\n ...functionNoUnknown(packages),\n ...importNotationCSS(packages),\n ...order(packages),\n ...selectorPseudoClassNoUnknown,\n 'declaration-empty-line-before': null,\n },\n});\n","import { defineRule, defineRules } from '~/utils';\n\ntype PrimaryOption = string;\ninterface SecondaryOptions {\n message: string;\n}\n\nexport const dollarVariablePatternRule = defineRule<\n PrimaryOption,\n SecondaryOptions\n>([\n '^(-{0,2}?[a-z][a-z0-9]*)(-[a-z0-9]+)*$',\n { message: 'Expected variable to be kebab-case' },\n]);\n\nexport const dollarVariablePatternSCSS = defineRules({\n 'scss/dollar-variable-pattern': dollarVariablePatternRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { atRuleNoUnknownSCSS } from '~/rules/at-rule-no-unknown';\nimport { dollarVariablePatternSCSS } from '~/rules/dollar-variable-pattern';\n\nexport const configScss = (packages: Partial<Packages>): Config => ({\n extends: ['stylelint-config-standard-scss'],\n rules: {\n ...atRuleNoUnknownSCSS(packages),\n ...dollarVariablePatternSCSS,\n },\n});\n","import type { Config } from 'stylelint';\n\nexport const configShared = (): Config => ({\n extends: ['stylelint-config-html'],\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\n\nexport const configVue = (packages: Partial<Packages>): Config => ({\n extends: [\n packages.sass\n ? 'stylelint-config-standard-vue/scss'\n : 'stylelint-config-standard-vue',\n ],\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { configCss } from './configs/css';\nimport { configScss } from './configs/scss';\nimport { configShared } from './configs/shared';\nimport { configVue } from './configs/vue';\nimport { mergeConfigs } from './utils';\n\nexport default function defineConfig(\n packages?: Partial<Packages>,\n config?: Config,\n): Config {\n const packages_ = packages ?? {};\n\n return mergeConfigs(\n configShared(),\n configCss(packages_),\n packages_.sass && configScss(packages_),\n packages_.vue && configVue(packages_),\n config,\n );\n}\n"],"mappings":";AAcA,MAAa,cAIX,SACG;AAEL,MAAa,eAA+C,SAC1D;AAGF,MAAa,gBACX,GAAG,kBACA;CACH,MAAM,UAAU,cAAc,QAAQ,MAAmB,CAAC,CAAC,CAAC;CAE5D,OAAO;EACL,SAAS,CAAC,GAAG,IAAI,IAAI,QAAQ,SAAQ,MAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;EAC3D,WAAW,CAAC,GAAG,IAAI,IAAI,QAAQ,SAAQ,MAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;EAC/D,SAAS,QACN,SAAQ,MAAK,EAAE,WAAW,CAAC,CAAC,EAC5B,QAAQ,MAAM,OAAO,QAAQ,IAAI,YAAY,IAAI,MAAM,KAAK;EAC/D,OAAO,QAAQ,QACZ,KAAK,YAAY;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8C,WAG9C,CAAC,MAAM,EAAE,qBAAqB,CAAC,UAAU,OAAO,EAAE,CAAC,CAGf,EACtC,CAAC;;;ACAD,MAAa,aAAa,cAAyC;CACjE,SAAS,CAAC,6BAA6B,8BAA8B;CACrE,SAAS,CAAC,mBAAmB,gCAAgC;CAC7D,OAAO;EACL,GAAG,mBAAmB,QAAQ;EAC9B,GAAG;EACH,GAAG,kBAAkB,QAAQ;EAC7B,GAAG,kBAAkB,QAAQ;EAC7B,GAAG,MAAM,QAAQ;EACjB,GAAG;EACH,iCAAiC;CACnC;AACF;ACNA,MAAa,4BAA4B,YAAY,EACnD,gCATuC,WAGvC,CACA,0CACA,EAAE,SAAS,qCAAqC,CAClD,CAGkC,EAClC,CAAC;;;ACZD,MAAa,cAAc,cAAyC;CAClE,SAAS,CAAC,gCAAgC;CAC1C,OAAO;EACL,GAAG,oBAAoB,QAAQ;EAC/B,GAAG;CACL;AACF;;;ACTA,MAAa,sBAA8B,EACzC,SAAS,CAAC,uBAAuB,EACnC;;;ACDA,MAAa,aAAa,cAAyC,EACjE,SAAS,CACP,SAAS,OACL,uCACA,+BACN,EACF;;;ACDA,SAAwB,aACtB,UACA,QACQ;CACR,MAAM,YAAY,YAAY,CAAC;CAE/B,OAAO,aACL,aAAa,GACb,UAAU,SAAS,GACnB,UAAU,QAAQ,WAAW,SAAS,GACtC,UAAU,OAAO,UAAU,SAAS,GACpC,MACF;AACF"}
|
|
1
|
+
{"version":3,"file":"factory-BNS_YTTh.cjs","names":[],"sources":["../src/utils/utils.ts","../src/rules/at-rule-no-unknown.ts","../src/rules/declaration-block-no-redundant-longhand-properties.ts","../src/rules/function-no-unknown.ts","../src/rules/import-notation.ts","../src/rules/order.ts","../src/rules/selector-pseudo-class-no-unknown.ts","../src/configs/css.ts","../src/rules/dollar-variable-pattern.ts","../src/configs/scss.ts","../src/configs/shared.ts","../src/configs/vue.ts","../src/factory.ts"],"sourcesContent":["import type { Config, ConfigRuleSettings } from 'stylelint';\n\n// import type Primary, Secondary from stylelint\n\ntype StringOrRegex = string | RegExp;\ntype OneOrMany<S> = S | S[];\n\nexport type Primary =\n number | true | OneOrMany<StringOrRegex> | Record<string, any>;\nexport type Secondary = Record<string, any>;\n\nexport const defineRule = <\n PrimaryOption extends Primary,\n SecondaryOptions extends Secondary = object,\n>(\n rule: ConfigRuleSettings<PrimaryOption, SecondaryOptions>,\n) => rule;\n\nexport const defineRules = <TRules extends Config['rules']>(rule: TRules) =>\n rule;\n\n// clone function mergeConfigs from stylelint repository\nexport const mergeConfigs = (\n ...configsOrNull: (Config | undefined | null | false)[]\n) => {\n const configs = configsOrNull.filter((c): c is Config => !!c);\n\n return {\n plugins: [...new Set(configs.flatMap(c => c.plugins ?? []))],\n overrides: [...new Set(configs.flatMap(c => c.overrides ?? []))],\n extends: configs\n .flatMap(c => c.extends ?? [])\n .filter((item, index, arr) => arr.lastIndexOf(item) === index),\n rules: configs.reduce(\n (acc, config) => ({ ...acc, ...config.rules }),\n {} as Config['rules'],\n ),\n ...configs.reduce(\n (\n acc,\n { plugins: _p, overrides: _o, extends: _e, rules: _r, ...config },\n ) => ({ ...acc, ...config }),\n {} as Config,\n ),\n };\n};\n\nexport const isInRange = (\n version: false | number | undefined,\n ...versions: number[]\n) => typeof version === 'number' && versions.includes(version);\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules } from '~/utils';\n\nconst getIgnoreAtRulesByTailwindVersion = (\n tailwindVersion: false | number | undefined,\n) => {\n switch (tailwindVersion) {\n // https://tailwindcss-v0.netlify.app//docs/functions-and-directives\n case 0:\n return [\n // Directives\n 'tailwind',\n 'apply',\n\n 'variants',\n 'responsive',\n 'screen',\n ];\n\n // https://v1.tailwindcss.com/docs/functions-and-directives\n // https://v2.tailwindcss.com/docs/functions-and-directives\n case 1:\n case 2:\n return [\n // Directives\n 'tailwind',\n 'apply',\n 'layer', // new\n\n 'variants',\n 'responsive',\n 'screen',\n ];\n\n // https://v3.tailwindcss.com/docs/functions-and-directives\n case 3:\n return [\n // Directives\n 'tailwind',\n 'layer',\n 'apply',\n 'config', // new\n ];\n\n // https://tailwindcss.com/docs/functions-and-directives\n case 4:\n return [\n // Directives\n 'import',\n 'theme',\n 'source',\n 'utility',\n 'variant',\n 'custom-variant',\n 'apply',\n 'reference',\n\n // Compatibility\n 'config',\n 'plugin',\n ];\n\n default:\n return [];\n }\n};\n\nexport const atRuleNoUnknownRule = (packages: Partial<Packages>) =>\n defineRule<true, { ignoreAtRules: (string | RegExp)[] }>([\n true,\n { ignoreAtRules: getIgnoreAtRulesByTailwindVersion(packages.tailwind) },\n ]);\n\nexport const atRuleNoUnknownCSS = (packages: Partial<Packages>) =>\n defineRules({\n 'at-rule-no-unknown': atRuleNoUnknownRule(packages),\n });\n\nexport const atRuleNoUnknownSCSS = (packages: Partial<Packages>) =>\n defineRules({\n 'at-rule-no-unknown': null,\n 'scss/at-rule-no-unknown': atRuleNoUnknownRule(packages),\n });\n","import { defineRule, defineRules } from '~/utils';\n\nexport const declarationBlockNoRedundantLonghandPropertiesRule = defineRule<\n true,\n { ignoreShorthands?: (string | RegExp)[] }\n>([true, { ignoreShorthands: ['grid-template'] }]);\n\nexport const declarationBlockNoRedundantLonghandProperties = defineRules({\n 'declaration-block-no-redundant-longhand-properties':\n declarationBlockNoRedundantLonghandPropertiesRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules } from '~/utils';\n\nconst getIgnoreFunctionsByTailwindVersion = (\n tailwindVersion: false | number | undefined,\n) => {\n switch (tailwindVersion) {\n // https://tailwindcss-v0.netlify.app//docs/functions-and-directives\n case 0:\n return ['config'];\n\n // https://v1.tailwindcss.com/docs/functions-and-directives\n case 1:\n return ['theme'];\n\n // https://v2.tailwindcss.com/docs/functions-and-directives\n case 2:\n return ['screen', 'theme'];\n\n // https://v3.tailwindcss.com/docs/functions-and-directives\n case 3:\n return ['theme', 'screen'];\n\n // https://tailwindcss.com/docs/functions-and-directives\n case 4:\n return ['--alpha', '--spacing', 'theme'];\n\n default:\n return [];\n }\n};\n\nconst sassFunctionRegex = /^(list|math|color)\\..+/;\nconst getIgnoreFunctions = (packages: Partial<Packages>) => [\n // https://tailwindcss.com\n ...getIgnoreFunctionsByTailwindVersion(packages.tailwind),\n\n // https://sass-lang.com/documentation/modules/list\n // https://sass-lang.com/documentation/modules/math\n // https://sass-lang.com/documentation/modules/color\n ...(packages.sass //\n ? [sassFunctionRegex]\n : []),\n\n // https://vuejs.org/api/sfc-css-features.html#v-bind-in-css\n ...(packages.vue //\n ? ['v-bind']\n : []),\n];\n\nexport function functionNoUnknownRule(packages: Partial<Packages>) {\n return defineRule<true, { ignoreFunctions: (string | RegExp)[] }>([\n true,\n { ignoreFunctions: getIgnoreFunctions(packages) },\n ]);\n}\n\nexport const functionNoUnknown = (packages: Partial<Packages>) =>\n defineRules({\n 'function-no-unknown': functionNoUnknownRule(packages),\n });\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRules, isInRange } from '~/utils';\n\nexport const importNotationCSS = (packages: Partial<Packages>) =>\n defineRules(\n isInRange(packages.tailwind, 4) //\n ? { 'import-notation': null }\n : {},\n );\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules, isInRange } from '~/utils';\n\n// https://github.com/hudochenkov/stylelint-order/blob/master/rules/order/README.md#options\n\ntype Keyword =\n | 'custom-properties' /**/ // Custom properties (e.g. --property: 10px;)\n | 'dollar-variables' /***/ // Dollar variables (e.g. $variable)\n | 'at-variables' /*******/ // At-variables (e.g. @variable available in Less syntax)\n | 'declarations' /*******/ // CSS declarations (e.g. display: block)\n | 'rules' /**************/ // Nested rules (e.g. a { span {} })\n | 'at-rules' /***********/ // Nested at-rules (e.g. div { @media () {} })\n | 'less-mixins'; /*******/ // Mixins in Less syntax (e.g. .mixin();)\n\ninterface AtRule {\n type: 'at-rule';\n name?: string;\n parameter?: string | RegExp;\n hasBlock?: boolean;\n}\n\ninterface Rule {\n type: 'rule';\n selector?: string | RegExp;\n name?: string;\n}\n\ntype PrimaryOption = Array<Keyword | AtRule | Rule>;\ninterface SecondaryOptions {\n unspecified?: 'top' | 'bottom' | 'ignore';\n}\n\nconst definePrimaryOption = (...options: (PrimaryOption[number] | false | undefined)[]) =>\n options.filter((option): option is PrimaryOption[number] => !!option);\n\nconst blockRuleRegex = /^&::[\\w-]+/;\n\nexport const orderRule = (packages: Partial<Packages>) =>\n defineRule<PrimaryOption, SecondaryOptions>([\n definePrimaryOption(\n //! import\n packages.sass /**********************************/ && { type: 'at-rule', name: 'use' }, // scss: @use 'path/path';\n packages.sass /**********************************/ && { type: 'at-rule', name: 'forward' }, // scss: @forward 'path/path';\n packages.sass /**********************************/ && { type: 'at-rule', name: 'import' }, // scss: @import 'path/path';\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'import' }, // tailwind 4: @import \"tailwindcss\";\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'source' }, // tailwind 4: @source \"../node_modules/@culur/ui-lib\";\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'reference' }, // tailwind 4: @reference \"../../app.css\";\n\n //! root\n isInRange(packages.tailwind, 0, 1, 2, 3) /*******/ && { type: 'at-rule', name: 'tailwind' }, // tailwind 0,1,2,3 : @tailwind base;\n isInRange(packages.tailwind, 3, 4) /*************/ && { type: 'at-rule', name: 'config' }, // tailwind 3,4: @config 'tailwind.custom.config.js'\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'plugin' }, // tailwind 4: @plugin '@tailwindcss/typography'\n isInRange(packages.tailwind, 1, 2, 3) /**********/ && { type: 'at-rule', name: 'layer' }, // tailwind 1,2,3 : @layer base {}\n\n //! variables\n 'dollar-variables', // css: $variable: 10px;\n 'at-variables', // css: @variable: 10px;\n { type: 'at-rule', hasBlock: false }, // css: @variable: 10px;\n 'custom-properties', // css: --property: 10px;\n\n //! tailwind\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'theme' }, // tailwind 4: @theme {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'custom-variant' }, // tailwind 4: @custom-variant pointer-coarse (@media (pointer: coarse));\n\n //! functions, methods\n packages.sass /**********************************/ && { type: 'at-rule', name: 'function' }, // scss: @function sum() {}\n packages.sass /**********************************/ && { type: 'at-rule', name: 'mixin' }, // scss: @mixin mixin-name {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'utility' }, // tailwind 4: @utility tab-4 { tab-size: 4; }\n\n //! declarations\n packages.sass /**********************************/ && { type: 'at-rule', name: 'extend' }, // scss: @extend .class-name;\n packages.sass /**********************************/ && { type: 'at-rule', name: 'include' }, // scss: @include mixin-name;\n isInRange(packages.tailwind, 0, 1, 2, 3, 4) /****/ && { type: 'at-rule', name: 'apply' }, // tailwind 0,1,2,3,4: @apply p-3;\n 'less-mixins', // less: .mixin();\n 'declarations', // css: display: block;\n\n //! block rules\n { type: 'rule', selector: blockRuleRegex }, // css: &::after {}\n 'rules', // css: child-component {}\n\n //! blocks nested\n packages.sass && { type: 'at-rule', name: 'at-root' }, // scss: @at-root selector { /* content */ }\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'responsive' }, // tailwind 0,1,2 : @responsive {}\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'variants' }, // tailwind 0,1,2 : @variants hover {}\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'screen' }, // tailwind 0,1,2 : @screen sm {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'variants' }, // tailwind 4: @variant dark {}\n { type: 'at-rule', hasBlock: true }, // css: @media () {}\n ),\n {\n unspecified: 'bottom',\n },\n ]);\n\nexport const order = (packages: Partial<Packages>) =>\n defineRules({\n 'order/order': orderRule(packages),\n });\n","import { defineRule, defineRules } from '~/utils';\n\nexport const selectorPseudoClassNoUnknownRule = defineRule<\n true,\n { ignorePseudoClasses?: (string | RegExp)[] }\n>([true, { ignorePseudoClasses: ['global', 'local'] }]);\n\nexport const selectorPseudoClassNoUnknown = defineRules({\n 'selector-pseudo-class-no-unknown': selectorPseudoClassNoUnknownRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { atRuleNoUnknownCSS } from '~/rules/at-rule-no-unknown';\nimport { declarationBlockNoRedundantLonghandProperties } from '~/rules/declaration-block-no-redundant-longhand-properties';\nimport { functionNoUnknown } from '~/rules/function-no-unknown';\nimport { importNotationCSS } from '~/rules/import-notation';\nimport { order } from '~/rules/order';\nimport { selectorPseudoClassNoUnknown } from '~/rules/selector-pseudo-class-no-unknown';\n\nexport const configCss = (packages: Partial<Packages>): Config => ({\n extends: ['stylelint-config-standard', 'stylelint-config-clean-order'],\n plugins: ['stylelint-order', 'stylelint-selector-bem-pattern'],\n rules: {\n ...atRuleNoUnknownCSS(packages),\n ...declarationBlockNoRedundantLonghandProperties,\n ...functionNoUnknown(packages),\n ...importNotationCSS(packages),\n ...order(packages),\n ...selectorPseudoClassNoUnknown,\n 'declaration-empty-line-before': null,\n },\n});\n","import { defineRule, defineRules } from '~/utils';\n\ntype PrimaryOption = string;\ninterface SecondaryOptions {\n message: string;\n}\n\nexport const dollarVariablePatternRule = defineRule<\n PrimaryOption,\n SecondaryOptions\n>([\n '^(-{0,2}?[a-z][a-z0-9]*)(-[a-z0-9]+)*$',\n { message: 'Expected variable to be kebab-case' },\n]);\n\nexport const dollarVariablePatternSCSS = defineRules({\n 'scss/dollar-variable-pattern': dollarVariablePatternRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { atRuleNoUnknownSCSS } from '~/rules/at-rule-no-unknown';\nimport { dollarVariablePatternSCSS } from '~/rules/dollar-variable-pattern';\n\nexport const configScss = (packages: Partial<Packages>): Config => ({\n extends: ['stylelint-config-standard-scss'],\n rules: {\n ...atRuleNoUnknownSCSS(packages),\n ...dollarVariablePatternSCSS,\n },\n});\n","import type { Config } from 'stylelint';\n\nexport const configShared = (): Config => ({\n extends: ['stylelint-config-html'],\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\n\nexport const configVue = (packages: Partial<Packages>): Config => ({\n extends: [\n packages.sass\n ? 'stylelint-config-standard-vue/scss'\n : 'stylelint-config-standard-vue',\n ],\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { configCss } from './configs/css';\nimport { configScss } from './configs/scss';\nimport { configShared } from './configs/shared';\nimport { configVue } from './configs/vue';\nimport { mergeConfigs } from './utils';\n\nexport default function defineConfig(\n packages?: Partial<Packages>,\n config?: Config,\n): Config {\n const packages_ = packages ?? {};\n\n return mergeConfigs(\n configShared(),\n configCss(packages_),\n packages_.sass && configScss(packages_),\n packages_.vue && configVue(packages_),\n config,\n );\n}\n"],"mappings":";AAWA,MAAa,cAIX,SACG;AAEL,MAAa,eAA+C,SAC1D;AAGF,MAAa,gBACX,GAAG,kBACA;CACH,MAAM,UAAU,cAAc,QAAQ,MAAmB,CAAC,CAAC,CAAC;CAE5D,OAAO;EACL,SAAS,CAAC,GAAG,IAAI,IAAI,QAAQ,SAAQ,MAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;EAC3D,WAAW,CAAC,GAAG,IAAI,IAAI,QAAQ,SAAQ,MAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;EAC/D,SAAS,QACN,SAAQ,MAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAC7B,QAAQ,MAAM,OAAO,QAAQ,IAAI,YAAY,IAAI,MAAM,KAAK;EAC/D,OAAO,QAAQ,QACZ,KAAK,YAAY;GAAE,GAAG;GAAK,GAAG,OAAO;EAAM,IAC5C,CAAC,CACH;EACA,GAAG,QAAQ,QAEP,KACA,EAAE,SAAS,IAAI,WAAW,IAAI,SAAS,IAAI,OAAO,IAAI,GAAG,cACrD;GAAE,GAAG;GAAK,GAAG;EAAO,IAC1B,CAAC,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AAO;EACL,GAAG,mBAAmB,QAAQ;EAC9B,GAAG;EACH,GAAG,kBAAkB,QAAQ;EAC7B,GAAG,kBAAkB,QAAQ;EAC7B,GAAG,MAAM,QAAQ;EACjB,GAAG;EACH,iCAAiC;CACnC;AACF;ACNA,MAAa,4BAA4B,YAAY,EACnD,gCATuC,WAGvC,CACA,0CACA,EAAE,SAAS,qCAAqC,CAClD,CAGkC,EAClC,CAAC;;;ACZD,MAAa,cAAc,cAAyC;CAClE,SAAS,CAAC,gCAAgC;CAC1C,OAAO;EACL,GAAG,oBAAoB,QAAQ;EAC/B,GAAG;CACL;AACF;;;ACTA,MAAa,sBAA8B,EACzC,SAAS,CAAC,uBAAuB,EACnC;;;ACDA,MAAa,aAAa,cAAyC,EACjE,SAAS,CACP,SAAS,OACL,uCACA,+BACN,EACF;;;ACDA,SAAwB,aACtB,UACA,QACQ;CACR,MAAM,YAAY,YAAY,CAAC;CAE/B,OAAO,aACL,aAAa,GACb,UAAU,SAAS,GACnB,UAAU,QAAQ,WAAW,SAAS,GACtC,UAAU,OAAO,UAAU,SAAS,GACpC,MACF;AACF"}
|
package/dist/factory.d.cts
CHANGED
package/dist/factory.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/auto.ts"],"sourcesContent":["import { defineHasPackages } from '@culur/utils-packages';\nimport defineConfig from '~/factory';\n\nconst { tailwindVersion, hasSass, hasVue } = defineHasPackages();\n\nexport default defineConfig({\n tailwind: tailwindVersion(),\n sass: hasSass(),\n vue: hasVue(),\n});\n"],"mappings":";;AAGA,MAAM,EAAE,iBAAiB,SAAS,YAAA,kCAAA,
|
|
1
|
+
{"version":3,"file":"auto.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/auto.ts"],"sourcesContent":["import { defineHasPackages } from '@culur/utils-packages';\nimport defineConfig from '~/factory';\n\nconst { tailwindVersion, hasSass, hasVue } = defineHasPackages();\n\nexport default defineConfig({\n tailwind: tailwindVersion(),\n sass: hasSass(),\n vue: hasVue(),\n});\n"],"mappings":";;AAGA,MAAM,EAAE,iBAAiB,SAAS,YAAA,kCAAA,CAAA,CAAA,kBAAA,CAA6B;AAE/D,IAAA,eAAeA,gBAAAA,aAAa;CAC1B,UAAU,gBAAgB;CAC1B,MAAM,QAAQ;CACd,KAAK,OAAO;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"none.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/none.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: false,\n sass: false,\n vue: false,\n});\n"],"mappings":";AAEA,IAAA,gDAAeA,
|
|
1
|
+
{"version":3,"file":"none.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/none.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: false,\n sass: false,\n vue: false,\n});\n"],"mappings":";AAEA,IAAA,gDAAeA,CAAAA,CAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sass-vue.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/sass-vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: false,\n sass: true,\n vue: true,\n});\n"],"mappings":";AAEA,IAAA,oDAAeA,
|
|
1
|
+
{"version":3,"file":"sass-vue.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/sass-vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: false,\n sass: true,\n vue: true,\n});\n"],"mappings":";AAEA,IAAA,oDAAeA,CAAAA,CAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sass.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/sass.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: false,\n sass: true,\n vue: false,\n});\n"],"mappings":";AAEA,IAAA,gDAAeA,
|
|
1
|
+
{"version":3,"file":"sass.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/sass.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: false,\n sass: true,\n vue: false,\n});\n"],"mappings":";AAEA,IAAA,gDAAeA,CAAAA,CAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind3-sass-vue.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind3-sass-vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 3,\n sass: true,\n vue: true,\n});\n"],"mappings":";AAEA,IAAA,8DAAeA,
|
|
1
|
+
{"version":3,"file":"tailwind3-sass-vue.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind3-sass-vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 3,\n sass: true,\n vue: true,\n});\n"],"mappings":";AAEA,IAAA,8DAAeA,CAAAA,CAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind3-sass.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind3-sass.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 3,\n sass: true,\n vue: false,\n});\n"],"mappings":";AAEA,IAAA,0DAAeA,
|
|
1
|
+
{"version":3,"file":"tailwind3-sass.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind3-sass.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 3,\n sass: true,\n vue: false,\n});\n"],"mappings":";AAEA,IAAA,0DAAeA,CAAAA,CAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind3.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind3.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 3,\n sass: false,\n vue: false,\n});\n"],"mappings":";AAEA,IAAA,qDAAeA,
|
|
1
|
+
{"version":3,"file":"tailwind3.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind3.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 3,\n sass: false,\n vue: false,\n});\n"],"mappings":";AAEA,IAAA,qDAAeA,CAAAA,CAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind4-vue.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind4-vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 4,\n sass: false,\n vue: true,\n});\n"],"mappings":";AAEA,IAAA,yDAAeA,
|
|
1
|
+
{"version":3,"file":"tailwind4-vue.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind4-vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 4,\n sass: false,\n vue: true,\n});\n"],"mappings":";AAEA,IAAA,yDAAeA,CAAAA,CAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind4.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind4.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 4,\n sass: false,\n vue: false,\n});\n"],"mappings":";AAEA,IAAA,qDAAeA,
|
|
1
|
+
{"version":3,"file":"tailwind4.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind4.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 4,\n sass: false,\n vue: false,\n});\n"],"mappings":";AAEA,IAAA,qDAAeA,CAAAA,CAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: false,\n sass: false,\n vue: true,\n});\n"],"mappings":";AAEA,IAAA,+CAAeA,
|
|
1
|
+
{"version":3,"file":"vue.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: false,\n sass: false,\n vue: true,\n});\n"],"mappings":";AAEA,IAAA,+CAAeA,CAAAA,CAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@culur/config-stylelint",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Culur's stylelint configuration",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -76,18 +76,18 @@
|
|
|
76
76
|
"stylelint-config-standard-scss": "^17.0.0",
|
|
77
77
|
"stylelint-config-standard-vue": "^1.0.0",
|
|
78
78
|
"stylelint-order": "^8.1.1",
|
|
79
|
-
"stylelint-scss": "^7.
|
|
79
|
+
"stylelint-scss": "^7.2.0",
|
|
80
80
|
"stylelint-selector-bem-pattern": "^5.0.0",
|
|
81
|
-
"@culur/utils-packages": "1.3.
|
|
81
|
+
"@culur/utils-packages": "1.3.1"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"dedent": "^1.7.2",
|
|
85
|
-
"postcss": "^8.5.
|
|
85
|
+
"postcss": "^8.5.23",
|
|
86
86
|
"postcss-html": "^1.8.1",
|
|
87
87
|
"postcss-sass": "^0.5.0",
|
|
88
88
|
"postcss-scss": "^4.0.9",
|
|
89
|
-
"stylelint": "^17.
|
|
90
|
-
"@culur/config-tsdown": "1.1.
|
|
89
|
+
"stylelint": "^17.14.1",
|
|
90
|
+
"@culur/config-tsdown": "1.1.2",
|
|
91
91
|
"@culur/config-typescript": "2.0.0"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
package/src/utils/utils.ts
CHANGED
|
@@ -6,10 +6,7 @@ type StringOrRegex = string | RegExp;
|
|
|
6
6
|
type OneOrMany<S> = S | S[];
|
|
7
7
|
|
|
8
8
|
export type Primary =
|
|
9
|
-
|
|
|
10
|
-
| true
|
|
11
|
-
| OneOrMany<StringOrRegex>
|
|
12
|
-
| Record<string, any>;
|
|
9
|
+
number | true | OneOrMany<StringOrRegex> | Record<string, any>;
|
|
13
10
|
export type Secondary = Record<string, any>;
|
|
14
11
|
|
|
15
12
|
export const defineRule = <
|