From 7cfaadefb1a578cb2ff6c39c12920b25df7599d7 Mon Sep 17 00:00:00 2001 From: zubiden <19638254+zubiden@users.noreply.github.com> Date: Fri, 19 Sep 2025 14:34:42 +0200 Subject: [PATCH] [dev] Add Baseline warnings to CSS (#6217) --- .eslintignore | 19 --- .github/workflows/package-and-publish.yml | 14 +- .stylelintrc.json | 16 +++ eslint.config.mjs | 1 + package-lock.json | 151 +++------------------- package.json | 1 + public/compatTest.js | 5 +- src/@types/global.d.ts | 1 + src/global/reducers/peers.ts | 2 +- tauri/tauri.conf.json | 2 +- tsconfig.json | 2 +- 11 files changed, 46 insertions(+), 168 deletions(-) delete mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 1f9c71e48..000000000 --- a/.eslintignore +++ /dev/null @@ -1,19 +0,0 @@ -src/lib/rlottie/rlottie-wasm.js -src/lib/video-preview/polyfill -src/lib/fasttextweb/fasttext-wasm.js - -src/lib/gramjs/tl/types-generator/template.ts -src/lib/gramjs/tl/api.d.ts -src/lib/gramjs/tl/apiTl.ts -src/lib/gramjs/tl/schemaTl.ts - -src/lib/lovely-chart - -src/lib/music-metadata-browser - -jest.config.js -src/lib/secret-sauce/ -playwright.config.ts - -dist -public diff --git a/.github/workflows/package-and-publish.yml b/.github/workflows/package-and-publish.yml index b1cb8173c..0c3e2da44 100644 --- a/.github/workflows/package-and-publish.yml +++ b/.github/workflows/package-and-publish.yml @@ -261,6 +261,8 @@ jobs: path: ${{ steps.file-info.outputs.path }}/${{ steps.file-info.outputs.name }}.dmg # Windows release + - name: Install DigiCert Client tools + uses: digicert/ssm-code-signing@v1.1.1 - name: Setup certificate and set environment variables (Windows) if: matrix.settings.platform == 'windows-latest' shell: bash @@ -275,21 +277,13 @@ jobs: echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH - - name: Setup SSM KSP and sign package (Windows) + - name: Sign package (Windows) if: matrix.settings.platform == 'windows-latest' env: - SM_API_KEY: ${{ secrets.SM_API_KEY }} KEYPAIR_ALIAS: ${{ secrets.KEYPAIR_ALIAS }} FILE_PATH: ${{ steps.file-info.outputs.path }}/${{ steps.file-info.outputs.filename }} shell: cmd - run: | - curl.exe -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools.msi - msiexec /i smtools.msi /quiet /qn - smksp_registrar.exe list - smctl.exe keypair ls - C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user - smksp_cert_sync.exe - smctl.exe sign --keypair-alias=%KEYPAIR_ALIAS% --input "%FILE_PATH%" + run: smctl.exe sign --keypair-alias=%KEYPAIR_ALIAS% --input "%FILE_PATH%" - name: Update release asset (Windows) if: matrix.settings.platform == 'windows-latest' && needs.get-version.outputs.should-publish != '' diff --git a/.stylelintrc.json b/.stylelintrc.json index 24ed4b014..bec84659f 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -14,6 +14,7 @@ "stylelint-high-performance-animation", "stylelint-group-selectors", "stylelint-selector-tag-no-without-class", + "stylelint-plugin-use-baseline", "@mytonwallet/stylelint-whole-pixel" ], "rules": { @@ -45,6 +46,21 @@ } ], "plugin/selector-tag-no-without-class": ["/^(?!body|html)([^_-]*)$/", { "severity": "warning" }], + "plugin/use-baseline": [true, { + "severity": "warning", + "ignoreSelectors": ["nesting", "dir", "selection", "view-transition-group"], + "ignoreProperties": [ + "text-wrap", + "outline", + "backdrop-filter", + "user-select", + "scrollbar-gutter", + "scrollbar-width", + "scrollbar-color", + "box-decoration-break", + "offset-anchor" + ] + }], "@stylistic/number-leading-zero": "always", "@stylistic/string-quotes": null, "@stylistic/color-hex-case": null, diff --git a/eslint.config.mjs b/eslint.config.mjs index 21eca5819..32fa12fe2 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -41,6 +41,7 @@ export default tseslint.config( 'dist/', 'public/', 'deploy/update_version.js', + 'tauri/target/', ]), { name: 'teact-config', diff --git a/package-lock.json b/package-lock.json index 2f36dde9d..de2b60119 100644 --- a/package-lock.json +++ b/package-lock.json @@ -102,6 +102,7 @@ "stylelint-declaration-block-no-ignored-properties": "^2.8.0", "stylelint-group-selectors": "^1.0.10", "stylelint-high-performance-animation": "^1.11.0", + "stylelint-plugin-use-baseline": "^0.9.1", "stylelint-selector-tag-no-without-class": "^3.0.1", "telegraph-node": "^1.0.4", "tsx": "^4.20.3", @@ -4406,141 +4407,6 @@ "@rspack/binding-win32-x64-msvc": "1.3.15" } }, - "node_modules/@rspack/binding-darwin-arm64": { - "version": "1.3.15", - "resolved": "https://registry.npmjs.org/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-1.3.15.tgz", - "integrity": "sha512-f+DnVRENRdVe+ufpZeqTtWAUDSTnP48jVo7x9KWsXf8XyJHUi+eHKEPrFoy1HvL1/k5yJ3HVnFBh1Hb9cNIwSg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "peer": true - }, - "node_modules/@rspack/binding-darwin-x64": { - "version": "1.3.15", - "resolved": "https://registry.npmjs.org/@rspack/binding-darwin-x64/-/binding-darwin-x64-1.3.15.tgz", - "integrity": "sha512-TfUvEIBqYUT2OK01BYXb2MNcZeZIhAnJy/5aj0qV0uy4KlvwW63HYcKWa1sFd4Ac7bnGShDkanvP3YEuHOFOyg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "peer": true - }, - "node_modules/@rspack/binding-linux-arm64-gnu": { - "version": "1.3.15", - "resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.3.15.tgz", - "integrity": "sha512-D/YjYk9snKvYm1Elotq8/GsEipB4ZJWVv/V8cZ+ohhFNOPzygENi6JfyI06TryBTQiN0/JDZqt/S9RaWBWnMqw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, - "node_modules/@rspack/binding-linux-arm64-musl": { - "version": "1.3.15", - "resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.3.15.tgz", - "integrity": "sha512-lJbBsPMOiR0hYPCSM42yp7QiZjfo0ALtX7ws2wURpsQp3BMfRVAmXU3Ixpo2XCRtG1zj8crHaCmAWOJTS0smsA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, - "node_modules/@rspack/binding-linux-x64-gnu": { - "version": "1.3.15", - "resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.3.15.tgz", - "integrity": "sha512-qGB8ucHklrzNg6lsAS36VrBsCbOw0acgpQNqTE5cuHWrp1Pu3GFTRiFEogenxEmzoRbohMZt0Ev5grivrcgKBQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, - "node_modules/@rspack/binding-linux-x64-musl": { - "version": "1.3.15", - "resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-1.3.15.tgz", - "integrity": "sha512-qRn6e40fLQP+N2rQD8GAj/h4DakeTIho32VxTIaHRVuzw68ZD7VmKkwn55ssN370ejmey35ZdoNFNE12RBrMZA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, - "node_modules/@rspack/binding-win32-arm64-msvc": { - "version": "1.3.15", - "resolved": "https://registry.npmjs.org/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.3.15.tgz", - "integrity": "sha512-7uJ7dWhO1nWXJiCss6Rslz8hoAxAhFpwpbWja3eHgRb7O4NPHg6MWw63AQSI2aFVakreenfu9yXQqYfpVWJ2dA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "peer": true - }, - "node_modules/@rspack/binding-win32-ia32-msvc": { - "version": "1.3.15", - "resolved": "https://registry.npmjs.org/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.3.15.tgz", - "integrity": "sha512-UsaWTYCjDiSCB0A0qETgZk4QvhwfG8gCrO4SJvA+QSEWOmgSai1YV70prFtLLIiyT9mDt1eU3tPWl1UWPRU/EQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "peer": true - }, - "node_modules/@rspack/binding-win32-x64-msvc": { - "version": "1.3.15", - "resolved": "https://registry.npmjs.org/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.3.15.tgz", - "integrity": "sha512-ZnDIc9Es8EF94MirPDN+hOMt7tkb8nMEbRJFKLMmNd0ElNPgsql+1cY5SqyGRH1hsKB87KfSUQlhFiKZvzbfIg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "peer": true - }, "node_modules/@rspack/core": { "version": "1.3.15", "resolved": "https://registry.npmjs.org/@rspack/core/-/core-1.3.15.tgz", @@ -18859,6 +18725,21 @@ "stylelint": "^14.0.0 || ^15.0.0 || ^16.0.1" } }, + "node_modules/stylelint-plugin-use-baseline": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/stylelint-plugin-use-baseline/-/stylelint-plugin-use-baseline-0.9.1.tgz", + "integrity": "sha512-L0I72+TCGhIn+6L9pRpKMlk9cvfhh7GnBQfPWFtx2ghRKIC7JO3RBW404zYxUgEGedeJPRIsVOWfVbde+kqmHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-tree": "^3.1.0", + "postcss": "^8.5.5", + "postcss-value-parser": "^4.2.0" + }, + "peerDependencies": { + "stylelint": "^16.0.2" + } + }, "node_modules/stylelint-scss": { "version": "6.12.1", "resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-6.12.1.tgz", diff --git a/package.json b/package.json index 13255efb0..100697e48 100644 --- a/package.json +++ b/package.json @@ -112,6 +112,7 @@ "stylelint-declaration-block-no-ignored-properties": "^2.8.0", "stylelint-group-selectors": "^1.0.10", "stylelint-high-performance-animation": "^1.11.0", + "stylelint-plugin-use-baseline": "^0.9.1", "stylelint-selector-tag-no-without-class": "^3.0.1", "telegraph-node": "^1.0.4", "tsx": "^4.20.3", diff --git a/public/compatTest.js b/public/compatTest.js index 74a3bbaaf..91ae6e2e5 100644 --- a/public/compatTest.js +++ b/public/compatTest.js @@ -12,9 +12,11 @@ function compatTest() { var hasWebLocks = typeof navigator.locks !== 'undefined'; var hasBigInt = typeof BigInt !== 'undefined'; var hasBroadcastChannel = typeof BroadcastChannel !== 'undefined'; + var hasArrayAt = typeof new Array(0).at !== 'undefined'; var isCompatible = hasPromise && hasWebSockets && hasWebCrypto && hasObjectFromEntries && hasResizeObserver - && hasCssSupports && hasDisplayNames && hasPluralRules && hasNumberFormat && hasWebLocks && hasBigInt && hasBroadcastChannel; + && hasCssSupports && hasDisplayNames && hasPluralRules && hasNumberFormat && hasWebLocks && hasBigInt && hasBroadcastChannel + && hasArrayAt; if (isCompatible || (window.localStorage && window.localStorage.getItem('tt-ignore-compat'))) { window.isCompatTestPassed = true; @@ -35,6 +37,7 @@ function compatTest() { console.warn('WebLocks', hasWebLocks); console.warn('BigInt', hasBigInt); console.warn('BroadcastChannel', hasBroadcastChannel); + console.warn('Array.at', hasArrayAt); } // Hardcoded page because server forbids iframe embedding diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index 76bdce76f..d69cd3ad0 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -168,6 +168,7 @@ interface BooleanConstructor { interface Array { filter(predicate: BooleanConstructor, thisArg?: unknown): Exclude[]; + at(index: number): T; // Make it behave like arr[arr.length - 1] } interface ReadonlyArray { filter(predicate: BooleanConstructor, thisArg?: unknown): Exclude[]; diff --git a/src/global/reducers/peers.ts b/src/global/reducers/peers.ts index 305fec7cc..35cc0b27e 100644 --- a/src/global/reducers/peers.ts +++ b/src/global/reducers/peers.ts @@ -127,7 +127,7 @@ export function updatePeerPhotos( }); } - const hasFallbackPhoto = currentPhotos.photos[currentPhotos.photos.length - 1].id === fallbackPhoto?.id; + const hasFallbackPhoto = currentPhotos.photos.at(-1).id === fallbackPhoto?.id; const currentPhotoArray = hasFallbackPhoto ? currentPhotos.photos.slice(0, -1) : currentPhotos.photos; const photos = uniqueByField([...currentPhotoArray, ...newPhotos, fallbackPhoto].filter(Boolean), 'id'); diff --git a/tauri/tauri.conf.json b/tauri/tauri.conf.json index 80ab30f1c..0589eebb2 100644 --- a/tauri/tauri.conf.json +++ b/tauri/tauri.conf.json @@ -22,7 +22,7 @@ "active": true, "createUpdaterArtifacts": false, "category": "SocialNetworking", - "copyright": "", + "copyright": "Telegram Air", "externalBin": [], "icon": [ "icons/32x32.png", diff --git a/tsconfig.json b/tsconfig.json index e14a3cfc6..7af395689 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "dom", "dom.iterable", "webworker", - "es2021" + "es2022" ], "allowJs": true, "skipLibCheck": true,