forked from connectrpc/connect-query-es
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
135 lines (130 loc) · 4.52 KB
/
.eslintrc.js
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
// Copyright 2021-2023 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** @type { import('@typescript-eslint/utils/dist/index').TSESLint.Linter.Config } */
const config = {
env: {
browser: true,
es2021: true,
node: true,
},
ignorePatterns: ["node_modules/**", "packages/**/coverage"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
plugins: [
"@typescript-eslint",
"jsdoc",
"jest",
"import",
"simple-import-sort",
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/all",
"plugin:eslint-comments/recommended",
"plugin:jest/recommended",
"plugin:react-hooks/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier",
],
settings: {
jsdoc: {
mode: "typescript",
noDefaultExampleRules: false,
checkProperties: true,
minLines: 1,
},
"import/resolver": {
typescript: {},
},
},
rules: {
"eslint-comments/no-unused-enable": "error",
"eslint-comments/no-unused-disable": "error",
"eslint-comments/no-aggregating-enable": "off",
"eslint-comments/require-description": [
"error",
{
ignore: ["eslint-enable"],
},
],
"@typescript-eslint/naming-convention": "off", // not realistic, and this exact line is a great example of why
"@typescript-eslint/prefer-readonly-parameter-types": "off", // not realistic
"@typescript-eslint/explicit-module-boundary-types": "off", // inference and conformance testing cover this well
"@typescript-eslint/explicit-function-return-type": "off", // inference and conformance testing cover this well
"@typescript-eslint/no-unused-expressions": "off", // necessary component of some exports, e.g. DisableQuery
"@typescript-eslint/no-type-alias": "off", // this rule turns off things that are absolutely required by this project such as conditional types and literals
"@typescript-eslint/no-throw-literal": "off", // unfortunately this rule doesn't understand returns from `unreachableCase`
"@typescript-eslint/no-magic-numbers": "off", // literal values are used in CSS-in-JS, tests, and library constants
"@typescript-eslint/prefer-destructuring": "off", // Added in 6.8.0, causing an issue in linting
"@typescript-eslint/ban-ts-comment": [
"error",
{ "ts-expect-error": { descriptionFormat: "^\\(\\d+\\) .+$" } },
],
"jsdoc/require-jsdoc": [
"error",
{
contexts: [
"TSTypeAliasDeclaration",
{ context: "TSPropertySignature", inlineCommentBlock: true },
],
publicOnly: true,
require: { ArrowFunctionExpression: true },
},
],
"simple-import-sort/imports": "error",
},
overrides: [
{
extends: ["plugin:@typescript-eslint/disable-type-checked"],
files: ["**/*.js"],
rules: {
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-var-requires": "off",
},
},
{
extends: ["plugin:@typescript-eslint/disable-type-checked"],
files: ["**/*.d.ts"],
},
{
files: ["**/*.test.ts", "**/*.test.tsx", "jest.config.ts"],
rules: {
"@typescript-eslint/no-empty-function": "off", // noops are commonly needed in tests
"@typescript-eslint/unbound-method": "off", // functors are commonly necessary for tests
"@typescript-eslint/no-unused-vars": [
"error",
{
vars: "all",
varsIgnorePattern: "ExpectType_.*", // necessary for TypeScript type tests
argsIgnorePattern: "_",
},
],
},
},
{
files: ["**/eliza/*", "**/gen/**", "**/snapshots/**"], // generated code
rules: {
"eslint-comments/no-unused-enable": "off",
"eslint-comments/no-unused-disable": "off",
"eslint-comments/disable-enable-pair": "off",
"eslint-comments/no-unlimited-disable": "off",
"eslint-comments/require-description": "off",
},
},
],
};
module.exports = config;