From 9733b2aeb119281800f321adc21ca501956bf009 Mon Sep 17 00:00:00 2001 From: 0t4u <61939142+0t4u@users.noreply.github.com> Date: Sat, 10 Aug 2024 13:58:37 +0800 Subject: [PATCH] feat: use new eslint config format --- .eslintignore | 3 --- eslint.config.mjs | 54 +++++++++++++++++++++++++++++++---------------- package.json | 5 ++++- tsconfig.json | 1 + 4 files changed, 41 insertions(+), 22 deletions(-) delete mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 007d4cad..00000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -docs/ -dist/ -node_modules/ \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs index a7a59043..9bcc95f2 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,21 +1,39 @@ // @ts-check +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import * as augu from '@augu/eslint-config'; -import eslint from "@eslint/js"; - -export default [ +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommendedTypeChecked, + ...tseslint.configs.stylisticTypeChecked, + // @ts-expect-error incorrect type from package, but still compatible + augu.javascript(), + // temp disable due to rule move from typescript-eslint (ts) -> stylistic (style) + // await augu.typescript(), { - "parser": "@typescript-eslint/parser", - "extends": "@augu", - "rules": { - "indent": ["error", 4, { "SwitchCase": 1 }], - "quotes": ["error", "single"], - "brace-style": ["error", "1tbs"], - "array-bracket-spacing": ["error", "always"], - "block-spacing": ["error", "always"], - "arrow-spacing": "error", - "switch-colon-spacing": ["error", {"after": true, "before": false}], - "camelcase": "off", - "require-await": "error" - } - } -]; \ No newline at end of file + ignores: [ + 'docs/', + 'dist/', + 'node_modules/', + ], + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + rules: { + 'indent': [ 'error', 4, { 'SwitchCase': 1 } ], + 'quotes': [ 'error', 'single' ], + 'brace-style': [ 'error', '1tbs' ], + 'object-curly-spacing': [ 'error', 'always' ], + 'array-bracket-spacing': [ 'error', 'always' ], + 'block-spacing': [ 'error', 'always' ], + 'arrow-spacing': 'error', + 'switch-colon-spacing': [ 'error', { 'after': true, 'before': false } ], + 'camelcase': 'off', + 'require-await': 'error', + }, + }, +); \ No newline at end of file diff --git a/package.json b/package.json index acec3f78..4a4ff18e 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,8 @@ }, "devDependencies": { "@augu/eslint-config": "5.2.4", + "@eslint/js": "^9.9.0", + "@types/eslint__js": "^8.42.3", "@types/node": "^22.2.0", "@types/node-fetch": "^2.6.11", "@types/ws": "^8.5.12", @@ -53,6 +55,7 @@ "eslint": "^9.9.0", "tsup": "^8.2.4", "typedoc": "^0.26.5", - "typescript": "^5.5.4" + "typescript": "^5.5.4", + "typescript-eslint": "^8.0.1" } } diff --git a/tsconfig.json b/tsconfig.json index d4e9c8fb..779a41b6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "allowJs": true, "module": "node16", "moduleResolution": "node16", "outDir": "dist",