1
0
mirror of https://github.com/NickKaramoff/toot synced 2025-02-28 09:27:39 +01:00

Update lint configurations (#91)

This commit is contained in:
Nikita Karamov 2025-01-26 22:29:03 +01:00 committed by GitHub
commit 71ea203883
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 1408 additions and 363 deletions

View File

@ -1,10 +0,0 @@
# This ESLint ignore file is part of Share₂Fedi
# https://github.com/kytta/share2fedi
#
# SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
# SPDX-License-Identifier: CC0-1.0
.vercel/
/dist/
node_modules/
script/

View File

@ -1,30 +0,0 @@
// This ESLint config is part of ShareFedi
// https://github.com/kytta/share2fedi
//
// SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
// SPDX-License-Identifier: CC0-1.0
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:unicorn/recommended",
"plugin:astro/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"env": {
"browser": true
},
"overrides": [
{
"files": ["*.astro"],
"parser": "astro-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser",
"extraFileExtensions": [".astro"]
}
}
]
}

30
eslint.config.js Normal file
View File

@ -0,0 +1,30 @@
// This ESLint config is part of Share₂Fedi
// https://github.com/kytta/share2fedi
//
// SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
// SPDX-License-Identifier: CC0-1.0
import globals from "globals";
import js from "@eslint/js";
import ts from "typescript-eslint";
import astro from "eslint-plugin-astro";
import unicorn from "eslint-plugin-unicorn";
import prettier from "eslint-config-prettier";
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile} */
export default [
{
ignores: [".astro", ".vercel/", "dist/", "script/"],
},
{
languageOptions: {
globals: {
...globals.browser,
},
},
},
js.configs.recommended,
...ts.configs.recommended,
unicorn.configs["flat/recommended"],
...astro.configs["jsx-a11y-strict"],
prettier,
];

View File

@ -43,24 +43,30 @@
}, },
"devDependencies": { "devDependencies": {
"@astrojs/check": "^0.9.4", "@astrojs/check": "^0.9.4",
"@eslint/js": "^9.19.0",
"@types/node": "^22.10.10", "@types/node": "^22.10.10",
"@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/parser": "^8.21.0",
"@typescript-eslint/parser": "^7.18.0",
"browserslist": "^4.24.4", "browserslist": "^4.24.4",
"eslint": "^8.57.1", "eslint": "^9.19.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^10.0.1",
"eslint-plugin-astro": "^1.3.1", "eslint-plugin-astro": "^1.3.1",
"eslint-plugin-unicorn": "^55.0.0", "eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-unicorn": "^56.0.1",
"globals": "^15.14.0",
"husky": "^9.1.7", "husky": "^9.1.7",
"lightningcss": "^1.29.1", "lightningcss": "^1.29.1",
"lint-staged": "^15.4.2", "lint-staged": "^15.4.2",
"postcss-html": "^1.8.0",
"prettier": "^3.4.2", "prettier": "^3.4.2",
"prettier-plugin-astro": "^0.14.1", "prettier-plugin-astro": "^0.14.1",
"sass": "^1.83.4", "sass": "^1.83.4",
"sharp": "^0.33.5", "sharp": "^0.33.5",
"stylelint": "^16.14.0", "stylelint": "^16.14.0",
"stylelint-config-standard-scss": "^13.1.0", "stylelint-config-html": "^1.1.0",
"svgo": "^3.3.2" "stylelint-config-standard-scss": "^14.0.0",
"svgo": "^3.3.2",
"typescript": "^5.7.3",
"typescript-eslint": "^8.21.0"
}, },
"lint-staged": { "lint-staged": {
"*": "pnpm run fix:prettier", "*": "pnpm run fix:prettier",
@ -71,9 +77,6 @@
"prettier": { "prettier": {
"singleAttributePerLine": true "singleAttributePerLine": true
}, },
"stylelint": {
"extends": "stylelint-config-standard-scss"
},
"engines": { "engines": {
"node": "^18.17.1 || ^20.3.0 || ^22.0.0" "node": "^18.17.1 || ^20.3.0 || ^22.0.0"
} }

1653
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -98,7 +98,7 @@ const { instance, errors } = Astro.props;
:global(span.link) { :global(span.link) {
color: var(--s2f-accent-color-contrast); color: var(--s2f-accent-color-contrast);
cursor: pointer; cursor: pointer;
text-decoration: 1px solid underline currentColor; text-decoration: 1px solid underline currentcolor;
} }
} }
</style> </style>

View File

@ -21,9 +21,9 @@ export function useTranslations(language: string) {
} }
export function findBestLanguage(): string { export function findBestLanguage(): string {
const urlLanguage = new URLSearchParams(window.location.search).get("lang"); const urlLang = new URLSearchParams(globalThis.location.search).get("lang");
if (urlLanguage && urlLanguage in languages) { if (urlLang && urlLang in languages) {
return urlLanguage; return urlLang;
} }
let browserLanguages = navigator.languages; let browserLanguages = navigator.languages;

17
stylelint.config.js Normal file
View File

@ -0,0 +1,17 @@
// This Stylelint config is part of Share₂Fedi
// https://github.com/kytta/share2fedi
//
// SPDX-FileCopyrightText: © 2023 Nikita Karamov <me@kytta.dev>
// SPDX-License-Identifier: CC0-1.0
/** @type {import('stylelint').Config} */
export default {
extends: ["stylelint-config-standard-scss", "stylelint-config-html/astro"],
rules: {
"selector-pseudo-class-no-unknown": [
true,
{
ignorePseudoClasses: ["global"],
},
],
},
};