-
-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy patheslint.config.mjs
More file actions
93 lines (90 loc) · 2.49 KB
/
eslint.config.mjs
File metadata and controls
93 lines (90 loc) · 2.49 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
// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de>
// SPDX-License-Identifier: CC0-1.0
/* eslint @typescript-eslint/naming-convention: off */
import { includeIgnoreFile } from '@eslint/compat';
import js from '@eslint/js';
import prettierRecommended from 'eslint-plugin-prettier/recommended';
import { defineConfig } from 'eslint/config';
import globals from 'globals';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import ts from 'typescript-eslint';
import xoReact from 'eslint-config-xo-react';
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
const gitignorePath = path.resolve(dirname, '.gitignore');
export default defineConfig([
includeIgnoreFile(gitignorePath),
js.configs.recommended,
...ts.configs.recommended,
...xoReact(),
prettierRecommended,
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.chai,
...globals.mocha,
},
},
rules: {
'react/boolean-prop-naming': [
'error',
{ rule: '^(is|has|do|use|hide|initial)[A-Z]([A-Za-z0-9]?)+' },
],
'react/jsx-sort-props': [
'error',
{
callbacksLast: true,
shorthandFirst: true,
reservedFirst: true,
},
],
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'import',
format: ['camelCase', 'PascalCase'],
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: 'function',
format: ['PascalCase', 'camelCase'],
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{
caughtErrors: 'none',
},
],
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
curly: 'error',
},
},
{
files: ['test/**/*.spec.ts'],
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
},
},
]);