-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy patheslint.config.mjs
More file actions
120 lines (111 loc) · 3.6 KB
/
Copy patheslint.config.mjs
File metadata and controls
120 lines (111 loc) · 3.6 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import { configs as airbnbExtended } from 'eslint-config-airbnb-extended';
import prettierPlugin from 'eslint-plugin-prettier';
import prettierConfig from 'eslint-config-prettier';
import promisePlugin from 'eslint-plugin-promise';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import * as importXPlugin from 'eslint-plugin-import-x';
import eslintCommentsPlugin from '@eslint-community/eslint-plugin-eslint-comments';
import globals from 'globals';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [
{
ignores: [
'**/dist/**',
'**/.next/**',
'**/.tmp/**',
'**/node_modules/**',
'**/out/**',
'**/coverage/**',
'**/__tests__/**',
'**/*.snap',
'output/**',
'public/**',
'packages/site/public/**'
]
},
js.configs.recommended,
...airbnbExtended.react.typescript,
...compat.extends('plugin:@eslint-community/eslint-comments/recommended'),
prettierConfig,
{
plugins: {
prettier: prettierPlugin,
promise: promisePlugin,
react: reactPlugin,
'react-hooks': reactHooksPlugin,
'import-x': importXPlugin.default ?? importXPlugin,
'@eslint-community/eslint-comments': eslintCommentsPlugin
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.node,
...globals.browser
}
},
rules: {
'prettier/prettier': 'error',
'no-console': 'off',
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.tsx'] }],
'no-underscore-dangle': 'off',
'no-await-in-loop': 'off',
'no-continue': 'off',
'no-plusplus': 'off',
'guard-for-in': 'off',
'max-classes-per-file': 'off',
'import-x/prefer-default-export': 'off',
'react/function-component-definition': 'off',
'react/require-default-props': 'off'
}
},
...tseslint.configs.recommended.map(cfg => ({
...cfg,
files: ['**/*.ts', '**/*.tsx']
})),
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname
}
},
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/lines-between-class-members': 'off',
// Pre-existing legacy patterns across the monorepo. Demoted to warnings
// so the lint task stays green; new code is still encouraged to avoid them.
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-empty-object-type': 'warn',
'preserve-caught-error': 'off',
// Allow underscore-prefixed unused vars/args (common pattern for
// intentionally destructured-and-discarded properties).
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_'
}
]
}
}
];