-
Notifications
You must be signed in to change notification settings - Fork 12
/
.eslintrc.js
80 lines (80 loc) · 2.48 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
module.exports = {
env: {
browser: true,
es6: true,
},
globals: {
global: true,
module: true,
},
ignorePatterns: ['.eslintrc.js'],
plugins: ['unicorn'],
extends: [
'@doist/eslint-config/recommended-type-checked',
'@doist/eslint-config/simple-import-sort',
'@doist/eslint-config/react',
'plugin:storybook/recommended',
],
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
sourceType: 'module',
project: ['./tsconfig.json'],
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: ['./tsconfig.json'],
},
},
},
rules: {
// Rules no longer necessary with the new JSX Transformer
// ref: https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
// Experimental `eslint-plugin-unicorn` rules
// ref: https://github.com/Doist/eslint-config/issues/46
'unicorn/throw-new-error': 'error',
'unicorn/prefer-optional-catch-binding': 'error',
},
overrides: [
// Configure rules specific for Vitest test specifications
{
files: ['**/*.test.{j,t}s?(x)'],
plugins: ['vitest'],
extends: ['plugin:vitest-globals/recommended', 'plugin:vitest/recommended'],
env: {
'vitest-globals/env': true,
},
},
// Disable rules that conflict how configuration files are written
{
files: ['./*.config.?(m){j,t}s'],
rules: {
'import/no-default-export': 'off',
},
},
// Disable rules that are pointless for Typescript files (this shouldn't be needed, but for
// some reason `react/prop-types` is being flagged for TypeScript files)
{
files: ['./{src,stories}/**/*.tsx'],
rules: {
'react/prop-types': 'off',
},
},
// Disable rules that conflict with Storybook stories and TypeScript typings
{
files: ['./stories/**/*.{story,stories}.tsx', './typings/**/*.d.ts'],
rules: {
'func-style': 'off',
'import/no-default-export': 'off',
},
},
],
}