diff --git a/eslint.config.mjs b/eslint.config.mjs index 1b1ed00..fd7789c 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,107 +1,46 @@ -import globals from "globals"; -import stylisticEslintPlugin from "@stylistic/eslint-plugin"; -import typescriptEslint from "@typescript-eslint/eslint-plugin"; -import tsParser from "@typescript-eslint/parser"; +import eslint from '@eslint/js'; +import tsEslint from 'typescript-eslint'; +import stylisticEslint from '@stylistic/eslint-plugin'; -export default [{ - languageOptions: { - globals: { - ...globals.browser, - ...globals.node, - }, - ecmaVersion: 2018, - sourceType: "module", - parserOptions: { - ecmaFeatures: { - impliedStrict: true, - }, - }, - }, - rules: { - "indent": "off", - "arrow-parens": ["off", "as-needed"], - "brace-style": "off", - "comma-spacing": "off", - "space-infix-ops": "off", - "comma-dangle": "off", - "eqeqeq": ["error", "smart"], - "import/order": "off", - "no-eval": "warn", - "no-new-wrappers": "warn", - "no-trailing-spaces": "error", - "no-unsafe-finally": "warn", - "no-var": "error", - "spaced-comment": "error", - "semi": "warn", - "no-restricted-syntax": ["error", { - selector: "ExportDefaultDeclaration", - message: "Default exports are not allowed", - }], - "no-throw-literal": "error", - "key-spacing": "error", - "object-curly-spacing": ["error", "always"], - "array-bracket-spacing": "error", - "space-in-parens": "error", - "computed-property-spacing": "error", - "prefer-const": ["error", { - destructuring: "all", - ignoreReadBeforeAssign: false, - }], - "space-before-function-paren": "off", - "func-call-spacing": "off", - "no-multi-spaces": "error", - "block-spacing": "error", - "keyword-spacing": "off", - "space-before-blocks": "error", - "semi-spacing": "error", - }, -}, { - files: ["**/*.ts", "**/*.tsx"], +export default tsEslint.config( + eslint.configs.recommended, + ...tsEslint.configs.recommended, + ...tsEslint.configs.stylistic, + { + plugins: { + '@stylistic': stylisticEslint, + }, + rules:{ + 'prefer-const': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-inferrable-types': 'off', + '@typescript-eslint/consistent-indexed-object-style': 'off', + '@typescript-eslint/no-namespace': 'off', + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/consistent-type-definitions': 'off', + '@typescript-eslint/no-unused-expressions': 'off', + '@typescript-eslint/no-empty-object-type': 'off', - plugins: { - "@typescript-eslint": typescriptEslint, - "@stylistic": stylisticEslintPlugin, - }, - - languageOptions: { - parser: tsParser, - ecmaVersion: 5, - sourceType: "module", - parserOptions: { - project: ["tsconfig.json", "tsconfig-eslint.json"], - }, - }, - - rules: { - "@stylistic/indent": ["error", 4], - "@stylistic/member-delimiter-style": ["off", { - multiline: { - delimiter: "none", - requireLast: true, - }, - singleline: { - delimiter: "semi", - requireLast: false, - }, - }], - "@stylistic/quotes": ["error", "single", { - avoidEscape: true, - allowTemplateLiterals: true, + '@stylistic/indent': ['error', 4], + '@stylistic/quotes': ['error', 'single', { + avoidEscape: true, + allowTemplateLiterals: true, }], - "@stylistic/semi": ["off", null], - "@stylistic/type-annotation-spacing": "error", - "@stylistic/brace-style": ["error", "1tbs", { + '@stylistic/semi': 'off', + '@stylistic/type-annotation-spacing': 'error', + '@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true, }], - "@stylistic/comma-spacing": "error", - "@stylistic/space-infix-ops": "error", - "@stylistic/space-before-function-paren": ["error", { - anonymous: "always", - named: "never", - asyncArrow: "always", + '@stylistic/comma-spacing': 'error', + '@stylistic/space-infix-ops': 'error', + '@stylistic/space-before-function-paren': ['error', { + anonymous: 'always', + named: 'never', + asyncArrow: 'always', }], - "@stylistic/func-call-spacing": ["error"], - "@stylistic/keyword-spacing": ["error"], + '@stylistic/func-call-spacing': ['error'], + '@stylistic/keyword-spacing': ['error'], + }, }, -}]; + ); diff --git a/package-lock.json b/package-lock.json index 98c6166..93d28a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,6 @@ }, "devDependencies": { "@stylistic/eslint-plugin": "^2.6.4", - "@stylistic/eslint-plugin-ts": "^2.6.4", "@types/argparse": "^2.0.16", "@types/gl": "^6.0.2", "@types/jest": "^29.5.0", @@ -30,13 +29,12 @@ "@types/pngjs": "^6.0.1", "@types/react": "^18.0.9", "@types/react-dom": "^18.0.5", - "@typescript-eslint/eslint-plugin": "^8.2.0", - "@typescript-eslint/parser": "^8.2.0", "eslint": "^9.9.0", "globals": "^15.9.0", "jest": "^29.5.0", "ts-jest": "^29.1.0", - "typescript": "^5.5.4" + "typescript": "^5.5.4", + "typescript-eslint": "^8.2.0" } }, "node_modules/@ampproject/remapping": { @@ -9672,6 +9670,30 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.2.0.tgz", + "integrity": "sha512-DmnqaPcML0xYwUzgNbM1XaKXpEb7BShYf2P1tkUmmcl8hyeG7Pj08Er7R9bNy6AufabywzJcOybQAtnD/c9DGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.2.0", + "@typescript-eslint/parser": "8.2.0", + "@typescript-eslint/utils": "8.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", diff --git a/package.json b/package.json index 635541c..06c686d 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "homepage": "https://github.com/PDBeurope/pdb-images#readme", "devDependencies": { "@stylistic/eslint-plugin": "^2.6.4", - "@stylistic/eslint-plugin-ts": "^2.6.4", "@types/argparse": "^2.0.16", "@types/gl": "^6.0.2", "@types/jest": "^29.5.0", @@ -42,13 +41,12 @@ "@types/pngjs": "^6.0.1", "@types/react": "^18.0.9", "@types/react-dom": "^18.0.5", - "@typescript-eslint/eslint-plugin": "^8.2.0", - "@typescript-eslint/parser": "^8.2.0", "eslint": "^9.9.0", "globals": "^15.9.0", "jest": "^29.5.0", "ts-jest": "^29.1.0", - "typescript": "^5.5.4" + "typescript": "^5.5.4", + "typescript-eslint": "^8.2.0" }, "dependencies": { "argparse": "^2.0.1",