/
.eslintrc.js
101 lines (93 loc) · 2.59 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
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: ['next', '@smartive/eslint-config/react'],
root: true,
plugins: ['validate-filename'],
rules: {
// still needed for: interactive-quiz.tsx, salary-calculator.tsx, get-meta.ts.
// fixes for these eslint rules will be done in a separate PR - parallel to xstate upgrade
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-base-to-string': 'warn',
'validate-filename/naming-rules': [
'error',
{
rules: [
{
case: 'kebab',
target: '**/**',
// validate-filename doesn't support filenames which start with a number e.g. `blobs/1.tsx`
excludes: ['blobs'],
},
],
},
],
'react/forbid-component-props': [
'error',
{
forbid: [
{
propName: 'className',
allowedFor: [
'Blob',
'ParallaxBlob',
'Tag',
'AvatarFallback',
// 3rd Party Exceptions
// guetzli
'ArrowUp',
'Heading1',
'Heading2',
'Heading3',
'Clock',
'Calendar',
'Label',
'Textarea',
'Input',
'Logo',
'Copy',
'Grid',
'ChevronRight',
// dato
'DatoImage',
'DatoVideoPlayer',
// next
'NextImage',
'NextLink',
// scrollex
'Scroll.Container',
'Scroll.Item',
// /10 page
'Section',
// three js
'Canvas',
],
message: 'Avoid using className',
},
],
},
],
},
ignorePatterns: ['.eslintrc.js', '*.config.js', 'test/check-page-errors.js'],
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/no-explicit-any': ['warn'],
// react-datocms - Image component has no alt property
'jsx-a11y/alt-text': [
2,
{
elements: ['img', 'object', 'area', 'input[type="image"]'],
object: ['Object'],
area: ['Area'],
'input[type="image"]': ['InputImage'],
},
],
},
},
],
};