-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
101 lines (98 loc) · 3.01 KB
/
index.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
// This is a non-ESM JS file, so this rule can't be followed.
/* eslint-disable @typescript-eslint/no-var-requires */
const {
rules: {
"@typescript-eslint/naming-convention":
airbnbTypeScriptNamingConventionRules,
},
} = require("eslint-config-airbnb-typescript/lib/shared")
const {
rules: { "no-param-reassign": airbnbNoParamReassignRules },
} = require("eslint-config-airbnb-base/rules/best-practices")
const thesisPrettierConfig = require("@thesis-co/prettier-config")
/* eslint-enable @typescript-eslint/no-var-requires */
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./.tsconfig-eslint.json",
},
plugins: ["prettier", "no-only-tests"],
extends: [
"airbnb",
"airbnb-typescript",
"airbnb/hooks",
"prettier",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended-type-checked",
],
rules: {
// Executive decision: semi-colons aren't removed by prettier for backwards
// compatibility. We don't have that requirement 🔪
semi: ["error", "never"],
// Executive decision: Don't use `backtick quotes` unless you're using
// interpolation, and prefer double quotes to single. Consistency is 🔑
quotes: [
"error",
"double",
{
avoidEscape: true,
},
],
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/quotes": [
"error",
"double",
{
avoidEscape: true,
},
],
// Add known-safe exceptions to no-param-reassign.
"no-param-reassign": [
airbnbNoParamReassignRules[0],
{
props: airbnbNoParamReassignRules[1].props,
ignorePropertyModificationsFor:
airbnbNoParamReassignRules[1].ignorePropertyModificationsFor,
ignorePropertyModificationsForRegex: [
...(airbnbNoParamReassignRules[1]
.ignorePropertyModificationsForRegex || []),
"^immer", // For redux-toolkit reducers using immer.
],
},
],
"@typescript-eslint/naming-convention": [
...airbnbTypeScriptNamingConventionRules,
// Allow underscore-only identifiers to indicate ignored positional variables.
{
selector: "variable",
format: null,
filter: {
regex: "^_+$",
match: true,
},
custom: {
regex: "^_+$",
match: true,
},
},
],
// prefer the @typescript-eslint rule to the base,
// and further allow underscore-only identifiers to indicate ignored positional
// variables, parameters, etc.
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_+$", varsIgnorePattern: "^_+$" },
],
"no-unused-vars": "off",
// .only tests being committed are typically a mistake
"no-only-tests/no-only-tests": "error",
"prettier/prettier": ["error", thesisPrettierConfig],
},
overrides: [
{
files: ["*.js"],
extends: ["plugin:@typescript-eslint/disable-type-checked"],
},
],
}