-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxo.config.mjs
More file actions
106 lines (103 loc) · 2.47 KB
/
xo.config.mjs
File metadata and controls
106 lines (103 loc) · 2.47 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
import pluginAva from 'eslint-plugin-ava'; // eslint-disable-line import-x/no-extraneous-dependencies, n/no-extraneous-import
// The AVA rules resolve the AVA config, however we have many fake AVA configs in the fixtures and so the rules must
// be disabled for those files. This sets up a rules config that does so, based on the recommended rules.
const disabledAvaRules = Object.fromEntries(Object.keys(pluginAva.configs['flat/recommended'].rules).map(rule => [rule, 'off']));
/** @type {import('xo').FlatXoConfig} */
const xoConfig = [
{
ignores: [
'test/line-numbers/fixtures/line-numbers.js',
'test-tap/fixture/snapshots/test-sourcemaps/build/**',
'test-tap/fixture/report/edgecases/ast-syntax-error.cjs',
'test-tap/fixture/**/*.ts',
'test-types',
'examples/typescript-*/**/*.ts',
],
},
{
rules: {
'import-x/order': [
'error',
{
alphabetize: {
order: 'asc',
},
'newlines-between': 'always',
},
],
'import-x/newline-after-import': 'error',
'unicorn/require-post-message-target-origin': 'off',
'unicorn/prefer-event-target': 'off',
'unicorn/prevent-abbreviations': 'off',
},
},
{
files: '**/*.d.*(c|m)ts',
rules: {
'import-x/extensions': 'off',
'n/file-extension-in-import': 'off',
},
},
{
files: 'examples/**',
rules: {
'ava/no-ignored-test-files': 'off',
'ava/no-only-test': 'off',
},
},
{
files: [
'test/**/fixtures/**',
'test-tap/fixture/**',
],
rules: {
...disabledAvaRules,
'import-x/no-extraneous-dependencies': 'off',
'n/no-extraneous-import': 'off',
'unicorn/no-empty-file': 'off',
'unicorn/no-anonymous-default-export': 'off',
},
},
{
files: 'test-types/**',
rules: {
'ava/assertion-arguments': 'off',
'ava/no-ignored-test-files': 'off',
'ava/no-skip-assert': 'off',
'ava/use-t': 'off',
},
},
{
// TODO: Update tests.
files: 'test/**',
rules: {
'import-x/no-anonymous-default-export': 'off',
'n/prefer-global/process': 'off',
},
},
{
files: 'test/**/fixtures/**',
rules: {
'n/file-extension-in-import': 'off',
},
},
{
// TODO: Update tests.
files: 'test/snapshot-*/fixtures/**',
rules: {
'unicorn/prefer-module': 'off',
},
},
{
// TODO: Update tests.
files: 'test-tap/**',
rules: {
'import-x/no-anonymous-default-export': 'off',
'max-lines': 'off',
'n/prefer-global/process': 'off',
'promise/prefer-await-to-then': 'off',
'unicorn/error-message': 'off',
},
},
];
export default xoConfig;