@stylelint-types/stylelint-scss 6.0.0 → 6.5.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 stylelint-types
3
+ Copyright (c) 2023 @stylelint-types/stylelint-scss
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @stylelint-types/stylelint-scss
2
2
 
3
+ TypeScript definitions for [stylelint-define-config](https://github.com/stylelint-types/stylelint-define-config).
4
+
3
5
  ## Install
4
6
 
5
7
  ```sh
@@ -24,3 +26,14 @@ module.exports = defineConfig({
24
26
  }
25
27
  })
26
28
  ```
29
+
30
+ ![](./static/demo.png)
31
+
32
+ ## Credits
33
+
34
+ - [@stylelint-types](https://github.com/stylelint-types)
35
+ - [@pengzhanbo](https://github.com/pengzhanbo)
36
+
37
+ ## LICENSE
38
+
39
+ [MIT](./LICENSE)
@@ -0,0 +1,5 @@
1
+ import type { LiteralUnion, RuleConfig } from 'stylelint-define-config'
2
+
3
+ export type AtImportPartialExtensionAllowedListOptions = RuleConfig<
4
+ (LiteralUnion<'css' | 'scss' | 'sass'> | RegExp)[]
5
+ >
@@ -0,0 +1,5 @@
1
+ import type { LiteralUnion, RuleConfig } from 'stylelint-define-config'
2
+
3
+ export type AtImportPartialExtensionDisallowedListOptions = RuleConfig<
4
+ (LiteralUnion<'css' | 'scss' | 'sass'> | RegExp)[]
5
+ >
@@ -0,0 +1,3 @@
1
+ import type { RuleConfig } from 'stylelint-define-config'
2
+
3
+ export type AtMixinNoRiskyNestingSelectorOptions = RuleConfig<true>
@@ -0,0 +1,31 @@
1
+ import type { CSSPropertiesMap, RuleConfig } from 'stylelint-define-config'
2
+
3
+ export type DeclarationPropertyValueNoUnknownOptions = RuleConfig<
4
+ true,
5
+ {
6
+ /**
7
+ * Ignore the specified property and value pairs.
8
+ * Keys in the object indicate property names.
9
+ * If a string in the object is surrounded with `"/"`,
10
+ * it's interpreted as a regular expression.
11
+ *
12
+ * For example, `"/.+/"` matches any strings.
13
+ */
14
+ ignoreProperties?: Record<CSSPropertiesMap, (string | RegExp)[] | string | RegExp>
15
+ /**
16
+ * Extend or alter the properties syntax dictionary.
17
+ * [CSS Value Definition Syntax](https://github.com/csstree/csstree/blob/master/docs/definition-syntax.md) is used to define a value's syntax.
18
+ * If a definition starts with `|` it is added to the [existing definition value](https://csstree.github.io/docs/syntax/) if any.
19
+ */
20
+ propertiesSyntax?: Record<CSSPropertiesMap, string>
21
+
22
+ /**
23
+ * Extend or alter the types syntax dictionary.
24
+ * [CSS Value Definition Syntax](https://github.com/csstree/csstree/blob/master/docs/definition-syntax.md) is used to define a value's syntax.
25
+ * If a definition starts with `|` it is added to the [existing definition value](https://csstree.github.io/docs/syntax/) if any.
26
+ *
27
+ * Types are something like a preset which allows you to reuse a definition across other definitions. So, you'll likely want to also use the `propertiesSyntax` option when using this option.
28
+ */
29
+ typesSyntax?: Record<string, string>
30
+ }
31
+ >
@@ -0,0 +1,5 @@
1
+ import type { LiteralUnion, RuleConfig } from 'stylelint-define-config'
2
+
3
+ export type LoadPartialExtensionOptions = RuleConfig<
4
+ LiteralUnion<'always' | 'never'>
5
+ >
@@ -0,0 +1,3 @@
1
+ import type { RuleConfig } from 'stylelint-define-config'
2
+
3
+ export type NoUnusedPrivateMembersOptions = RuleConfig<true>
@@ -4,8 +4,18 @@ export type PropertyNoUnknownOptions = RuleConfig<
4
4
  true,
5
5
  {
6
6
  ignoreProperties?: (string | RegExp)[]
7
+ /**
8
+ * Skips checking properties of the given selectors against this rule.
9
+ */
7
10
  ignoreSelectors?: (string | RegExp)[]
11
+ /**
12
+ * Ignores properties nested within specified at-rules.
13
+ */
8
14
  ignoreAtRules?: (AtRules | RegExpLike)[]
15
+ /**
16
+ * If `true`, this rule will check vendor-prefixed properties.
17
+ * @default false
18
+ */
9
19
  checkPrefixed?: boolean
10
20
  }
11
21
  >
package/lib/types.d.ts CHANGED
@@ -63,6 +63,12 @@ import type { PercentPlaceholderPatternOptions } from './rules/percent-placehold
63
63
  import type { SelectorNoRedundantNestingSelectorOptions } from './rules/selector-no-redundant-nesting-selector'
64
64
  import type { SelectorNoUnionClassNameOptions } from './rules/selector-no-union-class-name'
65
65
  import type { SelectorNestCombinatorsOptions } from './rules/selector-nest-combinators'
66
+ import type { NoUnusedPrivateMembersOptions } from './rules/no-unused-private-members'
67
+ import type { AtImportPartialExtensionAllowedListOptions } from './rules/at-import-partial-extension-allowed-list'
68
+ import type { AtImportPartialExtensionDisallowedListOptions } from './rules/at-import-partial-extension-disallowed-list'
69
+ import type { AtMixinNoRiskyNestingSelectorOptions } from './rules/at-mixin-no-risky-nesting-selector'
70
+ import type { LoadPartialExtensionOptions } from './rules/load-partial-extension'
71
+ import type { DeclarationPropertyValueNoUnknownOptions } from './rules/declaration-property-value-no-unknown'
66
72
 
67
73
  export interface Extends {
68
74
  'stylelint-config-standard-scss': void
@@ -180,6 +186,8 @@ interface RuleOptions {
180
186
  'scss/at-if-no-null': AtIfNoNullOptions
181
187
 
182
188
  /**
189
+ * @deprecated Use `load-partial-extension` instead, and will be removed in '7.0'.
190
+ *
183
191
  * Require or disallow extension in `@import` commands.
184
192
  *
185
193
  * The rule ignores [cases](https://sass-lang.com/documentation/at-rules/import) when Sass considers an `@import` command just a plain CSS import:
@@ -206,6 +214,8 @@ interface RuleOptions {
206
214
  'scss/at-import-no-partial-leading-underscore': AtImportNoPartialLeadingUnderscoreOptions
207
215
 
208
216
  /**
217
+ * @deprecated Use `at-import-partial-extension-disallowed-list` instead, and will be removed in '7.0'.
218
+ *
209
219
  * Specify a blacklist of disallowed file extensions for partial names in `@import` commands.
210
220
  *
211
221
  * The rule ignores [cases](https://sass-lang.com/documentation/at-rules/import) when Sass considers an `@import` command just a plain CSS import:
@@ -219,6 +229,8 @@ interface RuleOptions {
219
229
  'scss/at-import-partial-extension-blacklist': AtImportPartialExtensionBlacklistOptions
220
230
 
221
231
  /**
232
+ * @deprecated Use `at-import-partial-extension-allowed-list` instead, and will be removed in '7.0'.
233
+ *
222
234
  * Specify a whitelist of allowed file extensions for partial names in `@import` commands.
223
235
  *
224
236
  * The rule ignores [cases](https://sass-lang.com/documentation/at-rules/import) when Sass considers an `@import` command just a plain CSS import:
@@ -231,6 +243,32 @@ interface RuleOptions {
231
243
  */
232
244
  'scss/at-import-partial-extension-whitelist': AtImportPartialExtensionWhitelistOptions
233
245
 
246
+ /**
247
+ * Specify a whitelist of allowed file extensions for partial names in `@import` commands.
248
+ *
249
+ * The rule ignores [cases](https://sass-lang.com/documentation/at-rules/import) when Sass considers an `@import` command just a plain CSS import:
250
+ * - If the file’s extension is `.css`.
251
+ * - If the filename begins with `http://` (or any other protocol).
252
+ * - If the filename is a `url()`.
253
+ * - If the `@import` has any media queries.
254
+ *
255
+ * @see [at-import-partial-extension-allowed-list](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/at-import-partial-extension-allowed-list)
256
+ */
257
+ 'scss/at-import-partial-extension-allowed-list': AtImportPartialExtensionAllowedListOptions
258
+
259
+ /**
260
+ * Specify a blacklist of disallowed file extensions for partial names in `@import` commands.
261
+ *
262
+ * The rule ignores [cases](https://sass-lang.com/documentation/at-rules/import) when Sass considers an `@import` command just a plain CSS import:
263
+ * - If the file’s extension is `.css`.
264
+ * - If the filename begins with `http://` (or any other protocol).
265
+ * - If the filename is a `url()`.
266
+ * - If the `@import` has any media queries.
267
+ *
268
+ * @see [at-import-partial-extension-disallowed-list](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/at-import-partial-extension-disallowed-list)
269
+ */
270
+ 'scss/at-import-partial-extension-disallowed-list': AtImportPartialExtensionDisallowedListOptions
271
+
234
272
  /**
235
273
  * Require named parameters in at-mixin call rule.
236
274
  *
@@ -238,6 +276,22 @@ interface RuleOptions {
238
276
  */
239
277
  'scss/at-mixin-named-arguments': AtMixinNamedArgumentsOptions
240
278
 
279
+ /**
280
+ * Disallow risky nesting selectors within a mixin.
281
+ *
282
+ * If a mixin contains a parent selector within another style rule,
283
+ * and is used in a nested context, the output selector may include the outermost
284
+ * parent selector in an unexpected way.
285
+ *
286
+ * This only occurs when a parent selector meets all of the following conditions:
287
+ * - Is within a `@mixin` rule.
288
+ * - Is nested within another style rule.
289
+ * - Is not positioned at the beginning of a complex selector.
290
+ *
291
+ * @see [at-mixin-no-risky-nesting-selector](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/at-mixin-no-risky-nesting-selector)
292
+ */
293
+ 'scss/at-mixin-no-risky-nesting-selector': AtMixinNoRiskyNestingSelectorOptions
294
+
241
295
  /**
242
296
  * Require or disallow parentheses in argumentless `@mixin` calls.
243
297
  *
@@ -343,6 +397,27 @@ interface RuleOptions {
343
397
  */
344
398
  'scss/declaration-nested-properties': DeclarationNestedPropertiesOptions
345
399
 
400
+ /**
401
+ * Disallow unknown values for properties within declarations.
402
+ *
403
+ * This rule considers values for properties defined within the CSS specifications to be known. You can use the `propertiesSyntax` and `typesSyntax` secondary options to extend the syntax.
404
+ *
405
+ * This rule is only appropriate for CSS. You should not turn it on for CSS-like languages, such as Sass or Less, as they have their own syntaxes.
406
+ *
407
+ * This rule is experimental with some false negatives that we'll patch in minor releases.
408
+ *
409
+ * It sometimes overlaps with:
410
+ * - [`color-no-invalid-hex`](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/color-no-invalid-hex/README.md)
411
+ * - [`function-no-unknown`](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/function-no-unknown/README.md)
412
+ * - [`string-no-newline`](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/string-no-newline/README.md)
413
+ * - [`unit-no-unknown`](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/unit-no-unknown/README.md)
414
+ *
415
+ * If duplicate problems are flagged, you can turn off the corresponding rule.
416
+ *
417
+ * @see [declaration-property-value-no-unknown](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/declaration-property-value-no-unknown)
418
+ */
419
+ 'scss/declaration-property-value-no-unknown': DeclarationPropertyValueNoUnknownOptions
420
+
346
421
  /**
347
422
  * Disallow `/*`-comments.
348
423
  *
@@ -571,6 +646,21 @@ interface RuleOptions {
571
646
  */
572
647
  'scss/load-no-partial-leading-underscore': LoadNoPartialLeadingUnderscoreOptions
573
648
 
649
+ /**
650
+ * Require or disallow extension in `@import`, `@use`, `@forward`, and `[meta.load-css]` commands.
651
+ *
652
+ * The [`fix` option](https://stylelint.io/user-guide/usage/options#fix) can automatically fix all of the problems reported by this rule only when `"never"` is given.
653
+ *
654
+ * The rule ignores [cases](https://sass-lang.com/documentation/at-rules/import) when Sass considers an `@import` command just a plain CSS import:
655
+ * - If the file’s extension is `.css`.
656
+ * - If the filename begins with `http://` (or any other protocol).
657
+ * - If the filename is a `url()`.
658
+ * - If the `@import` has any media queries.
659
+ *
660
+ * @see [load-partial-extension](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/load-partial-extension)
661
+ */
662
+ 'scss/load-partial-extension': LoadPartialExtensionOptions
663
+
574
664
  /**
575
665
  * Require quoted keys in Sass maps.
576
666
  *
@@ -617,6 +707,22 @@ interface RuleOptions {
617
707
  */
618
708
  'scss/no-global-function-names': NoGlobalFunctionNamesOptions
619
709
 
710
+ /**
711
+ * Disallow unused private members.
712
+ *
713
+ * [Private members](https://sass-lang.com/documentation/at-rules/use/#private-members),
714
+ * such as functions, mixins, variables, and selector placeholders are defined with names that
715
+ * start with either `-` or `_` (in the case of variables the name follows `$`, and the same
716
+ * applies to the `%` prefix for selector placeholders). These private members remain confined
717
+ * within the module, therefore, if they go unused within the module, they are considered unused.
718
+ *
719
+ * This rule ignores files using `@import` since all files loaded through it are consolidated
720
+ * within the same module. This setup makes it tricky to ensure all usages of private members.
721
+ *
722
+ * @see [no-unused-private-members](https://github.com/stylelint-scss/stylelint-scss/tree/master/src/rules/no-unused-private-members)
723
+ */
724
+ 'scss/no-unused-private-members': NoUnusedPrivateMembersOptions
725
+
620
726
  /**
621
727
  * Disallow linebreaks after Sass operators.
622
728
  *
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@stylelint-types/stylelint-scss",
3
3
  "type": "module",
4
- "version": "6.0.0",
5
- "packageManager": "pnpm@8.11.0",
6
- "description": "Provide a defineConfig function for stylelint.config.js files",
4
+ "version": "6.5.0",
5
+ "description": "TypeScript definitions for stylelint-define-config",
7
6
  "author": "pengzhanbo <volodymyr@foxmail.com> (https://github.com/pengzhanbo)",
8
7
  "license": "MIT",
9
8
  "homepage": "https://github.com/stylelint-types/stylelint-scss#readme",
@@ -52,14 +51,14 @@
52
51
  }
53
52
  },
54
53
  "devDependencies": {
55
- "@pengzhanbo/eslint-config": "^1.3.1",
56
- "bumpp": "^9.2.1",
57
- "conventional-changelog-cli": "^4.1.0",
58
- "eslint": "^8.55.0",
59
- "stylelint": "^16.0.2",
60
- "stylelint-define-config": "^1.0.0",
61
- "stylelint-scss": "^6.0.0",
62
- "typescript": "^5.3.3"
54
+ "@pengzhanbo/eslint-config": "^1.12.0",
55
+ "bumpp": "^9.5.1",
56
+ "conventional-changelog-cli": "^5.0.0",
57
+ "eslint": "^9.9.0",
58
+ "stylelint": "^16.8.2",
59
+ "stylelint-define-config": "^1.6.0",
60
+ "stylelint-scss": "^6.5.0",
61
+ "typescript": "^5.5.4"
63
62
  },
64
63
  "scripts": {
65
64
  "lint": "eslint .",