simon | 0e225ca | 2022-10-05 22:13:34 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2022 Savoir-faire Linux Inc. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU Affero General Public License as |
| 6 | * published by the Free Software Foundation; either version 3 of the |
| 7 | * License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU Affero General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Affero General Public |
| 15 | * License along with this program. If not, see |
| 16 | * <https://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | const header = [ |
| 20 | 'error', |
| 21 | 'block', |
| 22 | [ |
| 23 | '', |
| 24 | { |
| 25 | pattern: ' \\* Copyright \\(C\\) (\\d{4}|(\\d{4}-\\d{4})) Savoir-faire Linux Inc\\.', |
| 26 | template: ` * Copyright (C) ${new Date().getFullYear()} Savoir-faire Linux Inc.`, |
| 27 | }, |
| 28 | ' *', |
| 29 | ' * This program is free software; you can redistribute it and/or modify', |
| 30 | ' * it under the terms of the GNU Affero General Public License as', |
| 31 | ' * published by the Free Software Foundation; either version 3 of the', |
| 32 | ' * License, or (at your option) any later version.', |
| 33 | ' *', |
| 34 | ' * This program is distributed in the hope that it will be useful,', |
| 35 | ' * but WITHOUT ANY WARRANTY; without even the implied warranty of', |
| 36 | ' * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the', |
| 37 | ' * GNU Affero General Public License for more details.', |
| 38 | ' *', |
| 39 | ' * You should have received a copy of the GNU Affero General Public', |
| 40 | ' * License along with this program. If not, see', |
| 41 | ' * <https://www.gnu.org/licenses/>.', |
| 42 | ' ', |
| 43 | ], |
| 44 | ]; |
| 45 | |
| 46 | module.exports = { |
| 47 | env: { |
| 48 | browser: true, |
| 49 | es2021: true, |
| 50 | node: true, |
| 51 | }, |
| 52 | extends: [ |
| 53 | 'eslint:recommended', |
| 54 | 'plugin:@typescript-eslint/recommended', |
| 55 | /* TODO: Enable these configs once the project is fully converted to typescript */ |
| 56 | // "plugin:@typescript-eslint/recommended-requiring-type-checking", |
| 57 | // "plugin:@typescript-eslint/strict", |
| 58 | 'prettier', |
| 59 | ], |
| 60 | ignorePatterns: ['node_modules/', 'dist/', 'daemon/', 'test/'], |
| 61 | overrides: [ |
| 62 | { |
| 63 | files: ['**/*.test.{js,jsx,ts,tsx}'], |
| 64 | env: { |
| 65 | jest: true, |
| 66 | }, |
| 67 | }, |
| 68 | ], |
| 69 | parser: '@typescript-eslint/parser', |
| 70 | parserOptions: { |
| 71 | ecmaVersion: 'latest', |
| 72 | sourceType: 'module', |
| 73 | }, |
simon | d8ca2f2 | 2022-10-11 23:30:55 -0400 | [diff] [blame] | 74 | plugins: ['@typescript-eslint', 'header', 'html', 'simple-import-sort', 'unused-imports'], |
simon | 0e225ca | 2022-10-05 22:13:34 -0400 | [diff] [blame] | 75 | rules: { |
| 76 | '@typescript-eslint/ban-ts-comment': 'off', |
| 77 | '@typescript-eslint/no-empty-function': 'off', |
| 78 | '@typescript-eslint/no-explicit-any': 'off', |
Misha Krieger-Raynauld | b933fbb | 2022-11-15 15:11:09 -0500 | [diff] [blame] | 79 | '@typescript-eslint/no-non-null-assertion': 'off', |
simon | 0e225ca | 2022-10-05 22:13:34 -0400 | [diff] [blame] | 80 | '@typescript-eslint/no-unused-vars': 'off', |
simon | 6c2a63d | 2022-10-11 13:51:29 -0400 | [diff] [blame] | 81 | camelcase: 'error', |
simon | 73ef58d | 2022-10-27 00:25:55 -0400 | [diff] [blame] | 82 | eqeqeq: ['error', 'smart'], |
simon | 0e225ca | 2022-10-05 22:13:34 -0400 | [diff] [blame] | 83 | 'header/header': header, |
| 84 | 'no-constant-condition': ['error', { checkLoops: false }], |
| 85 | 'simple-import-sort/exports': 'warn', |
| 86 | 'simple-import-sort/imports': 'warn', |
| 87 | 'unused-imports/no-unused-imports': 'error', |
| 88 | 'unused-imports/no-unused-vars': [ |
| 89 | 'warn', |
simon | 4e7445c | 2022-11-16 21:18:46 -0500 | [diff] [blame] | 90 | { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_', ignoreRestSiblings: true }, |
simon | 0e225ca | 2022-10-05 22:13:34 -0400 | [diff] [blame] | 91 | ], |
| 92 | }, |
| 93 | }; |