-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
94 lines (94 loc) · 3.33 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
module.exports = {
env: {
browser: true,
es2021: true, // includes setting of 'parserOptions.ecmaVersion' to 12
},
extends: [
"airbnb",
"airbnb/hooks",
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"prettier",
],
plugins: ["react", "import", "jest"],
rules: {
"import/no-extraneous-dependencies": "off",
"import/prefer-default-export": "off",
"react/function-component-definition": "off", // see https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
"react/jsx-props-no-spreading": "off", // see https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
"react/style-prop-object": [
"error",
{
allow: ["FormattedNumber"], // allow 'style' property for react-intl component as it isn't CSS 'styles' property
},
],
},
overrides: [
{
// typescript settings
files: ["**/*.ts", "**/*.tsx"],
extends: [
"airbnb",
"airbnb-typescript",
"airbnb/hooks",
"plugin:@typescript-eslint/recommended-type-checked",
// "plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier",
],
parser: "@typescript-eslint/parser",
parserOptions: {
// project: true,
project: [
"./tsconfig.eslint.json",
"./packages/*/tsconfig.json",
"./apps/*/tsconfig.json",
],
ecmaFeatures: {
jsx: true,
},
},
plugins: ["@typescript-eslint", "react", "react-hooks", "import"],
rules: {
"import/no-unresolved": "error",
"import/no-extraneous-dependencies": "off",
"import/prefer-default-export": "off",
"react/function-component-definition": "off", // see https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
"react/jsx-props-no-spreading": "off", // see https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
"react/require-default-props": "off", // Typescript will set undefined for the default value (see https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md)
},
settings: {
// see https://github.com/import-js/eslint-import-resolver-typescript#configuration
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: { alwaysTryTypes: true }, // this loads <rootdir>/tsconfig.json to eslint
},
},
},
{
extends: ["plugin:@typescript-eslint/disable-type-checked"],
files: ["./**/*.stories.ts"],
},
{
// turn off nasty warnings/errors for non app files
files: [
"**/*.stories.{js,jsx,ts,tsx}",
"**/*.config.{js,jsx,ts,tsx}",
"**/*.test.{js,jsx,ts,tsx}",
],
rules: {
"import/no-extraneous-dependencies": "off",
"no-console": "off",
},
},
],
};