From 56c95712becfd5a93001b9bdafa6badcc6d6238b Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Sun, 10 Nov 2024 14:03:45 -0500 Subject: [PATCH] New eslint config --- .eslintrc.json | 67 ----------------------------------------------- eslint.config.mjs | 65 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 67 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 eslint.config.mjs diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index b72f5f7..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "es6": true, - "mocha": true - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended" - ], - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 2018, - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - "indent": ["error", 2, { - "SwitchCase": 1 - }], - "linebreak-style": ["error", "unix"], - "no-constant-condition": ["error", { - "checkLoops": false - }], - "quotes": ["error", "single", - { - "allowTemplateLiterals": false, - "avoidEscape": true - } - ], - "semi": ["error", "always"], - "no-console": ["error", { "allow": ["warn", "error", "info", "debug"] }], - "no-trailing-spaces": "error", - "eol-last": "error", - "@typescript-eslint/ban-ts-comment": ["error", - { - "ts-expect-error": "allow-with-description" - } - ], - "@typescript-eslint/ban-tslint-comment": "error", - "@typescript-eslint/consistent-type-assertions": ["error", { - "assertionStyle": "as", - "objectLiteralTypeAssertions": "never" - }], - "@typescript-eslint/member-delimiter-style": "error", - "@typescript-eslint/no-inferrable-types": "off", - "@typescript-eslint/no-explicit-any" : 0, - "@typescript-eslint/no-for-in-array": "error", - "@typescript-eslint/no-invalid-void-type": "error", - "@typescript-eslint/no-namespace": "error", - "@typescript-eslint/no-non-null-asserted-optional-chain": "error", - "@typescript-eslint/no-unused-vars": ["error", { - "ignoreRestSiblings": true, - "args": "none" - }], - "@typescript-eslint/prefer-for-of": ["error"], - "@typescript-eslint/prefer-ts-expect-error": ["error"] - } -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..a116c01 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,65 @@ +// @ts-check +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config({ + + files: ['src/**/*.ts', 'test/**/*.ts'], + + extends: [ + eslint.configs.recommended, + ...tseslint.configs.recommended, + ], + rules: { + indent: ["error", 2, { + SwitchCase: 1, + }], + + "linebreak-style": ["error", "unix"], + + "no-constant-condition": ["error", { + checkLoops: false, + }], + + quotes: ["error", "single", { + allowTemplateLiterals: false, + avoidEscape: true, + }], + + semi: ["error", "always"], + + "no-console": ["error", { + allow: ["warn", "error", "info", "debug"], + }], + + "no-trailing-spaces": "error", + "eol-last": "error", + + "@typescript-eslint/ban-ts-comment": ["error", { + "ts-expect-error": "allow-with-description", + "ts-nocheck": "allow-with-description", + }], + + "@typescript-eslint/ban-tslint-comment": "error", + + "@typescript-eslint/consistent-type-assertions": ["error", { + assertionStyle: "as", + objectLiteralTypeAssertions: "never", + }], + + "@typescript-eslint/no-inferrable-types": "off", + "@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/no-for-in-array": "error", + "@typescript-eslint/no-invalid-void-type": "error", + "@typescript-eslint/no-namespace": "error", + "@typescript-eslint/no-non-null-asserted-optional-chain": "error", + + "@typescript-eslint/no-unused-vars": ["error", { + ignoreRestSiblings: true, + args: "none", + }], + + "@typescript-eslint/prefer-for-of": ["error"], + "@typescript-eslint/prefer-ts-expect-error": ["error"], + }, +});