-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.ts
More file actions
105 lines (104 loc) · 3.27 KB
/
eslint.config.ts
File metadata and controls
105 lines (104 loc) · 3.27 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
import { fixupConfigRules } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import { flatConfigs as importXFlatConfig } from 'eslint-plugin-import-x';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import reactPlugin from 'eslint-plugin-react';
import { browser, es2020, node } from 'globals';
import { config, configs as tsConfigs, parser as tsParser } from 'typescript-eslint';
import type { FixupConfigArray } from '@eslint/compat';
export default config(
// Shared configs
js.configs.recommended,
...tsConfigs.recommended,
jsxA11y.flatConfigs.recommended,
importXFlatConfig.recommended,
importXFlatConfig.typescript,
eslintPluginPrettierRecommended,
...fixupConfigRules(new FlatCompat().extends('plugin:react-hooks/recommended') as FixupConfigArray),
{
files: ['**/*.{ts,tsx}'],
...reactPlugin.configs.flat.recommended,
...reactPlugin.configs.flat['jsx-runtime'],
},
// Custom config
{
ignores: ['**/build/**', '**/dist/**', '**/node_modules/**', 'chrome-extension/manifest.js'],
},
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: { jsx: true },
projectService: true,
},
globals: {
...browser,
...es2020,
...node,
chrome: 'readonly',
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'prefer-const': 'error',
'no-var': 'error',
'func-style': ['error', 'expression', { allowArrowFunctions: true }],
'no-restricted-imports': [
'error',
{
name: 'type-fest',
message: 'Please import from `@extension/shared` instead of `type-fest`.',
},
],
'arrow-body-style': ['error', 'as-needed'],
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/consistent-type-exports': 'error',
'import-x/order': [
'error',
{
'newlines-between': 'never',
alphabetize: { order: 'asc', caseInsensitive: true },
groups: ['index', 'sibling', 'parent', 'internal', 'external', 'builtin', 'object', 'type'],
pathGroups: [
{
pattern: '@*/**',
group: 'internal',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['type'],
},
],
'import-x/no-unresolved': 'off',
'import-x/no-named-as-default': 'error',
'import-x/no-named-as-default-member': 'error',
'import-x/newline-after-import': 'error',
'import-x/no-deprecated': 'error',
'import-x/no-duplicates': ['error', { considerQueryString: true, 'prefer-inline': false }],
'import-x/consistent-type-specifier-style': 'error',
'import-x/exports-last': 'error',
'import-x/first': 'error',
},
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
// Overrides Rules
{
files: ['**/packages/shared/**/*.ts'],
rules: {
'no-restricted-imports': 'off',
},
},
);