Update stylelint config (#33419)

- Inherit stylelint config from
[`stylelint-config-recommended`](https://github.com/stylelint/stylelint-config-recommended),
removed all stylelint core rule options that were either already in
their config or disabled.
- `no-descending-specificity` diverges from their config, seems to much
work currently.
- Tweaked a few rules.
- Added
[`stylelint-define-config`](https://github.com/stylelint-types/stylelint-define-config)
so that typescript can validate the config.
pull/33298/head^2
silverwind 3 days ago committed by GitHub
parent 121e4c9624
commit 8f433132e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 55
      package-lock.json
  2. 4
      package.json
  3. 120
      stylelint.config.js

55
package-lock.json generated

@ -103,9 +103,11 @@
"markdownlint-cli": "0.43.0",
"nolyfill": "1.0.43",
"postcss-html": "1.8.0",
"stylelint": "16.13.2",
"stylelint": "16.14.1",
"stylelint-config-recommended": "15.0.0",
"stylelint-declaration-block-no-ignored-properties": "2.8.0",
"stylelint-declaration-strict-value": "1.10.7",
"stylelint-define-config": "16.14.0",
"stylelint-value-no-unknown-custom-properties": "6.0.1",
"svgo": "3.3.2",
"type-fest": "4.33.0",
@ -13143,9 +13145,9 @@
"license": "ISC"
},
"node_modules/stylelint": {
"version": "16.13.2",
"resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.13.2.tgz",
"integrity": "sha512-wDlgh0mRO9RtSa3TdidqHd0nOG8MmUyVKl+dxA6C1j8aZRzpNeEgdhFmU5y4sZx4Fc6r46p0fI7p1vR5O2DZqA==",
"version": "16.14.1",
"resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.14.1.tgz",
"integrity": "sha512-oqCL7AC3786oTax35T/nuLL8p2C3k/8rHKAooezrPGRvUX0wX+qqs5kMWh5YYT4PHQgVDobHT4tw55WgpYG6Sw==",
"dev": true,
"funding": [
{
@ -13177,7 +13179,7 @@
"globby": "^11.1.0",
"globjoin": "^0.1.4",
"html-tags": "^3.3.1",
"ignore": "^7.0.1",
"ignore": "^7.0.3",
"imurmurhash": "^0.1.4",
"is-plain-object": "^5.0.0",
"known-css-properties": "^0.35.0",
@ -13186,7 +13188,7 @@
"micromatch": "^4.0.8",
"normalize-path": "^3.0.0",
"picocolors": "^1.1.1",
"postcss": "^8.4.49",
"postcss": "^8.5.1",
"postcss-resolve-nested-selector": "^0.1.6",
"postcss-safe-parser": "^7.0.1",
"postcss-selector-parser": "^7.0.0",
@ -13205,6 +13207,29 @@
"node": ">=18.12.0"
}
},
"node_modules/stylelint-config-recommended": {
"version": "15.0.0",
"resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-15.0.0.tgz",
"integrity": "sha512-9LejMFsat7L+NXttdHdTq94byn25TD+82bzGRiV1Pgasl99pWnwipXS5DguTpp3nP1XjvLXVnEJIuYBfsRjRkA==",
"dev": true,
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/stylelint"
},
{
"type": "github",
"url": "https://github.com/sponsors/stylelint"
}
],
"license": "MIT",
"engines": {
"node": ">=18.12.0"
},
"peerDependencies": {
"stylelint": "^16.13.0"
}
},
"node_modules/stylelint-declaration-block-no-ignored-properties": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/stylelint-declaration-block-no-ignored-properties/-/stylelint-declaration-block-no-ignored-properties-2.8.0.tgz",
@ -13231,6 +13256,24 @@
"stylelint": ">=7 <=16"
}
},
"node_modules/stylelint-define-config": {
"version": "16.14.0",
"resolved": "https://registry.npmjs.org/stylelint-define-config/-/stylelint-define-config-16.14.0.tgz",
"integrity": "sha512-5R7/Vv6awCkNaPcedo1GuUp+7YTFvDnexogO4l/C0i349pBDYbefN6XzsDGsGOhU++maQSh2fp3mWNO0F16IjA==",
"dev": true,
"license": "MIT",
"dependencies": {
"csstype": "^3.1.3"
},
"engines": {
"node": ">=18.0.0",
"npm": ">=9.0.0",
"pnpm": ">=8.6.0"
},
"peerDependencies": {
"stylelint": ">=16.0.0"
}
},
"node_modules/stylelint-value-no-unknown-custom-properties": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/stylelint-value-no-unknown-custom-properties/-/stylelint-value-no-unknown-custom-properties-6.0.1.tgz",

