From c90ae54cf04c1cdc251630dade1233e192289e07 Mon Sep 17 00:00:00 2001 From: Jaid <6216144+Jaid@users.noreply.github.com> Date: Mon, 23 Sep 2024 21:17:54 +0200 Subject: [PATCH] Added more rules Signed-off-by: Jaid <6216144+Jaid@users.noreply.github.com> --- etc/suppressed_in_error_lens.yml | 26 ++++++++++++-- src/segments/typescript/typescript.ts | 49 +++++++++++++++++++++++---- 2 files changed, 67 insertions(+), 8 deletions(-) diff --git a/etc/suppressed_in_error_lens.yml b/etc/suppressed_in_error_lens.yml index 4dea217..6f62d30 100644 --- a/etc/suppressed_in_error_lens.yml +++ b/etc/suppressed_in_error_lens.yml @@ -1,7 +1,16 @@ rules: eslint: + - dot-notation + - no-duplicate-type-constituents + - no-else-return + - no-extra-non-null-assertion + - no-unnecessary-template-expression - no-unnecessary-type-arguments - no-unused-vars + - no-useless-rename + - object-shorthand + - operator-assignment + - prefer-destructuring - prefer-template - quote-props - quotes @@ -11,8 +20,8 @@ rules: - space-in-parens - space-infix-ops - type-annotation-spacing - - no-unnecessary-template-expression - - dot-notation + - no-wrapper-object-types + - prefer-function-type import: - newline-after-import importQuotes: @@ -31,9 +40,22 @@ rules: - prefer-node-protocol - escape-case - prefer-string-slice + - template-indent + - switch-case-braces + - prevent-abbreviations + - prefer-query-selector + - prefer-object-from-entries + - prefer-modern-dom-apis + - prefer-includes + - prefer-default-parameters + - prefer-array-some + - no-console-spaces + - no-for-loop regex: - sort-character-class-elements - sort-flags + - no-useless-string-literal + - no-useless-escape aliases: - from: eslint to: typescript diff --git a/src/segments/typescript/typescript.ts b/src/segments/typescript/typescript.ts index b5a878b..d65b604 100644 --- a/src/segments/typescript/typescript.ts +++ b/src/segments/typescript/typescript.ts @@ -18,7 +18,11 @@ import ignores from 'src/ignores.js' const warn = `warn` const error = `error` const eslintRules: Linter.Config[`rules`] = { - "multiline-comment-style": `off`, + "prefer-template": warn, + "operator-assignment": warn, + "object-shorthand": warn, + "no-useless-rename": warn, + "no-else-return": warn, "new-cap": warn, "no-eq-null": warn, "no-extend-native": warn, @@ -39,6 +43,19 @@ const eslintRules: Linter.Config[`rules`] = { "sort-vars": warn } const typescriptRules: Linter.Config[`rules`] = { + "prefer-function-type": warn, + "no-wrapper-object-types": warn, + "prefer-destructuring": warn, + "no-extra-non-null-assertion": warn, + "no-duplicate-type-constituents": warn, + "ban-ts-comment": [warn, + { + "ts-expect-error": { descriptionFormat: '^ TS\d+' }, + "ts-ignore": true, + "ts-nocheck": false, + "ts-check": false + } + ], "no-base-to-string": warn, "no-misused-promises": warn, "no-non-null-asserted-nullish-coalescing": warn, @@ -65,7 +82,6 @@ const typescriptRules: Linter.Config[`rules`] = { "prefer-optional-chain": warn, "prefer-reduce-type-parameter": warn, "prefer-string-starts-ends-with": warn, - "prefer-ts-expect-error": warn, "restrict-template-expressions": warn, "unbound-method": [warn, { @@ -173,6 +189,15 @@ const typescriptRules: Linter.Config[`rules`] = { "prefer-as-const": warn } const stylisticRules: Linter.Config[`rules`] = { + "type-named-tuple-spacing": warn, + "type-generic-spacing": warn, + "nonblock-statement-body-position": [warn, + `below`], + "multiline-ternary": [warn, + "ignoreJSX"], + "block-spacing": warn, + "multiline-comment-style": [warn, + "separate-lines"], "brace-style": warn, "comma-spacing": warn, "func-call-spacing": warn, @@ -308,8 +333,6 @@ const stylisticRules: Linter.Config[`rules`] = { "quote-props": [warn, `as-needed`], "rest-spread-spacing": warn, - // "semi-spacing": warn, - // "semi-style": warn, "space-in-parens": warn, "space-unary-ops": warn, "spaced-comment": warn, @@ -318,13 +341,12 @@ const stylisticRules: Linter.Config[`rules`] = { "template-tag-spacing": warn, "yield-star-spacing": warn, "function-call-argument-newline": [warn, - `consistent`], + `never`], "function-call-spacing": warn, "generator-star-spacing": warn, "max-statements-per-line": warn, "newline-per-chained-call": warn, "no-confusing-arrow": warn, - // "no-extra-semi": warn, "no-multi-spaces": warn, semi: [warn, `never`] @@ -347,6 +369,19 @@ const promiseRules: Linter.Config[`rules`] = { "prefer-await-to-then": warn } const unicornRules: Linter.Config[`rules`] = { + "no-for-loop": warn, + "no-console-spaces": warn, + "prefer-array-some": warn, + "prefer-includes": warn, + "prefer-modern-dom-apis": warn, + "prefer-object-from-entries": warn, + "prefer-query-selector": warn, + "prevent-abbreviations": [warn, + { + + }], + "switch-case-braces": warn, + "template-indent": warn, "catch-error-name": warn, "consistent-function-scoping": warn, "error-message": warn, @@ -419,6 +454,8 @@ const importQuotesRules: Linter.Config[`rules`] = { `single`] } const regexRules: Linter.Config[`rules`] = { + "no-useless-escape": warn, + "no-useless-string-literal": warn, "control-character-escape": warn, "letter-case": [warn, {