-
-
Notifications
You must be signed in to change notification settings - Fork 679
Expand file tree
/
Copy pathxo.config.js
More file actions
154 lines (151 loc) · 4.28 KB
/
xo.config.js
File metadata and controls
154 lines (151 loc) · 4.28 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
154
// @ts-check
import tseslint from 'typescript-eslint';
import {importPathRule} from './lint-rules/import-path.js';
import {sourceFilesExtensionRule} from './lint-rules/source-files-extension.js';
import {requireExportedTypesRule} from './lint-rules/require-exported-types.js';
import {requireExportRule} from './lint-rules/require-export.js';
import {validateJSDocCodeblocksRule} from './lint-rules/validate-jsdoc-codeblocks.js';
import {jsdocCodeblocksProcessor} from './lint-processors/jsdoc-codeblocks.js';
/** @type {import('xo').FlatXoConfig} */
const xoConfig = [
{
rules: {
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-redeclare': 'off',
'@typescript-eslint/no-confusing-void-expression': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-restricted-types': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/no-deprecated': 'off',
'@typescript-eslint/no-wrapper-object-types': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/unified-signatures': 'off', // Temp
'@typescript-eslint/no-unnecessary-type-arguments': 'off',
'@typescript-eslint/no-unsafe-type-assertion': 'off',
'@stylistic/quote-props': 'off',
'@stylistic/function-paren-newline': 'off',
'@stylistic/object-curly-newline': 'off',
'@stylistic/curly-newline': 'off',
'@stylistic/operator-linebreak': ['error', 'before', {overrides: {'=': 'after'}}],
'n/file-extension-in-import': 'off',
'object-curly-newline': [
'error',
{
multiline: true,
consistent: true,
},
],
'import-x/consistent-type-specifier-style': [
'error',
'prefer-top-level',
],
},
},
{
files: ['source/**/*.d.ts', 'index.d.ts'],
rules: {
'no-restricted-imports': [
'error',
{
paths: ['tsd', 'expect-type'],
},
],
'unicorn/require-module-specifiers': 'off',
},
},
{
files: 'test-d/**/*.ts',
rules: {
'unicorn/no-immediate-mutation': 'off',
'require-unicode-regexp': 'off',
},
},
{
plugins: {
'type-fest': {
rules: {
'import-path': importPathRule,
'source-files-extension': sourceFilesExtensionRule,
'require-exported-types': requireExportedTypesRule,
'require-export': requireExportRule,
'validate-jsdoc-codeblocks': validateJSDocCodeblocksRule,
},
processors: {
'jsdoc-codeblocks': jsdocCodeblocksProcessor,
},
},
},
},
{
files: ['source/**/*.d.ts', 'test-d/**/*.ts', 'index.d.ts'],
rules: {
'type-fest/import-path': 'error',
},
},
{
files: 'source/**/*',
rules: {
'type-fest/source-files-extension': 'error',
},
},
{
files: 'source/**/*.d.ts',
ignores: ['source/internal/**/*.d.ts'],
rules: {
'type-fest/require-exported-types': 'error',
'type-fest/require-export': 'error',
'type-fest/validate-jsdoc-codeblocks': 'error',
},
},
// Register processor for all source `.d.ts` files
{
files: 'source/**/*.d.ts',
processor: 'type-fest/jsdoc-codeblocks',
},
{
// Virtual files created by the `jsdoc-codeblocks` processor
files: 'source/**/*.d.ts/*.ts',
...tseslint.configs.disableTypeChecked,
},
{
// Virtual files created by the `jsdoc-codeblocks` processor
files: 'source/**/*.d.ts/*.ts',
rules: {
'type-fest/source-files-extension': 'off',
'@stylistic/eol-last': 'off',
'capitalized-comments': 'off',
'unicorn/prefer-structured-clone': 'off',
'unicorn/no-immediate-mutation': 'off',
},
},
{
// Virtual files created by the `jsdoc-codeblocks` processor
files: ['source/is-float.d.ts/*.ts', 'source/is-integer.d.ts/*.ts', 'source/numeric.d.ts/*.ts'],
rules: {
'unicorn/no-zero-fractions': 'off',
},
},
{
// Virtual files created by the `jsdoc-codeblocks` processor
files: ['source/find-global-type.d.ts/*.ts', 'source/jsonify.d.ts/*.ts', 'source/simplify.d.ts/*.ts'],
rules: {
'@typescript-eslint/consistent-type-definitions': 'off',
},
},
{
files: 'lint-rules/test-utils.js',
rules: {
'no-irregular-whitespace': [
'error',
{
'skipComments': true,
},
],
},
},
];
export default xoConfig;