@ -102,9 +102,11 @@
"markdownlint-cli": "0.43.0",
"nolyfill": "1.0.43",
"postcss-html": "1.8.0",
"stylelint": "16.13.2",
"stylelint": "16.14.1",
"stylelint-config-recommended": "15.0.0",
"stylelint-declaration-block-no-ignored-properties": "2.8.0",
"stylelint-declaration-strict-value": "1.10.7",
"stylelint-define-config": "16.14.0",
"stylelint-value-no-unknown-custom-properties": "6.0.1",
"svgo": "3.3.2",
"type-fest": "4.33.0",

@ -1,3 +1,5 @@
// @ts-check
import {defineConfig} from 'stylelint-define-config';
import {fileURLToPath} from 'node:url';
const cssVarFiles = [
@ -6,8 +8,8 @@ const cssVarFiles = [
fileURLToPath(new URL('web_src/css/themes/theme-gitea-dark.css', import.meta.url)),
];
/** @type {import('stylelint').Config} */
export default {
export default defineConfig({
extends: 'stylelint-config-recommended',
plugins: [
'stylelint-declaration-strict-value',
'stylelint-declaration-block-no-ignored-properties',
@ -67,7 +69,7 @@ export default {
'@stylistic/function-comma-space-after': null,
'@stylistic/function-comma-space-before': null,
'@stylistic/function-max-empty-lines': 0,
'@stylistic/function-parentheses-newline-inside': 'never-multi-line',
'@stylistic/function-parentheses-newline-inside': null,
'@stylistic/function-parentheses-space-inside': null,
'@stylistic/function-whitespace-after': null,
'@stylistic/indentation': 2,
@ -114,134 +116,34 @@ export default {
'@stylistic/value-list-comma-space-after': null,
'@stylistic/value-list-comma-space-before': null,
'@stylistic/value-list-max-empty-lines': 0,
'alpha-value-notation': null,
'annotation-no-unknown': true,
'at-rule-allowed-list': null,
'at-rule-disallowed-list': null,
'at-rule-empty-line-before': null,
'at-rule-no-unknown': [true, {ignoreAtRules: ['tailwind']}],
'at-rule-no-vendor-prefix': true,
'at-rule-property-required-list': null,
'block-no-empty': true,
'color-function-notation': null,
'color-hex-alpha': null,
'color-hex-length': null,
'color-named': null,
'color-no-hex': null,
'color-no-invalid-hex': true,
'comment-empty-line-before': null,
'comment-no-empty': true,
'comment-pattern': null,
'comment-whitespace-inside': null,
'comment-word-disallowed-list': null,
'csstools/value-no-unknown-custom-properties': [true, {importFrom: cssVarFiles}],
'custom-media-pattern': null,
'custom-property-empty-line-before': null,
'custom-property-no-missing-var-function': true,
'custom-property-pattern': null,
'declaration-block-no-duplicate-custom-properties': true,
'declaration-block-no-duplicate-properties': [true, {ignore: ['consecutive-duplicates-with-different-values']}],
'declaration-block-no-redundant-longhand-properties': [true, {ignoreShorthands: ['flex-flow', 'overflow']}],
'declaration-block-no-shorthand-property-overrides': null,
'declaration-block-single-line-max-declarations': null,
'declaration-empty-line-before': null,
'declaration-no-important': null,
'declaration-property-max-values': null,
'declaration-property-unit-allowed-list': null,
'declaration-block-no-redundant-longhand-properties': [true, {ignoreShorthands: ['flex-flow', 'overflow', 'grid-template']}],
// @ts-expect-error - https://github.com/stylelint-types/stylelint-define-config/issues/1
'declaration-property-unit-disallowed-list': {'line-height': ['em']},
'declaration-property-value-allowed-list': null,
// @ts-expect-error - https://github.com/stylelint-types/stylelint-define-config/issues/1
'declaration-property-value-disallowed-list': {'word-break': ['break-word']},
'declaration-property-value-no-unknown': true,
'font-family-name-quotes': 'always-where-recommended',
'font-family-no-duplicate-names': true,
'font-family-no-missing-generic-family-keyword': true,
'font-weight-notation': null,
'function-allowed-list': null,
'function-calc-no-unspaced-operator': true,
'function-disallowed-list': null,
'function-linear-gradient-no-nonstandard-direction': true,
'function-name-case': 'lower',
'function-no-unknown': true,
'function-url-no-scheme-relative': null,
'function-url-quotes': 'always',
'function-url-scheme-allowed-list': null,
'function-url-scheme-disallowed-list': null,
'hue-degree-notation': null,
'import-notation': 'string',
'keyframe-block-no-duplicate-selectors': true,
'keyframe-declaration-no-important': true,
'keyframe-selector-notation': null,
'keyframes-name-pattern': null,
'length-zero-no-unit': [true, {ignore: ['custom-properties']}, {ignoreFunctions: ['var']}],
'max-nesting-depth': null,
'media-feature-name-allowed-list': null,
'media-feature-name-disallowed-list': null,
'media-feature-name-no-unknown': true,
'length-zero-no-unit': [true, {ignore: ['custom-properties'], ignoreFunctions: ['var']}],
'media-feature-name-no-vendor-prefix': true,
'media-feature-name-unit-allowed-list': null,
'media-feature-name-value-allowed-list': null,
'media-feature-name-value-no-unknown': true,
'media-feature-range-notation': null,
'media-query-no-invalid': true,
'named-grid-areas-no-invalid': true,
'no-descending-specificity': null,
'no-duplicate-at-import-rules': true,
'no-duplicate-selectors': true,
'no-empty-source': true,
'no-invalid-double-slash-comments': true,
'no-invalid-position-at-import-rule': [true, {ignoreAtRules: ['tailwind']}],
'no-irregular-whitespace': true,
'no-unknown-animations': null, // disabled until stylelint supports multi-file linting
'no-unknown-custom-media': null, // disabled until stylelint supports multi-file linting
'no-unknown-custom-properties': null, // disabled until stylelint supports multi-file linting
'number-max-precision': null,
'plugin/declaration-block-no-ignored-properties': true,
'property-allowed-list': null,
'property-disallowed-list': null,
'property-no-unknown': true,
'property-no-vendor-prefix': null,
'rule-empty-line-before': null,
'rule-selector-property-disallowed-list': null,
'scale-unlimited/declaration-strict-value': [['/color$/', 'font-weight'], {ignoreValues: '/^(inherit|transparent|unset|initial|currentcolor|none)$/', ignoreFunctions: false, disableFix: true, expandShorthand: true}],
'selector-anb-no-unmatchable': true,
'selector-attribute-name-disallowed-list': null,
'selector-attribute-operator-allowed-list': null,
'selector-attribute-operator-disallowed-list': null,
'scale-unlimited/declaration-strict-value': [['/color$/', 'font-weight'], {ignoreValues: '/^(inherit|transparent|unset|initial|currentcolor|none)$/', ignoreFunctions: true, disableFix: true, expandShorthand: true}],
'selector-attribute-quotes': 'always',
'selector-class-pattern': null,
'selector-combinator-allowed-list': null,
'selector-combinator-disallowed-list': null,
'selector-disallowed-list': null,
'selector-id-pattern': null,
'selector-max-attribute': null,
'selector-max-class': null,
'selector-max-combinators': null,
'selector-max-compound-selectors': null,
'selector-max-id': null,
'selector-max-pseudo-class': null,
'selector-max-specificity': null,
'selector-max-type': null,
'selector-max-universal': null,
'selector-nested-pattern': null,
'selector-no-qualifying-type': null,
'selector-no-vendor-prefix': true,
'selector-not-notation': null,
'selector-pseudo-class-allowed-list': null,
'selector-pseudo-class-disallowed-list': null,
'selector-pseudo-class-no-unknown': true,
'selector-pseudo-element-allowed-list': null,
'selector-pseudo-element-colon-notation': 'double',
'selector-pseudo-element-disallowed-list': null,
'selector-pseudo-element-no-unknown': true,
'selector-type-case': 'lower',
'selector-type-no-unknown': [true, {ignore: ['custom-elements']}],
'shorthand-property-no-redundant-values': true,
'string-no-newline': true,
'time-min-milliseconds': null,
'unit-allowed-list': null,
'unit-disallowed-list': null,
'unit-no-unknown': true,
'value-keyword-case': null,
'value-no-vendor-prefix': [true, {ignoreValues: ['box', 'inline-box']}],
},
};
});

Loading…
Cancel
Save