-
Notifications
You must be signed in to change notification settings - Fork 19
/
.eslintrc.js
142 lines (141 loc) · 3.77 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
'use strict'
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
extends: [
'plugin:boundaries/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:storybook/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: [
'boundaries',
'import',
'jsx-a11y',
'react',
'react-hooks',
'react-compiler',
'@typescript-eslint',
'prettier',
],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'boundaries/element-types': [
'error',
{
default: 'disallow',
rules: [
{
// export
from: '@sanity/ui',
allow: ['@sanity/ui__contents'],
},
{
from: '@sanity/ui__contents',
allow: ['@sanity/ui__contents', '@sanity/ui/theme'],
},
{
// export
from: '@sanity/ui/theme',
allow: ['@sanity/ui/theme__contents'],
},
{
from: '@sanity/ui/theme__contents',
allow: ['@sanity/ui/theme__contents'],
},
],
},
],
'import/order': [
'error',
{
alphabetize: {
caseInsensitive: true,
order: 'asc',
},
},
],
'no-console': 'error',
'no-warning-comments': ['warn', {location: 'start', terms: ['todo', '@todo', 'fixme']}],
'padding-line-between-statements': [
'warn',
{blankLine: 'always', prev: '*', next: 'block'},
{blankLine: 'always', prev: '*', next: 'block-like'},
{blankLine: 'always', prev: 'const', next: 'expression'},
{blankLine: 'always', prev: 'let', next: 'expression'},
{blankLine: 'always', prev: 'var', next: 'expression'},
{blankLine: 'always', prev: 'block', next: '*'},
{blankLine: 'always', prev: 'block-like', next: '*'},
{blankLine: 'always', prev: '*', next: 'return'},
],
'react/prop-types': 'off',
'react-hooks/exhaustive-deps': 'error', // Checks effect dependencies
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-compiler/react-compiler': ['warn', {__unstable_donotuse_reportAllBailouts: true}], // Set to error once existing warnings are fixed
'react/no-unescaped-entities': 'off',
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'styled-components',
importNames: ['default'],
message: 'Please use `import {styled} from "styled-components"` instead.',
},
],
},
],
},
overrides: [
// Ignore Storybook stories and test files for the react compiler
{
files: [`**/*.stories.{js,ts,tsx}`, '**/*.test.{js,ts,tsx}'],
rules: {
'react-compiler/react-compiler': 'off',
},
},
],
settings: {
'boundaries/elements': [
{
type: '@sanity/ui',
pattern: ['exports/index.ts'],
mode: 'full',
},
{
type: '@sanity/ui__contents',
pattern: ['src/core/**/*.*'],
mode: 'full',
},
{
type: '@sanity/ui/theme',
pattern: ['exports/theme.ts'],
mode: 'full',
},
{
type: '@sanity/ui/theme__contents',
pattern: ['src/theme/**/*.*'],
mode: 'full',
},
],
'react': {version: 'detect'},
},
}