diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 4fe0e3c4..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "parser": "@typescript-eslint/parser", - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], - "plugins": ["@typescript-eslint", "prettier", "simple-import-sort"], - "rules": { - "@typescript-eslint/no-non-null-assertion": "off", - "no-console": "error", - "no-debugger": "error", - "prettier/prettier": "error", - "simple-import-sort/exports": "error", - "simple-import-sort/imports": "error" - } -} diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 56f92045..ba0a0b87 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -13,6 +13,9 @@ updates: commitlint: patterns: - '@commitlint/*' + eslint: + patterns: + - '@eslint/*' prettier: patterns: - prettier diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..b529a899 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,50 @@ +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { includeIgnoreFile } from '@eslint/compat'; +import { FlatCompat } from '@eslint/eslintrc'; +import js from '@eslint/js'; +import typescriptEslint from '@typescript-eslint/eslint-plugin'; +import tsParser from '@typescript-eslint/parser'; +import prettier from 'eslint-plugin-prettier'; +import simpleImportSort from 'eslint-plugin-simple-import-sort'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const gitignorePath = path.resolve(__dirname, '.gitignore'); + +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}); + +export default [ + includeIgnoreFile(gitignorePath), + + ...compat.extends( + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + ), + + { + plugins: { + '@typescript-eslint': typescriptEslint, + prettier, + 'simple-import-sort': simpleImportSort, + }, + + languageOptions: { + parser: tsParser, + }, + + rules: { + '@typescript-eslint/no-non-null-assertion': 'off', + 'no-console': 'error', + 'no-debugger': 'error', + 'prettier/prettier': 'error', + 'simple-import-sort/exports': 'error', + 'simple-import-sort/imports': 'error', + }, + }, +]; diff --git a/package-lock.json b/package-lock.json index 9fdf266d..175f693d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,9 @@ "devDependencies": { "@commitlint/cli": "19.4.0", "@commitlint/config-conventional": "19.2.2", + "@eslint/compat": "1.1.1", + "@eslint/eslintrc": "3.1.0", + "@eslint/js": "9.9.0", "@types/gtag.js": "0.0.20", "@typescript-eslint/eslint-plugin": "8.1.0", "@typescript-eslint/parser": "8.1.0", @@ -898,6 +901,16 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, + "node_modules/@eslint/compat": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-1.1.1.tgz", + "integrity": "sha512-lpHyRyplhGPL5mGEh6M9O5nnKk0Gz4bFI+Zu6tKlPpDUN7XshWvH9C/px4UVm87IAANE0W81CEsNGbS1KlzXpA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@eslint/config-array": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.17.1.tgz", @@ -917,6 +930,7 @@ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", "dev": true, + "license": "MIT", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", @@ -962,6 +976,7 @@ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.9.0.tgz", "integrity": "sha512-hhetes6ZHP3BlXLxmd8K2SNgkhNSi+UcecbnwWKwpP7kyi/uC75DJ1lOOBO3xrC4jyojtGE3YxKZPHfk4yrgug==", "dev": true, + "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } @@ -5513,6 +5528,12 @@ "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", "dev": true }, + "@eslint/compat": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-1.1.1.tgz", + "integrity": "sha512-lpHyRyplhGPL5mGEh6M9O5nnKk0Gz4bFI+Zu6tKlPpDUN7XshWvH9C/px4UVm87IAANE0W81CEsNGbS1KlzXpA==", + "dev": true + }, "@eslint/config-array": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.17.1.tgz", diff --git a/package.json b/package.json index 3824a370..1ea0cdae 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "build": "npm run clean && vite build", "bundle": "scripts/bundle.sh", "clean": "rm -rf dist", - "lint": "eslint --ignore-path .gitignore .", + "lint": "eslint .", "lint:fix": "npm run lint -- --fix", "lint:tsc": "tsc --noEmit", "prepare": "husky", @@ -22,6 +22,9 @@ "devDependencies": { "@commitlint/cli": "19.4.0", "@commitlint/config-conventional": "19.2.2", + "@eslint/compat": "1.1.1", + "@eslint/eslintrc": "3.1.0", + "@eslint/js": "9.9.0", "@types/gtag.js": "0.0.20", "@typescript-eslint/eslint-plugin": "8.1.0", "@typescript-eslint/parser": "8.1.0",