UNPKG

eslint-config-brf

Version:

brf lint custom configurations

208 lines (207 loc) 6.8 kB
module.exports = { plugins: ["import", "unused-imports"], overrides: [ { // GLOBAL files: ["*.ts"], parserOptions: { createDefaultProgram: true, project: ["tsconfig.json"], }, rules: { "array-bracket-spacing": ["error", "never"], "arrow-spacing": [ "error", { before: true, after: true, }, ], "brace-style": "warn", // 1tbs, singleLine false "comma-spacing": [ "error", { after: true, before: false, }, ], "comma-dangle": "warn", curly: "error", // - B009 (automatizar via eslint) "func-call-spacing": ["error", "never"], indent: [ "error", "tab", { SwitchCase: 1, }, ], "key-spacing": [ "error", { beforeColon: false, afterColon: true, mode: "strict", }, ], "keyword-spacing": [ "error", { before: true, after: true, }, ], // - B029 (automatizar via node ou eslint/prettier) "no-multiple-empty-lines": [ "error", { max: 1, maxBOF: 0, maxEOF: 0, }, ], // - B008 (automatizar via eslint) "no-mixed-spaces-and-tabs": "warn", "no-multi-spaces": "error", "no-trailing-spaces": "error", "no-whitespace-before-property": "error", "object-curly-newline": [ "off", //entra em conflito com o prettier { ImportDeclaration: "never", ExportDeclaration: "never", }, ], // - B027 (automatizar via eslint) "object-curly-spacing": ["error", "always"], quotes: ["error", "single"], semi: ["error", "always"], "semi-spacing": [ "error", { after: true, before: false, }, ], "space-before-blocks": [ "error", { classes: "always", functions: "always", keywords: "always", }, ], // - B029 (automatizar via node ou eslint/prettier) "space-in-parens": ["error", "never"], "space-infix-ops": "error", "switch-colon-spacing": [ "error", { before: false, after: true, }, ], "block-spacing": "off", "@typescript-eslint/block-spacing": "error", "no-extra-parens": "off", "padding-line-between-statements": "off", "@typescript-eslint/padding-line-between-statements": [ "warn", { blankLine: "always", prev: "import", next: "*" }, { blankLine: "never", prev: "import", next: "import" }, { blankLine: "always", prev: ["const", "let", "var", "type"], next: "*", }, { blankLine: "never", prev: ["const", "let", "var", "type"], next: ["const", "let", "var", "type"], }, // { 'blankLine': 'always', 'prev': 'expression', 'next': '*' }, // { 'blankLine': 'never', 'prev': 'expression', 'next': 'expression' }, { blankLine: "always", prev: "*", next: "if" }, { blankLine: "always", prev: "*", next: "for" }, { blankLine: "always", prev: "*", next: "switch" }, { blankLine: "always", prev: "*", next: "while" }, { blankLine: "always", prev: "*", next: "do" }, { blankLine: "always", prev: "*", next: "try" }, { blankLine: "always", prev: "*", next: "throw" }, { blankLine: "always", prev: "*", next: "block-like" }, { blankLine: "always", prev: "*", next: "block" }, { blankLine: "always", prev: "*", next: "class" }, { blankLine: "always", prev: "*", next: "return" }, { blankLine: "always", prev: "if", next: "*" }, { blankLine: "always", prev: "for", next: "*" }, { blankLine: "always", prev: "switch", next: "*" }, { blankLine: "always", prev: "while", next: "*" }, { blankLine: "always", prev: "do", next: "*" }, { blankLine: "always", prev: "try", next: "*" }, { blankLine: "always", prev: "throw", next: "*" }, { blankLine: "always", prev: "block-like", next: "*" }, { blankLine: "always", prev: "block", next: "*" }, { blankLine: "always", prev: "class", next: "*" }, ], // - B019, B022 e B031 (verificar possibilidade de automatizar via eslint ou node) "@typescript-eslint/lines-between-class-members": [ "error", { enforce: [ { blankLine: "always", prev: "*", next: "field" }, { blankLine: "never", prev: "field", next: "field" }, { blankLine: "always", prev: "*", next: "method" }, ], }, ], // - B019 e B033 (verificar possibilidade de automatizar via eslint ou node) "import/order": [ "error", { "newlines-between": "never", }, ], // '@angular-eslint/sort-lifecycle-methods': 'error', // Tem que atualizar a versão mais nova do @angular-eslint "@angular-eslint/use-lifecycle-interface": "error", "@angular-eslint/sort-ngmodule-metadata-arrays": "warn", }, }, { // TEST files: ["*.spec.ts"], parserOptions: { createDefaultProgram: true, project: ["tsconfig.json"], }, rules: {}, }, { // TS files: ["*.ts"], excludedFiles: "*.spec.ts", parserOptions: { createDefaultProgram: true, project: ["tsconfig.json"], }, rules: { "@typescript-eslint/member-ordering": [ "error", { default: [ "signature", "call-signature", "private-field", "protected-field", "public-field", "field", "public-constructor", "protected-constructor", "private-constructor", "constructor", "static-initialization", "get", // Não encaixaram legal, visto que encaram métodos de evento como publicos. "set", // Não encaixaram legal, visto que encaram métodos de evento como publicos. "public-method", "protected-method", "private-method", "method", ], }, ], // - B021 (automatizar via eslint) }, }, ], };