-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
89 lines (88 loc) · 2.6 KB
/
eslint.config.js
File metadata and controls
89 lines (88 loc) · 2.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
import js from '@eslint/js';
import globals from 'globals';
import pluginReact from 'eslint-plugin-react';
import pluginReactHooks from 'eslint-plugin-react-hooks';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import json from '@eslint/json';
import css from '@eslint/css';
import { defineConfig } from 'eslint/config';
export default defineConfig([
{ ignores: ['node_modules/', 'dist/', 'eslint.config.js'] },
{
files: ['**/*.{js,mjs,cjs,jsx}'],
plugins: { js, react: pluginReact, 'react-hooks': pluginReactHooks },
...js.configs.recommended,
...pluginReact.configs.flat.recommended,
...pluginReact.configs.flat['jsx-runtime'],
...pluginReactHooks.configs['recommended-latest'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 'latest',
sourceType: 'module',
},
globals: { ...globals.browser, ...globals.node },
},
settings: { react: { version: 'detect' } },
rules: {
'react/prop-types': 'off',
},
},
{
files: ['**/*.{js,mjs,cjs,jsx}'],
plugins: { '@typescript-eslint': tseslint },
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 'latest',
sourceType: 'module',
},
},
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE', 'PascalCase', 'snake_case'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{ selector: 'variable', modifiers: ['destructured'], format: null },
{
selector: 'parameter',
format: ['camelCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{ selector: 'import', format: ['camelCase', 'PascalCase'] },
{ selector: 'typeLike', format: ['PascalCase'] },
{ selector: 'function', format: ['camelCase', 'PascalCase'] },
{
selector: 'objectLiteralProperty',
format: ['camelCase', 'snake_case', 'UPPER_CASE'],
},
],
},
},
{
files: ['**/*.json'],
plugins: { json },
language: 'json/json',
extends: ['json/recommended'],
},
{
files: ['**/*.css'],
plugins: { css },
language: 'css/css',
extends: ['css/recommended'],
},
]);