-
Notifications
You must be signed in to change notification settings - Fork 74
/
.eslintrc
137 lines (132 loc) · 5.14 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"],
"ecmaVersion": 6,
"ecmaFeatures": {
"impliedStrict": true,
"jsxPragma": null // Required by @typescript/eslint-parser
}
},
"env": {
"browser": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/all",
"plugin:react/all",
"plugin:import/recommended",
"plugin:import/typescript",
"./eslint-naming-conventions.json",
],
"plugins": [
"@typescript-eslint",
"import",
// "jsx-expressions" // TODO: requires eslint 8
],
"rules": {
// Override eslint:recommended
"object-curly-spacing": "off", // Disabled in favor of @typescript-eslint/object-curly-spacing
"array-callback-return": "error",
"no-duplicate-imports": "off", // Disabled in favor of @typescript-eslint/no-duplicate-imports
"no-console": ["warn", { "allow": ["error"] }],
"sort-imports": "off", // Disabled in favor of import/order
"semi": "off", // Disabled in favor of @typescript-eslint/semi
"no-multiple-empty-lines": ["error", { "max": 1 }],
"jsx-quotes": ["error", "prefer-double"],
"array-bracket-spacing": ["error", "never"],
"lines-around-comment": ["error", {
"allowBlockStart": true
}],
// "eslint array-bracket-newline": ["error", { "multiline": true }], // TODO: requires eslint 8
// Override plugin:@typescript-eslint/all
"@typescript-eslint/object-curly-spacing": ["error", "always"],
"@typescript-eslint/quotes": ["error", "single", { "avoidEscape": true }],
"@typescript-eslint/indent": ["error", 2, { "SwitchCase": 1 }],
"@typescript-eslint/prefer-readonly-parameter-types": "off",
"@typescript-eslint/no-extra-parens": "off",
"@typescript-eslint/brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-type-alias": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/parameter-properties": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/promise-function-async": "off",
"@typescript-eslint/lines-around-comment": "off", // Disabled in favor of lines-around-comment
// Override plugin:@typescript-eslint/recommended
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/no-unused-vars": 2,
"@typescript-eslint/consistent-type-imports": 2,
"@typescript-eslint/no-duplicate-imports": "error",
// Override plugin:react/all
"react/destructuring-assignment": "off",
"react/forbid-component-props": "off",
"react/function-component-definition": "off",
"react/jsx-curly-newline": ["error", { "multiline": "forbid", "singleline": "forbid" }],
"react/jsx-filename-extension": [2, { "extensions": [".jsx", ".tsx"] }],
"react/jsx-handler-names": "off",
"react/jsx-indent-props": "off",
"react/jsx-indent": "off",
"react/jsx-max-depth": "off",
"react/jsx-max-props-per-line": ["error", { "maximum": 1, "when": "multiline" }],
"react/jsx-newline": "off",
"react/jsx-no-bind": "off",
"react/jsx-no-leaked-render": "off",
"react/jsx-no-literals": "off",
"react/jsx-one-expression-per-line": "off",
"react/jsx-sort-props": [2, {
"callbacksLast": true,
"shorthandFirst": true,
"reservedFirst": ["key"]
}],
"react/jsx-wrap-multilines": ["error", {
"declaration": "parens-new-line",
"assignment": "parens-new-line",
"return": "parens-new-line",
"arrow": "parens-new-line",
"condition": "parens-new-line",
"logical": "parens-new-line"
}],
"react/jsx-child-element-spacing": "warn",
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"react/require-default-props": "off",
"react/no-set-state": "off",
"react/no-unescaped-entities": "warn",
// From plugin import
"import/order": ["error", {
"warnOnUnassignedImports": true,
"groups": [["builtin", "external"], "internal", "index", "object", "type", ["parent", "sibling"]],
"pathGroups": [{
"pattern": "utilities/**",
"group": "internal",
// "position": "after" // TODO: enable this once "distincGroup" is available to locate utilities at the bottom of this group
},{
"pattern": "**/*.scss",
"group": "sibling",
}],
"newlines-between": "always",
// "distinctGroup": "false" // TODO: config not yet available.
}],
"import/newline-after-import": "error",
"import/no-relative-packages": "error",
"import/no-named-as-default": "off",
// From plugin jsx-expressions
// "jsx-expressions/strict-logical-expressions": "error", // Replaces rule "react/jsx-no-leaked-render" // TODO: requires eslint 8
},
"settings": {
"react": {
"version": "detect" // React version. "detect" automatically picks the version you have installed.
},
"import/resolver": {
"typescript": true
}
},
"ignorePatterns": [
"*.config.js",
"spec/javascripts/setupTests.ts",
"spec/javascripts/__mocks__/"
]
}