UNPKG

eslint-config-brf

Version:

brf lint custom configurations

155 lines (154 loc) 6.13 kB
module.exports = { plugins: ["import", "unused-imports"], overrides: [ { // GLOBAL files: ["*.ts"], parserOptions: { createDefaultProgram: true, project: ["tsconfig.json"], }, rules: { "@typescript-eslint/no-inferrable-types": "off", // Anulando regras padrão (extendidas) - impacto com obrigatoriedade de tipos (typedef) "default-case": "error", // - M017 (criar regra no eslint como erro) // 'max-params': ['warn', 7], // Acusa tbm o construtor - tem no sonar - B014 (automatizar via eslint) "no-console": [ "error", { allow: ["error"], }, ], "no-duplicate-imports": "error", "no-else-return": "error", "no-empty-function": [ "error", { allow: ["constructors"], }, ], "no-lonely-if": "error", "no-inline-comments": "warn", // - A003 (criar regra no eslint como warning) // 'no-magic-strings': ['error', { 'ignore': ['literal1', 'literal2'] }],// - B005 (automatizar via node ou eslint - gerar comentário no PR) // 'no-magic-numbers': ['error', { 'ignore': [0, 1] }], "no-nested-ternary": "error", // A001 (criar regra no eslint como erro) -- OK "no-self-compare": "error", "no-unused-expressions": "error", // - A004 (criar regra no eslint como erro "no-unused-private-class-members": "error", "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": [ "error", { argsIgnorePattern: "^_" }, ], // falta para atributos da classe e métodos TS6133 e parâmetros do construtor TS6138 "no-useless-escape": "off", // falha em: Validators.pattern(/^[A-z\/\-]+$/)]], "no-useless-concat": "error", "no-var": "error", "no-warning-comments": [ "warn", { terms: ["todo", "fixme", "eslint-disable"], location: "anywhere", }, ], // - A003 (criar regra no eslint como warning) "one-var": ["error", "never"], "prefer-const": "error", "prefer-spread": "error", "prefer-template": "error", "wrap-regex": "error", yoda: "error", "@typescript-eslint/adjacent-overload-signatures": "off", //getters e setters entram em conflito com a regra @typescript-eslint/member-ordering. "@typescript-eslint/array-type": "error", "@typescript-eslint/ban-ts-comment": "warn", // // @ts-ignore: Unreachable code error "@typescript-eslint/ban-tslint-comment": "error", "@typescript-eslint/class-literal-property-style": "error", "@typescript-eslint/consistent-indexed-object-style": "error", "@typescript-eslint/consistent-type-definitions": "error", "@typescript-eslint/no-confusing-non-null-assertion": "error", "@typescript-eslint/no-confusing-void-expression": [ "error", { ignoreArrowShorthand: true, }, ], "@typescript-eslint/no-dynamic-delete": "error", "@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/no-extra-semi": "error", "@typescript-eslint/no-meaningless-void-operator": "error", "@typescript-eslint/no-mixed-enums": "error", // '@typescript-eslint/no-non-null-assertion': 'warn', // falso positivo em alguns casos "@typescript-eslint/no-non-null-assertion": "off", // falso positivo em alguns casos "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error", "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error", "@typescript-eslint/no-unnecessary-condition": "off", // Pensar em solução para desativar o autofix da regra na R11 "@typescript-eslint/prefer-for-of": "error", "@typescript-eslint/prefer-includes": "error", "@typescript-eslint/prefer-literal-enum-member": "error", "@typescript-eslint/prefer-optional-chain": "error", "@typescript-eslint/prefer-string-starts-ends-with": "error", "@typescript-eslint/prefer-ts-expect-error": "error", "@typescript-eslint/promise-function-async": [ "error", { checkArrowFunctions: false }, ], "@typescript-eslint/sort-type-constituents": "warn", "@typescript-eslint/type-annotation-spacing": "error", "@angular-eslint/no-attribute-decorator": "error", "@angular-eslint/no-conflicting-lifecycle": "error", "@angular-eslint/no-forward-ref": "error", "@angular-eslint/no-lifecycle-call": "error", "@angular-eslint/no-pipe-impure": "error", "@angular-eslint/no-queries-metadata-property": "error", "@angular-eslint/relative-url-prefix": "error", "unused-imports/no-unused-imports": "error", "import/first": "error", "import/no-unused-modules": "error", }, }, { // TEST files: ["*.spec.ts"], parserOptions: { createDefaultProgram: true, project: ["tsconfig.json"], }, rules: { "no-unsafe-assignment": "off", "no-unsafe-call": "off", "no-unsafe-member-access": "off", "unbound-method": "off", "@typescript-eslint/no-unsafe-assignment": "off", "@typescript-eslint/unbound-method": "off", }, }, { // TS files: ["*.ts"], excludedFiles: "*.spec.ts", parserOptions: { createDefaultProgram: true, project: ["tsconfig.json"], }, rules: { "@typescript-eslint/consistent-type-assertions": [ "error", { assertionStyle: "as", objectLiteralTypeAssertions: "never", }, ], "@typescript-eslint/unbound-method": [ "error", { ignoreStatic: true, }, ], "max-lines-per-function": [ "warn", { max: 30, skipBlankLines: true, }, ], }, }, ], };