From 1562e5394d58f975f62e3cc83a13479f7698e03d Mon Sep 17 00:00:00 2001 From: azur Date: Wed, 10 Dec 2025 21:19:37 +0100 Subject: [PATCH] =?UTF-8?q?=E2=AD=90=20Config=20prettier=20and=20eslint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/lint.yml | 21 +++++++++++++ .prettierignore | 1 + .prettierrc | 2 +- eslint.config.mjs | 65 +++++++++++---------------------------- package.json | 6 ++-- 5 files changed, 43 insertions(+), 52 deletions(-) create mode 100644 .gitea/workflows/lint.yml create mode 100644 .prettierignore diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml new file mode 100644 index 0000000..741dae0 --- /dev/null +++ b/.gitea/workflows/lint.yml @@ -0,0 +1,21 @@ +name: CI +on: [push] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v5 + - uses: pnpm/action-setup@v4 + with: + version: 10 + cache: true + - name: Install node + uses: actions/setup-node@v6 + with: + node-version: latest + cache: 'pnpm' + - run: pnpm prettier . --check + - run: pnpm eslint . \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..eeeb7be --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +pnpm-lock.yaml \ No newline at end of file diff --git a/.prettierrc b/.prettierrc index 0d69450..537ac33 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,4 +3,4 @@ "tabWidth": 4, "trailingComma": "all", "useTabs": true -} \ No newline at end of file +} diff --git a/eslint.config.mjs b/eslint.config.mjs index 50a2098..42435e7 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,54 +1,25 @@ -import { defineConfig, globalIgnores } from "eslint/config"; -import typescriptEslint from "@typescript-eslint/eslint-plugin"; -// import robloxTs from "eslint-plugin-roblox-ts"; -import prettier from "eslint-plugin-prettier"; -import tsParser from "@typescript-eslint/parser"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; +// @ts-check import js from "@eslint/js"; -import { FlatCompat } from "@eslint/eslintrc"; +import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; +import roblox from "eslint-plugin-roblox-ts"; +import { defineConfig } from "eslint/config"; +import ts from "typescript-eslint"; -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 defineConfig([ - globalIgnores(["out"]), +export default defineConfig( + js.configs.recommended, + ts.configs.recommended, + roblox.configs.recommended, + eslintPluginPrettierRecommended, { - extends: compat.extends( - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:roblox-ts/recommended-legacy", - "plugin:prettier/recommended", - ), - - plugins: { - "@typescript-eslint": typescriptEslint, - // "roblox-ts": robloxTs, - prettier, - }, - - languageOptions: { - parser: tsParser, - ecmaVersion: 2018, - sourceType: "module", - - parserOptions: { - jsx: true, - useJSXTextNode: true, - project: "./tsconfig.json", - }, - }, - rules: { "prettier/prettier": "warn", - "@typescript-eslint/no-unused-vars": ["error", { - "varsIgnorePattern": "^[A-Z].*(Service|Controller|Component)$" - }] + "@typescript-eslint/no-unused-vars": [ + "error", + { + varsIgnorePattern: "^[A-Z].*(Service|Controller|Component)$", + }, + ], + "@typescript-eslint/no-empty-object-type": "off", }, }, -]); +); diff --git a/package.json b/package.json index 76d84d8..c6276ea 100644 --- a/package.json +++ b/package.json @@ -14,15 +14,12 @@ "license": "ISC", "type": "commonjs", "devDependencies": { - "@eslint/eslintrc": "^3.3.3", "@eslint/js": "^9.39.1", "@rbxts/compiler-types": "3.0.0-types.0", "@rbxts/services": "^1.6.0", "@rbxts/signal": "^1.1.1", "@rbxts/t": "^3.2.1", "@rbxts/types": "^1.0.896", - "@typescript-eslint/eslint-plugin": "^8.48.1", - "@typescript-eslint/parser": "^8.48.1", "eslint": "^9.39.1", "eslint-config-prettier": "^10.1.8", "eslint-plugin-prettier": "^5.5.4", @@ -32,7 +29,8 @@ "rbxts-transformer-instances": "^1.0.1", "rbxts-transformer-services": "^1.1.1", "roblox-ts": "^3.0.0", - "typescript": "~5.5.4" + "typescript": "~5.5.4", + "typescript-eslint": "^8.49.0" }, "dependencies": { "@flamework/components": "^1.3.2",