diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index a42bb23..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,17 +0,0 @@ -/** @type { import("eslint").Linter.Config } */ -module.exports = { - root: true, - extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - parserOptions: { - sourceType: 'module', - ecmaVersion: 2020, - extraFileExtensions: ['.svelte'] - }, - env: { - browser: true, - es2017: true, - node: true - } -} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..2e56b4c --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,29 @@ +import js from '@eslint/js' +import ts from 'typescript-eslint' +import prettier from 'eslint-config-prettier' +import globals from 'globals' + +/** @type {import('eslint').Linter.FlatConfig[]} */ +export default [ + js.configs.recommended, + ...ts.configs.recommended, + prettier, + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node + } + } + }, + { + languageOptions: { + parserOptions: { + parser: ts.parser + } + } + }, + { + ignores: ['dist/'] + } +] diff --git a/package.json b/package.json index 7fae48d..fd68840 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@types/jquery": "^3.5.30", "eslint": "^9.3.0", "eslint-config-prettier": "^9.1.0", + "globals": "^15.3.0", "jquery": "^3.7.1", "prettier": "3.2.5", "totp-generator": "^1.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 073f368..a7f880f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: eslint-config-prettier: specifier: ^9.1.0 version: 9.1.0(eslint@9.3.0) + globals: + specifier: ^15.3.0 + version: 15.3.0 jquery: specifier: ^3.7.1 version: 3.7.1 @@ -623,6 +626,10 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} + globals@15.3.0: + resolution: {integrity: sha512-cCdyVjIUVTtX8ZsPkq1oCsOsLmGIswqnjZYMJJTGaNApj1yHtLSymKhwH51ttirREn75z3p4k051clwg7rvNKA==} + engines: {node: '>=18'} + globby@11.1.0: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} @@ -1580,6 +1587,8 @@ snapshots: globals@14.0.0: {} + globals@15.3.0: {} + globby@11.1.0: dependencies: array-union: 2.1.0