forked from grafana/pyroscope
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
125 lines (119 loc) · 3.38 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
125
const path = require('path');
module.exports = {
plugins: ['prettier', 'css-modules', 'import'],
extends: [
'airbnb-typescript-prettier',
'plugin:cypress/recommended',
'plugin:import/typescript',
'prettier',
'prettier/react',
'plugin:css-modules/recommended',
],
rules: {
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-shadow': 'warn',
// https://stackoverflow.com/questions/63818415/react-was-used-before-it-was-defined/64024916#64024916
'no-use-before-define': ['off'],
'@typescript-eslint/no-use-before-define': 'warn',
// react functional components are usually written using PascalCase
'@typescript-eslint/naming-convention': [
'warn',
{ selector: 'function', format: ['PascalCase', 'camelCase'] },
],
'@typescript-eslint/no-empty-function': 'warn',
'@typescript-eslint/no-var-requires': 'warn',
'react-hooks/exhaustive-deps': 'warn',
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'no-param-reassign': ['warn'],
'no-case-declarations': ['warn'],
'no-restricted-globals': ['warn'],
'react/button-has-type': ['warn'],
'react/prop-types': ['off'],
'jsx-a11y/heading-has-content': ['warn'],
'jsx-a11y/control-has-associated-label': ['warn'],
'no-undef': ['warn'],
'jsx-a11y/mouse-events-have-key-events': ['warn'],
'jsx-a11y/click-events-have-key-events': ['warn'],
'jsx-a11y/no-static-element-interactions': ['warn'],
'jsx-a11y/label-has-associated-control': [
'error',
{
required: {
some: ['nesting', 'id'],
},
},
],
'react/jsx-filename-extension': [1, { extensions: ['.tsx', '.ts'] }],
'import/extensions': [
'error',
'always',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'spaced-comment': [2, 'always', { exceptions: ['*'] }],
'react/require-default-props': 'off',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/*.spec.jsx',
'**/*.spec.ts',
'**/*.spec.tsx',
'**/*.stories.tsx',
],
packageDir: [
// TODO compute this dynamically
path.resolve(__dirname, 'packages/pyroscope-flamegraph'),
process.cwd(),
],
},
],
// otherwise it conflincts with ts411
'dot-notation': 'off',
// disable relative imports to force people to use '@webapp'
'import/no-relative-packages': 'error',
},
env: {
browser: true,
// node: true,
jquery: true,
},
// parserOptions: {
// project: './tsconfig.eslint.json',
// },
settings: {
'import/internal-regex': '^@pyroscope',
'import/resolver': {
'eslint-import-resolver-lerna': {
packages: path.resolve(__dirname, 'packages'),
},
webpack: {
config: path.join(__dirname, 'scripts/webpack/webpack.common.ts'),
},
},
},
overrides: [
// Tests are completely different
// And we shouldn't be so strict
{
files: ['**/?(*.)+(spec|test).+(ts|tsx|js)'],
plugins: ['jest'],
env: {
node: true,
'jest/globals': true,
},
},
],
ignorePatterns: ['dist', 'public'],
globals: {
// see ./lib/alias.d.ts
ShamefulAny: true,
},
parserOptions: {
project: ['./tsconfig.json'],
},
};