forked from vanilla/vanilla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
101 lines (92 loc) · 4.02 KB
/
.eslintrc
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
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "@vanilla", "react", "react-hooks", "jsx-a11y", "lodash", "@tanstack/query"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:@typescript-eslint/recommended",
// "plugin:jsx-a11y/recommended",
"prettier",
"prettier/react",
"prettier/@typescript-eslint",
"plugin:@tanstack/eslint-plugin-query/recommended"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
// Just distasteful
"no-prototype-builtins": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"no-self-assign": "off",
"no-case-declarations": "off",
"prefer-const": "off",
"require-atomic-updates": "off",
"react/prop-types": "off", // We use typescript
// We have typescript for these.
"no-undef": "off",
"getter-return": "off",
"no-dupe-class-members": "off",
// General JS restrictions
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-debugger": ["error"],
"no-alert": ["error"],
// Typescript specific rules
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"Object": "Avoid using the `Object` type. Did you mean `object`?",
"Function": "Avoid using the `Function` type. Prefer a specific function type, like `() => void`.",
"Boolean": "Avoid using the `Boolean` type. Did you mean `boolean`?",
"Number": "Avoid using the `Number` type. Did you mean `number`?",
"String": "Avoid using the `String` type. Did you mean `string`?",
"Symbol": "Avoid using the `Symbol` type. Did you mean `symbol`?",
"object": false,
"{}": false
}
}
],
"@typescript-eslint/array-type": ["error", { "default": "array-simple" }],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-object-literal-type-assertion": "off",
"@typescript-eslint/no-var-requires": "off",
// These are currently too strict to enable here
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-function-return-type": "off",
// A11Y
"jsx-a11y/html-has-lang": "off", // https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/565
"react/jsx-no-target-blank": "off", // Our <SmartLink /> handles this. Detection is janky.
// I want to be able to turn these on the future.
// but they each have a lot of files to fix and should be their own PR.
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/await-thenable": "off",
"@typescript-eslint/promise-function-async": "off",
// React hooks
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
// Vanilla Custom
"@vanilla/no-unconventional-imports": "error",
"@vanilla/no-cloud-imports-in-core": "error",
// Lodash
// Ensure we always do single package lodash imports.
// Eg. import debounce from "lodash-es/debounce"
"lodash/import-scope": ["error", "method"]
}
}