forked from streamlit/streamlit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc
119 lines (119 loc) · 4.21 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
"env": {
// allow using browser-defined globals like `window` and `document`
"browser": true,
"es6": true
},
"extends": [
"airbnb-typescript/base",
// Uses the recommended rules from @eslint-plugin-react
"plugin:react/recommended",
// Uses the recommended rules from the @typescript-eslint/eslint-plugin
"plugin:@typescript-eslint/recommended",
// Uses eslint-config-prettier to disable ESLint rules
// from @typescript-eslint/eslint-plugin that would conflict with prettier
"prettier/@typescript-eslint",
// Enables eslint-plugin-prettier and eslint-config-prettier.
// This will display prettier errors as ESLint errors.
// Make sure this is always the last configuration in the extends array.
"plugin:prettier/recommended"
],
// Specifies the ESLint parser
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaFeatures": {
"jsx": true // Allows for the parsing of JSX
},
// Allows for the parsing of modern ECMAScript features
"ecmaVersion": 2018,
// Allows for the use of imports
"sourceType": "module"
},
// Ignore our auto-generated code
"ignorePatterns": ["src/autogen/*"],
// Place to specify ESLint rules.
// Can be used to overwrite rules specified from the extended configs
"rules": {
// Use `const` or `let` instead of `var`
"no-var": "error",
// We don't use PropTypes
"react/prop-types": "off",
// We don't escape entities
"react/no-unescaped-entities": "off",
// Some of these are being caught erroneously
"@typescript-eslint/camelcase": "off",
// Console statements are currently allowed,
// but we may want to reconsider this!
"@typescript-eslint/no-console": "off",
// Empty interfaces are ok
"@typescript-eslint/no-empty-interface": "off",
// Empty functions are ok
"@typescript-eslint/no-empty-function": "off",
// We prefer not using `any`, but don't disallow it
"@typescript-eslint/no-explicit-any": "off",
// We prefer not using `any`, but don't disallow it (this rule
// differs from the previous one in that it requires explicit types
// for public module APIs)
"@typescript-eslint/explicit-module-boundary-types": "off",
// Don't warn about unused function params
"@typescript-eslint/no-unused-vars": ["warn", { "args": "none" }],
// It's safe to use functions before they're defined
"@typescript-eslint/no-use-before-define": [
"warn",
{ "functions": false }
],
// Functions must have return types, but we allow
// inline function expressions to omit them
"@typescript-eslint/explicit-function-return-type": [
"warn",
{ "allowExpressions": true }
],
// It's OK to use ts-ignore when we're missing type definitions
// for a JS library.
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/ban-ts-comment": "off",
// Permit for-of loops (https://stackoverflow.com/a/42237667)
"no-restricted-syntax": [
"error",
"ForInStatement",
"LabeledStatement",
"WithStatement"
],
// Allow foo.hasOwnProperty("bar")
"no-prototype-builtins": "off",
// Imports should be `import "./FooModule"`, not `import "./FooModule.js"`
// We need to configure this to check our .tsx files, see:
// https://github.com/benmosher/eslint-plugin-import/issues/1615#issuecomment-577500405
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
// Disable a bunch of AirBNB rules we're currently in violation of.
// TODO: For each one, either fix and reenable, or provide a justification.
"import/prefer-default-export": "off",
"max-classes-per-file": "off",
"no-shadow": "off",
"no-param-reassign": "off",
"no-plusplus": "off"
},
"settings": {
"react": {
// Tells eslint-plugin-react to automatically detect
// the version of React to use
"version": "detect"
},
// Check for import violation in all JS-like files
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx", ".json"]
}
}
}
}