blob: c7560a7896914a4ac803b1025535da2755154ab9 [file] [log] [blame]
simon0e225ca2022-10-05 22:13:34 -04001/*
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
19const 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
46module.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 {
Larbi Gharibb38e3542022-12-07 06:09:10 -050063 files: ['**/*.test.{js,jsx,ts,tsx}', '**/*.cy.{js,jsx,ts,tsx}'],
simon0e225ca2022-10-05 22:13:34 -040064 env: {
65 jest: true,
Larbi Gharibb38e3542022-12-07 06:09:10 -050066 'cypress/globals': true,
simon0e225ca2022-10-05 22:13:34 -040067 },
68 },
69 ],
70 parser: '@typescript-eslint/parser',
71 parserOptions: {
72 ecmaVersion: 'latest',
73 sourceType: 'module',
74 },
Larbi Gharibb38e3542022-12-07 06:09:10 -050075 plugins: ['@typescript-eslint', 'header', 'html', 'simple-import-sort', 'unused-imports', 'cypress'],
simon0e225ca2022-10-05 22:13:34 -040076 rules: {
77 '@typescript-eslint/ban-ts-comment': 'off',
78 '@typescript-eslint/no-empty-function': 'off',
79 '@typescript-eslint/no-explicit-any': 'off',
Misha Krieger-Raynauldb933fbb2022-11-15 15:11:09 -050080 '@typescript-eslint/no-non-null-assertion': 'off',
simon0e225ca2022-10-05 22:13:34 -040081 '@typescript-eslint/no-unused-vars': 'off',
simon6c2a63d2022-10-11 13:51:29 -040082 camelcase: 'error',
simon73ef58d2022-10-27 00:25:55 -040083 eqeqeq: ['error', 'smart'],
simon0e225ca2022-10-05 22:13:34 -040084 'header/header': header,
85 'no-constant-condition': ['error', { checkLoops: false }],
86 'simple-import-sort/exports': 'warn',
87 'simple-import-sort/imports': 'warn',
88 'unused-imports/no-unused-imports': 'error',
89 'unused-imports/no-unused-vars': [
90 'warn',
simon4e7445c2022-11-16 21:18:46 -050091 { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_', ignoreRestSiblings: true },
simon0e225ca2022-10-05 22:13:34 -040092 ],
93 },
94};