From 3ee8970419bb62c6d508b37b02f8fcbacf2f8590 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 17 Jun 2023 15:20:32 +0200 Subject: [PATCH] add `stylelint-stylistic` (#25285) Add [stylelint-stylistic](https://github.com/elirasza/stylelint-stylistic), autofix all issues with two manual tweaks. This restores all the stylistic rules removed in Stylelint 15. --- .stylelintrc.yaml | 77 ++++++++++++++++++++++++++++++ package-lock.json | 16 +++++++ package.json | 1 + web_src/css/base.css | 3 +- web_src/css/features/imagediff.css | 6 +-- web_src/css/helpers.css | 1 - web_src/css/modules/button.css | 1 - web_src/css/modules/normalize.css | 8 ++-- web_src/css/modules/select.css | 2 +- web_src/css/repo.css | 8 ++-- web_src/css/review.css | 6 +-- web_src/css/shared/settings.css | 2 +- web_src/css/standalone/swagger.css | 4 +- 13 files changed, 108 insertions(+), 27 deletions(-) diff --git a/.stylelintrc.yaml b/.stylelintrc.yaml index 4e2315ac958..6939a2074bc 100644 --- a/.stylelintrc.yaml +++ b/.stylelintrc.yaml @@ -1,5 +1,6 @@ plugins: - stylelint-declaration-strict-value + - stylelint-stylistic ignoreFiles: - "**/*.go" @@ -132,6 +133,82 @@ rules: selector-type-no-unknown: [true, {ignore: [custom-elements]}] shorthand-property-no-redundant-values: true string-no-newline: true + stylistic/at-rule-name-case: null + stylistic/at-rule-name-newline-after: null + stylistic/at-rule-name-space-after: null + stylistic/at-rule-semicolon-newline-after: null + stylistic/at-rule-semicolon-space-before: null + stylistic/block-closing-brace-empty-line-before: null + stylistic/block-closing-brace-newline-after: null + stylistic/block-closing-brace-newline-before: null + stylistic/block-closing-brace-space-after: null + stylistic/block-closing-brace-space-before: null + stylistic/block-opening-brace-newline-after: null + stylistic/block-opening-brace-newline-before: null + stylistic/block-opening-brace-space-after: null + stylistic/block-opening-brace-space-before: null + stylistic/color-hex-case: lower + stylistic/declaration-bang-space-after: never + stylistic/declaration-bang-space-before: null + stylistic/declaration-block-semicolon-newline-after: null + stylistic/declaration-block-semicolon-newline-before: null + stylistic/declaration-block-semicolon-space-after: null + stylistic/declaration-block-semicolon-space-before: never + stylistic/declaration-block-trailing-semicolon: null + stylistic/declaration-colon-newline-after: null + stylistic/declaration-colon-space-after: null + stylistic/declaration-colon-space-before: never + stylistic/function-comma-newline-after: null + stylistic/function-comma-newline-before: null + 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-space-inside: null + stylistic/function-whitespace-after: null + stylistic/indentation: 2 + stylistic/linebreaks: null + stylistic/max-empty-lines: 1 + stylistic/max-line-length: null + stylistic/media-feature-colon-space-after: null + stylistic/media-feature-colon-space-before: never + stylistic/media-feature-name-case: null + stylistic/media-feature-parentheses-space-inside: null + stylistic/media-feature-range-operator-space-after: always + stylistic/media-feature-range-operator-space-before: always + stylistic/media-query-list-comma-newline-after: null + stylistic/media-query-list-comma-newline-before: null + stylistic/media-query-list-comma-space-after: null + stylistic/media-query-list-comma-space-before: null + stylistic/no-empty-first-line: null + stylistic/no-eol-whitespace: true + stylistic/no-extra-semicolons: true + stylistic/no-missing-end-of-source-newline: null + stylistic/number-leading-zero: null + stylistic/number-no-trailing-zeros: null + stylistic/property-case: lower + stylistic/selector-attribute-brackets-space-inside: null + stylistic/selector-attribute-operator-space-after: null + stylistic/selector-attribute-operator-space-before: null + stylistic/selector-combinator-space-after: null + stylistic/selector-combinator-space-before: null + stylistic/selector-descendant-combinator-no-non-space: null + stylistic/selector-list-comma-newline-after: null + stylistic/selector-list-comma-newline-before: null + stylistic/selector-list-comma-space-after: always-single-line + stylistic/selector-list-comma-space-before: never-single-line + stylistic/selector-max-empty-lines: 0 + stylistic/selector-pseudo-class-case: lower + stylistic/selector-pseudo-class-parentheses-space-inside: never + stylistic/selector-pseudo-element-case: lower + stylistic/string-quotes: double + stylistic/unicode-bom: null + stylistic/unit-case: lower + stylistic/value-list-comma-newline-after: null + stylistic/value-list-comma-newline-before: null + stylistic/value-list-comma-space-after: null + stylistic/value-list-comma-space-before: null + stylistic/value-list-max-empty-lines: 0 time-min-milliseconds: null unit-allowed-list: null unit-disallowed-list: null diff --git a/package-lock.json b/package-lock.json index 76beea934e3..923a4a10d53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,6 +76,7 @@ "postcss-html": "1.5.0", "stylelint": "15.7.0", "stylelint-declaration-strict-value": "1.9.2", + "stylelint-stylistic": "0.4.2", "svgo": "3.0.2", "updates": "14.1.1", "vitest": "0.32.0" @@ -9789,6 +9790,21 @@ "stylelint": ">=7 <=15" } }, + "node_modules/stylelint-stylistic": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/stylelint-stylistic/-/stylelint-stylistic-0.4.2.tgz", + "integrity": "sha512-WF/fLvotTklG8LZ+fO0nxhu5swVENHhSat2l5ckrmtXpij1P9ybYa56XivOg/E02CH+Ygui5pd2hQrlli3NCDQ==", + "dev": true, + "dependencies": { + "postcss": "^8.4.21", + "postcss-media-query-parser": "^0.2.3", + "postcss-value-parser": "^4.2.0", + "style-search": "^0.1.0" + }, + "peerDependencies": { + "stylelint": "^15.0.0" + } + }, "node_modules/stylelint/node_modules/balanced-match": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", diff --git a/package.json b/package.json index 41d834771aa..87a80e939c5 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,7 @@ "postcss-html": "1.5.0", "stylelint": "15.7.0", "stylelint-declaration-strict-value": "1.9.2", + "stylelint-stylistic": "0.4.2", "svgo": "3.0.2", "updates": "14.1.1", "vitest": "0.32.0" diff --git a/web_src/css/base.css b/web_src/css/base.css index 2b62c248587..a876885632a 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1573,7 +1573,7 @@ img.ui.avatar, position: absolute; display: block; background: linear-gradient(to right, var(--color-header-wrapper-transparent), var(--color-header-wrapper) 100%); - content: ''; + content: ""; right: 0; height: 39px; width: 60px; @@ -2168,7 +2168,6 @@ table th[data-sortt-desc] .svg { background: var(--color-secondary-dark-1) !important; } - /* https://github.com/go-gitea/gitea/pull/11486 */ .ui.sub.header { text-transform: none; diff --git a/web_src/css/features/imagediff.css b/web_src/css/features/imagediff.css index 85d04575d96..a7bce3f4715 100644 --- a/web_src/css/features/imagediff.css +++ b/web_src/css/features/imagediff.css @@ -50,11 +50,7 @@ overflow: hidden; } -.image-diff-container - .diff-swipe - .swipe-frame - .swipe-container - .after-container { +.image-diff-container .diff-swipe .swipe-frame .swipe-container .after-container { position: absolute; right: 0; } diff --git a/web_src/css/helpers.css b/web_src/css/helpers.css index eb0cf020689..eae3d337577 100644 --- a/web_src/css/helpers.css +++ b/web_src/css/helpers.css @@ -40,7 +40,6 @@ Gitea's private styles use `g-` prefix. text-overflow: ellipsis !important; } - .g-table-auto-ellipsis td.auto-ellipsis { position: relative; } diff --git a/web_src/css/modules/button.css b/web_src/css/modules/button.css index a798291a0dc..66814acef17 100644 --- a/web_src/css/modules/button.css +++ b/web_src/css/modules/button.css @@ -95,7 +95,6 @@ a.btn:hover { background: var(--color-hover); } - .ui.basic.buttons .button:active, .ui.basic.button:active, .ui.basic.buttons .active.button, diff --git a/web_src/css/modules/normalize.css b/web_src/css/modules/normalize.css index 406869f7fb4..809ed3d7ccf 100644 --- a/web_src/css/modules/normalize.css +++ b/web_src/css/modules/normalize.css @@ -144,9 +144,9 @@ Correct the inability to style clickable types in iOS and Safari. */ button, -[type='button'], -[type='reset'], -[type='submit'] { +[type="button"], +[type="reset"], +[type="submit"] { -webkit-appearance: button; } @@ -206,7 +206,7 @@ Correct the cursor style of increment and decrement buttons in Safari. 2. Correct the outline style in Safari. */ -[type='search'] { +[type="search"] { -webkit-appearance: textfield; /* 1 */ outline-offset: -2px; /* 2 */ } diff --git a/web_src/css/modules/select.css b/web_src/css/modules/select.css index 57a87888e02..1d7d749d4ad 100644 --- a/web_src/css/modules/select.css +++ b/web_src/css/modules/select.css @@ -13,7 +13,7 @@ top: 12px; right: 8px; pointer-events: none; - content: ''; + content: ""; width: 14px; height: 14px; mask-size: cover; diff --git a/web_src/css/repo.css b/web_src/css/repo.css index 546fff32f42..4c42f9f0859 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -1844,7 +1844,6 @@ border: none; } - @media (max-width: 991.98px) { .diff-file-box { scroll-margin-top: 77px; /* match .repository .diff-detail-box */ @@ -1854,9 +1853,9 @@ /* TODO: this can potentially be made "global" by removing the class prefix */ .diff-file-box .ui.attached.header, .diff-file-box .ui.attached.table { - margin: 0; /* remove fomantic negative margins */; - width: initial; /* remove fomantic over 100% width */; - max-width: initial; /* remove fomantic over 100% width */; + margin: 0; /* remove fomantic negative margins */ + width: initial; /* remove fomantic over 100% width */ + max-width: initial; /* remove fomantic over 100% width */ } .repository .diff-stats { @@ -1908,7 +1907,6 @@ flex: 1 } - .repository.packages .empty { padding-top: 70px; padding-bottom: 100px; diff --git a/web_src/css/review.css b/web_src/css/review.css index 4b35764c7a6..dce23bcd749 100644 --- a/web_src/css/review.css +++ b/web_src/css/review.css @@ -95,11 +95,7 @@ .comment-code-cloud .comments .comment { display: flex; } - .comment-code-cloud - .comments - .comment - .comment-header-right.actions - .ui.basic.label { + .comment-code-cloud .comments .comment .comment-header-right.actions .ui.basic.label { display: none; } .comment-code-cloud .comments .comment .avatar { diff --git a/web_src/css/shared/settings.css b/web_src/css/shared/settings.css index 297b691a48f..33f88615e02 100644 --- a/web_src/css/shared/settings.css +++ b/web_src/css/shared/settings.css @@ -21,7 +21,7 @@ details.toggleable-item summary::-webkit-details-marker /* Safari */ { details.toggleable-item summary::after { transition: transform 0.25s ease; - content: ''; + content: ""; width: 14px; height: 14px; mask-size: cover; diff --git a/web_src/css/standalone/swagger.css b/web_src/css/standalone/swagger.css index 46b00d34ab3..c32e3920368 100644 --- a/web_src/css/standalone/swagger.css +++ b/web_src/css/standalone/swagger.css @@ -34,9 +34,9 @@ body { background: #1e1e1e; } .swagger-ui, .swagger-back-link { - filter: invert(88%) hue-rotate(180deg); + filter: invert(88%) hue-rotate(180deg); } .swagger-ui .microlight { - filter: invert(100%) hue-rotate(180deg); + filter: invert(100%) hue-rotate(180deg); } }