-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
153 lines (150 loc) · 3.99 KB
/
Copy patheslint.config.mjs
File metadata and controls
153 lines (150 loc) · 3.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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import eslint from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import perfectionist from 'eslint-plugin-perfectionist';
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
import storybook from 'eslint-plugin-storybook';
import globals from 'globals';
import { dirname } from 'path';
import tseslint from 'typescript-eslint';
import { fileURLToPath } from 'url';
import requireRelativeJsExtension from './eslint-rules/require-relative-js-extension.mjs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.node,
...globals.es2022,
},
parserOptions: {
tsconfigRootDir: __dirname,
},
},
plugins: {
perfectionist,
},
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'no-console': ['warn', { allow: ['warn', 'error'] }],
eqeqeq: ['error', 'always'],
curly: ['error', 'all'],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'separate-type-imports',
disallowTypeAnnotations: false,
},
],
semi: ['error', 'always'],
'perfectionist/sort-imports': [
'error',
{
type: 'alphabetical',
order: 'asc',
groups: [
'type',
['builtin', 'external'],
'internal',
['parent', 'sibling', 'index'],
'style',
'unknown',
],
internalPattern: ['^@metaboost/'],
newlinesBetween: 'always',
},
],
},
},
{
files: ['scripts/**/*.js', 'scripts/**/*.mjs', 'scripts/**/*.cjs'],
rules: {
'no-console': 'off',
},
},
{
files: ['tools/**/*.js', 'tools/**/*.mjs', 'tools/**/*.cjs'],
rules: {
'no-console': 'off',
},
},
{
files: ['**/*.test.ts', '**/*.spec.ts', '**/test/**/*.ts', '**/e2e/**/*.ts'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
'no-empty-pattern': 'off',
},
},
{
files: [
'packages/**/*.{ts,tsx}',
'apps/api/**/*.{ts,tsx}',
'apps/management-api/**/*.{ts,tsx}',
'apps/web/sidecar/**/*.{ts,tsx}',
'apps/management-web/sidecar/**/*.{ts,tsx}',
'tools/**/*.{ts,tsx}',
'scripts/**/*.{ts,mts}',
],
plugins: {
nodeNextRelativeImports: {
rules: {
'require-relative-js-extension': requireRelativeJsExtension,
},
},
},
rules: {
'nodeNextRelativeImports/require-relative-js-extension': 'error',
},
},
{
files: ['packages/ui/**/*.{ts,tsx}'],
rules: {
'nodeNextRelativeImports/require-relative-js-extension': 'off',
},
},
{
files: [
'apps/web/src/**/*.{ts,tsx}',
'apps/management-web/src/**/*.{ts,tsx}',
'apps/web/e2e/**/*.{ts,tsx}',
'apps/management-web/e2e/**/*.{ts,tsx}',
],
plugins: {
nodeNextRelativeImports: {
rules: {
'require-relative-js-extension': requireRelativeJsExtension,
},
},
},
rules: {
'nodeNextRelativeImports/require-relative-js-extension': 'off',
},
},
{
ignores: [
'**/dist/**',
'**/node_modules/**',
'**/.next/**',
'**/*.js',
'**/*.d.ts',
'**/.llm/**',
'**/*.md',
'**/*.mdc',
],
},
eslintConfigPrettier,
storybook.configs['flat/recommended']
);