Repository navigation
Expand file tree
/
Copy patheslint.config.ts
More file actions
158 lines (155 loc) · 4.23 KB
/
Copy patheslint.config.ts
File metadata and controls
158 lines (155 loc) · 4.23 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
155
156
157
158
import { globalIgnores } from 'eslint/config'
import importPlugin from 'eslint-plugin-import'
import jsdoc from 'eslint-plugin-jsdoc'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
import unusedImports from 'eslint-plugin-unused-imports'
import neostandard, { resolveIgnoresFromGitignore } from 'neostandard'
const files = ['**/*.{ts,tsx}']
// Documentation is required only for the core client modules
// covering the concepts in the README:
// client options, authentication, action attempts, pagination,
// requests, and errors.
const publicApiFiles = [
'src/lib/options.ts',
'src/lib/request-options.ts',
'src/lib/resolve-action-attempt.ts',
'src/lib/seam-http-error.ts',
'src/lib/seam-http-request.ts',
'src/lib/seam-paginator.ts',
]
export default [
globalIgnores(resolveIgnoresFromGitignore()),
...neostandard({ ts: true, noStyle: true }),
{
files,
rules: {
'no-console': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
},
},
{
files,
plugins: {
'unused-imports': unusedImports,
import: importPlugin,
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
project: './tsconfig.json',
},
},
},
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{
fixStyle: 'inline-type-imports',
},
],
'import/no-duplicates': ['error', { 'prefer-inline': true }],
'import/no-cycle': [
'error',
{
ignoreExternal: true,
},
],
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['..', '../**'],
message:
'Import by path alias instead, e.g., lib/foo/bar.js or test/fixtures/blueprint.js.',
},
],
},
],
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'error',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
},
{
...jsdoc.configs['flat/recommended-typescript-error'],
files: publicApiFiles,
rules: {
...jsdoc.configs['flat/recommended-typescript-error']?.rules,
'jsdoc/require-jsdoc': [
'error',
{
publicOnly: true,
require: {
ArrowFunctionExpression: true,
ClassDeclaration: true,
ClassExpression: true,
FunctionDeclaration: true,
FunctionExpression: true,
MethodDefinition: false,
},
contexts: [
'ExportNamedDeclaration > TSInterfaceDeclaration',
'ExportNamedDeclaration > TSTypeAliasDeclaration',
'ExportNamedDeclaration > TSEnumDeclaration',
],
checkConstructors: false,
checkGetters: false,
checkSetters: false,
enableFixer: false,
},
],
'jsdoc/require-description': [
'error',
{
contexts: ['any'],
exemptedBy: ['deprecated', 'inheritdoc', 'internal', 'see'],
},
],
'jsdoc/require-param': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-yields': 'off',
// Types belong in the TypeScript type annotations, not the JSDoc tags.
'jsdoc/require-throws-type': 'off',
'jsdoc/tag-lines': ['error', 'never', { startLines: 1 }],
// Conflicts with how Prettier formats JSDoc inside union types.
'jsdoc/check-alignment': 'off',
},
},
{
files,
plugins: {
'simple-import-sort': simpleImportSort,
},
rules: {
'simple-import-sort/imports': [
'error',
{
groups: [
['^\\u0000'],
['^node:'],
['^@?\\w'],
['@seamapi/http'],
['^lib/', '^test/'],
['^'],
['^\\.'],
],
},
],
'simple-import-sort/exports': 'error',
},
},
]