diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..9620d13 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,51 @@ +import globals from "globals"; +import pluginJs from "@eslint/js"; +import tseslint from "typescript-eslint"; + +export default [ + pluginJs.configs.recommended, + ...tseslint.configs.recommended, + { + languageOptions: { + globals: { ...globals.browser, ...globals.node }, + parser: tseslint.parser, + }, + }, + // For some reason this has to be in its own block + { + ignores: ["putTypesInIndex.js", "dist/*", "docs/*"], + }, + { + files: ["src/**/*"], + rules: { + "@typescript-eslint/no-empty-interface": 0, + "@typescript-eslint/no-empty-function": 0, + "@typescript-eslint/ban-ts-comment": 0, + "@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/explicit-module-boundary-types": 0, + "arrow-body-style": 0, + curly: 0, + "eol-last": 0, + eqeqeq: 0, + "func-style": 0, + "import/no-duplicates": 0, + "max-statements": 0, + "max-params": 0, + "new-cap": 0, + "no-console": 0, + "no-duplicate-imports": 0, + "no-extra-parens": 0, + "no-return-assign": 0, + "no-throw-literal": 1, + "no-trailing-spaces": 0, + "no-unused-expressions": 0, + "no-useless-constructor": 0, + "no-useless-escape": 0, + "no-var": 0, + "prefer-const": 0, + "prefer-rest-params": 0, + "quote-props": 0, + "unicorn/filename-case": 0, + }, + }, +]; diff --git a/package.json b/package.json index e52ec88..7682f6f 100644 --- a/package.json +++ b/package.json @@ -11,14 +11,13 @@ "scripts": { "build": "tsc", "docs": "typedoc src/index.ts", - "lint": "tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx src && prettier --check src", + "lint": "tsc --noEmit && eslint --report-unused-disable-directives && prettier --check src", "prepare": "pnpm run build && husky" }, "repository": { "type": "git", "url": "git+https://github.com/LemmyNet/lemmy-js-client.git" }, - "dependencies": {}, "devDependencies": { "@types/node": "^20.11.19", "@typescript-eslint/eslint-plugin": "^7.0.1", @@ -33,7 +32,8 @@ "prettier-plugin-packagejson": "^2.4.11", "sortpack": "^2.4.0", "typedoc": "^0.25.8", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "typescript-eslint": "^7.9.0" }, "packageManager": "pnpm@9.1.1", "types": "./dist/index.d.ts", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b80c414..fd661d2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,9 +20,12 @@ importers: eslint: specifier: ^9.0.0 version: 9.2.0 + eslint-config-prettier: + specifier: ^9.1.0 + version: 9.1.0(eslint@9.2.0) eslint-plugin-prettier: specifier: ^5.1.3 - version: 5.1.3(eslint@9.2.0)(prettier@3.2.5) + version: 5.1.3(eslint-config-prettier@9.1.0(eslint@9.2.0))(eslint@9.2.0)(prettier@3.2.5) husky: specifier: ^9.0.11 version: 9.0.11 @@ -50,6 +53,9 @@ importers: typescript: specifier: ^5.3.3 version: 5.4.5 + typescript-eslint: + specifier: ^7.9.0 + version: 7.9.0(eslint@9.2.0)(typescript@5.4.5) packages: @@ -466,6 +472,12 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} + eslint-config-prettier@9.1.0: + resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + eslint-plugin-prettier@5.1.3: resolution: {integrity: sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==} engines: {node: ^14.18.0 || >=16.0.0} @@ -1111,6 +1123,16 @@ packages: peerDependencies: typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x + typescript-eslint@7.9.0: + resolution: {integrity: sha512-7iTn9c10teHHCys5Ud/yaJntXZrjt3h2mrx3feJGBOLgQkF3TB1X89Xs3aVQ/GgdXRAXpk2bPTdpRwHP4YkUow==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + eslint: ^8.56.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + typescript@3.9.10: resolution: {integrity: sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==} engines: {node: '>=4.2.0'} @@ -1612,12 +1634,18 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-plugin-prettier@5.1.3(eslint@9.2.0)(prettier@3.2.5): + eslint-config-prettier@9.1.0(eslint@9.2.0): + dependencies: + eslint: 9.2.0 + + eslint-plugin-prettier@5.1.3(eslint-config-prettier@9.1.0(eslint@9.2.0))(eslint@9.2.0)(prettier@3.2.5): dependencies: eslint: 9.2.0 prettier: 3.2.5 prettier-linter-helpers: 1.0.0 synckit: 0.8.8 + optionalDependencies: + eslint-config-prettier: 9.1.0(eslint@9.2.0) eslint-scope@8.0.1: dependencies: @@ -2221,6 +2249,17 @@ snapshots: shiki: 0.14.7 typescript: 5.4.5 + typescript-eslint@7.9.0(eslint@9.2.0)(typescript@5.4.5): + dependencies: + '@typescript-eslint/eslint-plugin': 7.9.0(@typescript-eslint/parser@7.9.0(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0)(typescript@5.4.5) + '@typescript-eslint/parser': 7.9.0(eslint@9.2.0)(typescript@5.4.5) + '@typescript-eslint/utils': 7.9.0(eslint@9.2.0)(typescript@5.4.5) + eslint: 9.2.0 + optionalDependencies: + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + typescript@3.9.10: {} typescript@5.4.5: {}