UNPKG

@tangany/eslint-config

Version:
234 lines (183 loc) 13.3 kB
import TSESLint from "typescript-eslint"; export default TSESLint.config( { rules: { // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md "@typescript-eslint/adjacent-overload-signatures": "error", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/array-type.md "@typescript-eslint/array-type": ["error", {default: "array"}], // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/ban-ts-comment.mdx "@typescript-eslint/ban-ts-comment": [ "error", { "ts-expect-error": "allow-with-description", "ts-ignore": true, "ts-nocheck": true, "ts-check": true, minimumDescriptionLength: 1, }, ], // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/ban-tslint-comment.md "@typescript-eslint/ban-tslint-comment": "error", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/class-literal-property-style.md "@typescript-eslint/class-literal-property-style": ["error", "fields"], // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/class-methods-use-this.md "@typescript-eslint/class-methods-use-this": "off", // https://typescript-eslint.io/rules/consistent-generic-constructors/ "@typescript-eslint/consistent-generic-constructors": ["warn", "constructor"], // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md "@typescript-eslint/consistent-indexed-object-style": "error", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/consistent-type-assertions.md "@typescript-eslint/consistent-type-assertions": ["error", { assertionStyle: "as", objectLiteralTypeAssertions: "never" }], // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/consistent-type-definitions.md "@typescript-eslint/consistent-type-definitions": ["error", "interface"], // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/consistent-type-imports.md "@typescript-eslint/consistent-type-imports": ["error", {prefer: "type-imports"}], // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/explicit-function-return-type.md "@typescript-eslint/explicit-function-return-type": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md "@typescript-eslint/explicit-member-accessibility": ["error", {accessibility: "no-public"}], // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md "@typescript-eslint/explicit-module-boundary-types": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/init-declarations.md // enforce or disallow variable initializations at definition "init-declarations": "off", "@typescript-eslint/init-declarations": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/method-signature-style.md "@typescript-eslint/method-signature-style": ["error", "property"], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md // The `@typescript-eslint/naming-convention` rule allows `leadingUnderscore` and `trailingUnderscore` settings. However, the existing `no-underscore-dangle` rule already takes care of this. "naming-convention": "off", "@typescript-eslint/naming-convention": [ "error", // Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables (23.10) { selector: "variable", format: ["camelCase", "PascalCase", "UPPER_CASE"], }, // Allow camelCase functions (23.2), and PascalCase functions (23.8) { selector: "function", format: ["camelCase", "PascalCase"], }, // Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make TypeScript recommendations, we are assuming this rule would similarly apply to anything "type like", including interfaces, type aliases, and enums { selector: "typeLike", format: ["PascalCase"], }, ], // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/default-param-last.md "default-param-last": "off", "@typescript-eslint/default-param-last": "error", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/max-params.md "@typescript-eslint/max-params": ["warn", {max: 10}], // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/member-ordering.md "@typescript-eslint/member-ordering": "error", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md "@typescript-eslint/no-confusing-non-null-assertion": "error", // https://typescript-eslint.io/rules/no-empty-interface/ "no-empty-interface": "off", "@typescript-eslint/no-empty-interface": 0, // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md "no-empty-function": "off", "@typescript-eslint/no-empty-function": ["error", { allow: [ "arrowFunctions", "functions", "methods", ], }], // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-extraneous-class.md "@typescript-eslint/no-extraneous-class": ["error", { allowConstructorOnly: true, allowEmpty: true, allowStaticOnly: true }], // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-inferrable-types.md "@typescript-eslint/no-inferrable-types": "error", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md "no-loop-func": "off", "@typescript-eslint/no-loop-func": "error", // https://eslint.org/docs/latest/rules/no-magic-numbers "no-magic-numbers": "off", "@typescript-eslint/no-magic-numbers": ["off", { ignore: [-1, 0, 1, 2], ignoreEnums: true, ignoreNumericLiteralTypes: true, ignoreReadonlyClassProperties: true, ignoreTypeIndexes: true, }], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md "no-redeclare": "off", "@typescript-eslint/no-redeclare": "error", // disallow specific imports // https://eslint.org/docs/rules/no-restricted-imports "no-restricted-imports": ["off", { paths: [], patterns: [], }], "@typescript-eslint/no-restricted-imports": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-type-alias.md "@typescript-eslint/no-type-alias": ["off", { allowAliases: "in-unions", allowGenerics: "always" }], // https://typescript-eslint.io/rules/no-unnecessary-parameter-property-assignment "@typescript-eslint/no-unnecessary-parameter-property-assignment": "error", //https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unnecessary-template-expression.mdx "@typescript-eslint/no-unnecessary-template-expression": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-useless-empty-export.md "@typescript-eslint/no-useless-empty-export": "error", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-var-requires.md "@typescript-eslint/no-var-requires": "error", // Require or disallow padding lines between statements // https://eslint.org/docs/rules/padding-line-between-statements "padding-line-between-statements": "off", "@typescript-eslint/padding-line-between-statements": "off", // https://typescript-eslint.io/rules/parameter-properties/ "@typescript-eslint/parameter-properties": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md "@typescript-eslint/prefer-enum-initializers": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-for-of.md "@typescript-eslint/prefer-for-of": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-function-type.md "@typescript-eslint/prefer-function-type": "error", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md "@typescript-eslint/prefer-nullish-coalescing": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md "@typescript-eslint/prefer-readonly-parameter-types": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md "@typescript-eslint/prefer-ts-expect-error": "error", // https://typescript-eslint.io/rules/sort-type-constituents "@typescript-eslint/sort-type-constituents": "error", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md "@typescript-eslint/strict-boolean-expressions": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/typedef.md "@typescript-eslint/typedef": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/unbound-method.md "@typescript-eslint/unbound-method": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/use-unknown-in-catch-callback-variable.mdx "@typescript-eslint/use-unknown-in-catch-callback-variable": "off", // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md // https://github.com/sweepline/eslint-plugin-unused-imports "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "off", "unused-imports/no-unused-vars-ts": "off", "unused-imports/no-unused-imports-ts": "off", "unused-imports/no-unused-vars": ["error", { vars: "all", args: "after-used", ignoreRestSiblings: true }], "unused-imports/no-unused-imports": "error", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-import-type-side-effects.md "@typescript-eslint/no-import-type-side-effects": "error", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unsafe-enum-comparison.md "@typescript-eslint/no-unsafe-enum-comparison": "off", }, }, );