Skip to content

Commit

Permalink
ci: add no literals check (#510)
Browse files Browse the repository at this point in the history
- chore: move from eslint 8 to eslint 9
- ci: add no literals check

---------

Co-authored-by: Puria Nafisi Azizi <[email protected]>
  • Loading branch information
matteo-cristino and puria authored Nov 13, 2024
1 parent 32a1da2 commit c6af673
Show file tree
Hide file tree
Showing 5 changed files with 290 additions and 160 deletions.
13 changes: 0 additions & 13 deletions .eslintignore

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ permissions:
contents: read

jobs:
no-literals:
name: 🪶 no literals check
runs-on: ubuntu-latest
steps:
- uses: dyne/pnpm@main
with:
node-version: 20
pnpm: 8
submodules: true
- run: |
pnpm no-literals
ninja-i18n:
name: 🌐 i18n checks
runs-on: ubuntu-latest
Expand Down
69 changes: 69 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import localization from "eslint-plugin-localization";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import parser from "svelte-eslint-parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: [
"**/.DS_Store",
"**/node_modules",
"build",
".svelte-kit",
"package",
"**/.env",
"**/.env.*",
"!**/.env.example",
"**/pnpm-lock.yaml",
"**/package-lock.json",
"**/yarn.lock",
],
}, ...compat.extends(), {
plugins: {
"@typescript-eslint": typescriptEslint,
localization,
},

languageOptions: {
globals: {
...globals.browser,
...globals.node,
},

parser: tsParser,
ecmaVersion: 2020,
sourceType: "module",

parserOptions: {
extraFileExtensions: [".svelte"],
},
},

rules: {
"localization/check-localization": "error",
},
}, {
files: ["**/*.svelte"],

languageOptions: {
parser: parser,
ecmaVersion: 5,
sourceType: "script",

parserOptions: {
parser: "@typescript-eslint/parser",
},
},
}];
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "paraglide-js compile --project ./project.inlang && vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"no-literals": "eslint . --ext .svelte",
"no-literals": "eslint .",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test:integration": "playwright test",
Expand All @@ -26,6 +26,9 @@
"devDependencies": {
"@axe-core/playwright": "^4.10.1",
"@capacitor/assets": "^3.0.5",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.13.0",
"@faker-js/faker": "^8.4.1",
"@inlang/paraglide-js": "1.11.3",
"@lottiefiles/svelte-lottie-player": "^0.3.1",
"@playwright/test": "^1.48.2",
Expand All @@ -39,15 +42,16 @@
"@sveltejs/kit": "^2.6.2",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@types/eslint": "8.56.5",
"@typescript-eslint/eslint-plugin": "^8.12.2",
"@typescript-eslint/parser": "^8.12.2",
"@types/lodash": "^4.17.13",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vite-pwa/sveltekit": "^0.4.0",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.1",
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-localization": "file:plugins/localization",
"eslint-plugin-svelte": "^2.44.1",
"globals": "^15.11.0",
"postcss": "^8.4.48",
"postcss-load-config": "^5.1.0",
"prettier": "^3.3.3",
Expand Down
Loading

0 comments on commit c6af673

Please sign in to comment.