@dvukovic/style-guide 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,9 +1,59 @@
|
|
|
1
1
|
import plugin from "eslint-plugin-react"
|
|
2
2
|
|
|
3
|
+
function shimRemovedContextMethods(rule) {
|
|
4
|
+
const create = rule.create
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
...rule,
|
|
8
|
+
create(context) {
|
|
9
|
+
const shimmedContext = new Proxy(context, {
|
|
10
|
+
get(target, property) {
|
|
11
|
+
if (property === "getFilename") {
|
|
12
|
+
return () => {
|
|
13
|
+
return target.filename
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (property === "getPhysicalFilename") {
|
|
18
|
+
return () => {
|
|
19
|
+
return target.physicalFilename
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (property === "getCwd") {
|
|
24
|
+
return () => {
|
|
25
|
+
return target.cwd
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (property === "getSourceCode") {
|
|
30
|
+
return () => {
|
|
31
|
+
return target.sourceCode
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return Reflect.get(target, property, target)
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
return create.call(rule, shimmedContext)
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const shimmedPlugin = {
|
|
45
|
+
...plugin,
|
|
46
|
+
rules: Object.fromEntries(
|
|
47
|
+
Object.entries(plugin.rules).map(([name, rule]) => {
|
|
48
|
+
return [name, shimRemovedContextMethods(rule)]
|
|
49
|
+
}),
|
|
50
|
+
),
|
|
51
|
+
}
|
|
52
|
+
|
|
3
53
|
/** @type {import("@eslint/config-helpers").Config} */
|
|
4
54
|
export const react = {
|
|
5
55
|
plugins: {
|
|
6
|
-
react:
|
|
56
|
+
react: shimmedPlugin,
|
|
7
57
|
},
|
|
8
58
|
rules: {
|
|
9
59
|
"react/boolean-prop-naming": "error",
|
|
@@ -13,7 +13,6 @@ export const unicorn = {
|
|
|
13
13
|
"unicorn/consistent-existence-index-check": "error",
|
|
14
14
|
"unicorn/consistent-function-scoping": "error",
|
|
15
15
|
"unicorn/consistent-json-file-read": "error",
|
|
16
|
-
"unicorn/custom-error-definition": "error",
|
|
17
16
|
"unicorn/dom-node-dataset": "error",
|
|
18
17
|
"unicorn/empty-brace-spaces": "error",
|
|
19
18
|
"unicorn/error-message": "error",
|