forked from d3fc/d3fc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.json
163 lines (163 loc) · 3.78 KB
/
.eslintrc.json
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
{
// Base configuration that all packages should adhere to
// Ideally we'd apply the enhanced configuration below but
// we don't want to churn the source code unnecessarily.
// See comment below for more details.
"extends": [
"eslint:recommended"
],
"env": {
"es6": true
},
"globals": {
"console": true
},
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"rules": {
"no-unused-vars": ["error", { "args": "none" }],
"semi": ["error", "always"],
"no-console": ["error", { "allow": ["warn", "info"] }]
},
"overrides": [
// Additional globals for tests
{
"files": ["**/test/**/*.js"],
"env": {
"browser": true,
"jest": true,
"node": true
}
},
// Additional writable globals for browser-specific packages
{
"files": [
"./packages/d3fc-chart/src/**/*.js",
"./packages/d3fc-element/src/**/*.js"
],
"env": {
"browser": true
},
"globals": {
"global": "writable"
}
},
// Additional writable globals for node-specific files
{
"files": [
"./babel.config.js",
"./packages/d3fc/rollup.config.js"
],
"env": {
"node": true
}
},
// Enhanced checks for a more consistent style
// When packages undergo significant change, they should be added to the below list
// (and the test one below!)
{
"files": [
"./packages/d3fc-data-join/src/**/*.js",
"./packages/d3fc-domain-zoom/src/**/*.js",
"./packages/d3fc-webgl/src/**/*.js",
"./scripts/**/*.js"
],
"extends": [
"semistandard",
"plugin:prettier/recommended",
"prettier/standard"
]
},
// Apply the same enhanced checks to tests (overrides the above override...)
{
"files": [
"./packages/d3fc-data-join/test/**/*.js",
"./packages/d3fc-domain-zoom/test/**/*.js",
"./packages/d3fc-webgl/test/**/*.js"
],
"env": {
"browser": true,
"jest": true,
"node": true
},
"extends": [
"semistandard",
"plugin:prettier/recommended",
"prettier/standard"
]
},
// Apply the same enhanced checks to examples
// Extended to allow browser and library globals
{
"files": [
"./examples/**/*.js"
],
"parserOptions": {
"sourceType": "script"
},
"env": {
"browser": true
},
"globals": {
"fc": "readable",
"d3": "readable"
},
"extends": [
"semistandard",
"plugin:prettier/recommended",
"prettier/standard"
]
},
// Exemptions/enhancements for tests and helper scripts
{
"files": [
"./examples/__helpers__/*.js",
"./examples/**/__tests__/*.js"
],
"env": {
"jest": true
},
"globals": {
"d3fc": true,
"page": true,
"browser": true,
"context": true,
"jestPuppeteer": true
},
"extends": [
"semistandard",
"plugin:prettier/recommended",
"prettier/standard"
]
},
{
"files": [
"./scripts/jest/**/*.js"
],
"env": {
"jest": true,
"node": true
}
},
{
"files": [
"./packages/**/*.ts"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/semi": "error",
"@typescript-eslint/member-delimiter-style": "error"
}
}
]
}