student life social platform
1/** @type {import('eslint').Linter.Config} */
2module.exports = {
3 root: true,
4 parser: '@typescript-eslint/parser',
5 plugins: ['@typescript-eslint'],
6 parserOptions: {
7 ecmaVersion: 2020,
8 project: ['./packages/*/tsconfig.json'],
9 sourceType: 'module',
10 // To enable all rules in svelte files:
11 extraFileExtensions: ['.svelte'],
12 },
13 env: { browser: true, es2017: true, node: true },
14 globals: {
15 $$Generic: 'readonly', // see https://github.com/sveltejs/svelte-eslint-parser/issues/306
16 App: 'readonly',
17 },
18 extends: [
19 'eslint:recommended',
20 'plugin:@typescript-eslint/recommended',
21 'plugin:@typescript-eslint/strict',
22 'plugin:unicorn/recommended',
23 'plugin:svelte/recommended',
24 'prettier',
25 ],
26 settings: { 'svelte/typescript': () => require('typescript') },
27 rules: {
28 'no-warning-comments': 'off',
29 '@typescript-eslint/ban-types': 'off',
30 '@typescript-eslint/consistent-type-definitions': 'off',
31 '@typescript-eslint/naming-convention': 'off',
32 '@typescript-eslint/no-non-null-assertion': 'off',
33 '@typescript-eslint/no-throw-literal': 'off',
34 '@typescript-eslint/prefer-nullish-coalescing': 'off',
35 '@typescript-eslint/no-empty-object-type': [
36 'error',
37 { allowInterfaces: 'with-single-extends' },
38 ],
39 '@typescript-eslint/no-unused-vars': [
40 'error',
41 {
42 varsIgnorePattern: '^_',
43 argsIgnorePattern: '^_',
44 },
45 ],
46 'capitalized-comments': 'off',
47 'curly': ['error', 'multi-or-nest', 'consistent'],
48 'new-cap': 'off',
49 'no-await-in-loop': 'off',
50 'no-empty-pattern': 'off',
51 'no-empty': 'warn',
52 'prefer-const': 'warn',
53 'unicorn/consistent-function-scoping': ['error', { checkArrowFunctions: false }],
54 'unicorn/expiring-todo-comments': 'off',
55 'unicorn/no-abusive-eslint-disable': 'off',
56 'unicorn/no-document-cookie': 'off',
57 'unicorn/prefer-top-level-await': 'off',
58 'unicorn/prevent-abbreviations': 'off',
59 'unicorn/no-empty-file': 'off', // TODO reenable before merging to main
60 'unicorn/no-array-callback-reference': 'off',
61 'unicorn/prefer-spread': process.argv.includes('--fix') ? 'off' : 'warn',
62 'unicorn/prefer-ternary': process.argv.includes('--fix') ? 'off' : 'warn',
63 },
64 overrides: [
65 {
66 files: ['*.ts'],
67 excludedFiles: ['packages/api/scripts/*'],
68 rules: {
69 'no-console': [
70 'error',
71 {
72 allow: ['warn', 'error', 'info', 'group', 'groupEnd'],
73 },
74 ],
75 'unicorn/no-null': 'off',
76 },
77 },
78 {
79 files: ['*.svelte'],
80 parser: 'svelte-eslint-parser',
81 parserOptions: {
82 parser: '@typescript-eslint/parser',
83 },
84 rules: {
85 '@typescript-eslint/no-unnecessary-condition': 'off',
86 '@typescript-eslint/no-unsafe-argument': 'off',
87 '@typescript-eslint/no-unsafe-assignment': 'off',
88 '@typescript-eslint/no-unsafe-call': 'off',
89 '@typescript-eslint/no-unsafe-member-access': 'off',
90 '@typescript-eslint/no-unsafe-return': 'off',
91 'no-undef-init': 'off',
92 'unicorn/consistent-destructuring': 'off',
93 'unicorn/no-useless-undefined': 'off',
94 'unicorn/filename-case': 'off',
95 'unicorn/no-null': 'off',
96 'no-console': [
97 'error',
98 {
99 allow: ['warn', 'error', 'info', 'group', 'groupEnd'],
100 },
101 ],
102 },
103 },
104 ],
105};