-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
89 lines (84 loc) · 2.99 KB
/
eslint.config.js
File metadata and controls
89 lines (84 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// SPDX-FileCopyrightText: Copyright 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <john.kildea@mcgill.ca>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import globals from 'globals';
import importPlugin from 'eslint-plugin-import';
import js from '@eslint/js';
import { jsdoc } from 'eslint-plugin-jsdoc';
import mocha from 'eslint-plugin-mocha';
import stylistic from '@stylistic/eslint-plugin';
export default [
// Globally ignored directories and files, including the project's legacy code
{
ignores: [
'legacy-registration/**',
'listener/**',
],
},
// Plugin configurations
importPlugin.flatConfigs.recommended,
js.configs.recommended,
jsdoc({ config: 'flat/recommended' }),
mocha.configs.recommended,
stylistic.configs.customize({
indent: 4,
quotes: 'single',
semi: true,
jsx: true,
}),
// Main configuration
{
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.node,
},
},
rules: {
'consistent-return': 'error',
'import/exports-last': 'error',
'import/extensions': ['error', 'ignorePackages'],
'import/first': 'error',
'import/newline-after-import': 'error',
// Ignore issues with `firebase-admin/*` imports
// See: https://github.com/firebase/firebase-admin-node/discussions/1359#discussioncomment-977158
'import/no-unresolved': ['error', {
ignore: ['^firebase-admin/.+'],
}],
'no-await-in-loop': 'error',
'no-console': 'error',
'no-new': 'error',
'no-param-reassign': 'error',
'no-unused-vars': 'error',
'no-use-before-define': ['error', {
functions: false,
}],
'sort-imports': ['error', {
ignoreCase: true,
}],
'@stylistic/arrow-parens': ['error', 'as-needed'],
'@stylistic/brace-style': ['error', 'stroustrup'],
'@stylistic/max-len': ['error', 120, {
ignorePattern: '^// SPDX-FileCopyrightText:.+',
ignoreUrls: true,
}],
'@stylistic/quotes': ['error', 'single', {
avoidEscape: true,
}],
},
},
// Additional configurations for test files
{
files: ['**/*.test.js'],
rules: {
'mocha/consistent-spacing-between-blocks': 'off',
// See: https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-setup-in-describe.md
// "If you're using dynamically generated tests, you should disable this rule"
'mocha/no-setup-in-describe': 'off',
'mocha/prefer-arrow-callback': 'error',
'no-console': 'off',
},
},
];