-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.eslintrc.js
95 lines (80 loc) · 1.95 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
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require("path");
module.exports = {
parser: "@typescript-eslint/parser",
ignorePatterns: ["_extras", "_release", "dist", "node_modules"],
extends: [
"eslint:recommended",
"plugin:jest/recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"airbnb",
"airbnb/hooks",
"plugin:prettier/recommended",
],
env: {
es2020: true,
browser: true,
node: true,
},
rules: {
camelcase: "off",
"no-use-before-define": "off",
"react/jsx-filename-extension": [1, { extensions: [".tsx"] }],
"@typescript-eslint/no-use-before-define": ["error"],
"import/no-extraneous-dependencies": "off",
"import/prefer-default-export": "off",
"import/extensions": [
"error",
"ignorePackages",
{ ts: "never", tsx: "never" },
],
"react/function-component-definition": [
2,
{ namedComponents: "arrow-function" },
],
},
overrides: [
{
files: ["**/*.d.ts", "**/types.ts"],
rules: { "no-unused-vars": "off" },
},
{
files: ["**/*.tsx"],
rules: { "react/prop-types": "off" },
},
],
settings: {
"import/resolver": {
webpack: {
config: {
externals: {
lodash: "lodash",
react: "React",
"react-dom": "ReactDOM",
"@wordpress/block-editor": "wp.blockEditor",
"@wordpress/blocks": "wp.blocks",
"@wordpress/components": "wp.components",
"@wordpress/data": "wp.data",
"@wordpress/edit-post": "wp.editPost",
"@wordpress/element": "wp.element",
"@wordpress/hooks": "wp.hooks",
"@wordpress/i18n": "wp.i18n",
"@wordpress/plugins": "wp.plugins",
"@wordpress/rich-text": "wp.richText",
},
resolve: {
alias: {
"@/types": path.resolve(__dirname, "types"),
"@": path.resolve(__dirname, "src"),
},
extensions: [".ts", ".tsx"],
},
},
},
},
react: {
version: "17.0.1", // Version used in WP 5.9
},
},
};