forked from uber/baseweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
124 lines (122 loc) · 2.96 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
/*
Copyright (c) Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
// @flow
/* eslint-env node */
module.exports = {
parser: 'babel-eslint',
plugins: [
'flowtype',
'eslint-plugin-react',
'eslint-plugin-import',
'header',
'jsx-a11y',
'prettier',
'import',
'jest',
],
env: {
jest: true,
},
globals: {
page: true,
browser: true,
context: true,
},
settings: {
react: {
version: 'detect',
},
},
extends: [
'plugin:flowtype/recommended',
'plugin:react/recommended',
require.resolve('eslint-config-uber-universal-stage-3'),
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended',
'prettier/flowtype',
],
rules: {
// Enforce flow file declarations
'flowtype/require-valid-file-annotation': ['error', 'always'],
'flowtype/space-after-type-colon': 'off',
'react/jsx-filename-extension': 0,
'react/prop-types': 0,
// Enforces imports of external modules to be declared in the package.json
'import/no-extraneous-dependencies': [
'error',
{ optionalDependencies: false, devDependencies: true },
],
// todo: after typescript migration to remove import extensions where possible
'import/extensions': 'off',
'prettier/prettier': [
'error',
{
printWidth: 100,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
trailingComma: 'es5',
bracketSpacing: true,
bracketSameLine: false,
},
],
'import/prefer-default-export': ['off'],
'header/header': [2, 'LICENSE-HEAD'],
'jsx-a11y/no-autofocus': [
2,
{
ignoreNonDOM: true,
},
],
'import/no-duplicates': 2,
'import/newline-after-import': 2,
'import/first': 2,
'dot-notation': 2,
},
overrides: [
{
files: ['*.test.js'],
rules: {
'flowtype/no-weak-types': 'off',
},
},
{
files: ['documentation-site/**/*.js'],
rules: {
'import/extensions': 'off',
'react/display-name': 'off',
},
},
{
files: ['packages/eslint-plugin-baseui/**/*.js', 'packages/baseweb-vscode-extension/**/*.js'],
rules: {
'flowtype/require-valid-file-annotation': 'off',
},
},
{
files: ['**/*.e2e.js'],
rules: {
'flowtype/require-valid-file-annotation': 'off',
},
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.d.ts'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
'flowtype/require-valid-file-annotation': 'off',
'flowtype/space-after-type-colon': 'off',
'flowtype/no-types-missing-file-annotation': 'off',
'header/header': 'off',
'import/extensions': 'off',
'cup/no-undef': 'off',
'no-unused-vars': 'off',
'no-redeclare': 'off',
},
},
],
};