-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.js
68 lines (62 loc) · 1.56 KB
/
index.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
"use strict";
var pkg = require('./package.json');
var allRules = {
"jsx-no-new-object-as-prop": require("./lib/rules/jsx-no-new-object-as-prop"),
"jsx-no-new-array-as-prop": require("./lib/rules/jsx-no-new-array-as-prop"),
"jsx-no-new-function-as-prop": require("./lib/rules/jsx-no-new-function-as-prop"),
"jsx-no-jsx-as-prop": require("./lib/rules/jsx-no-jsx-as-prop")
};
function configureAsError(rules) {
var result = {};
for (var key in rules) {
if (!rules.hasOwnProperty(key)) {
continue;
}
result["react-perf/" + key] = 2;
}
return result;
}
var plugin = {
meta: {
name: pkg.name,
version: pkg.version
},
rules: allRules,
configs: {
recommended: {
plugins: ["react-perf"],
parserOptions: {
ecmaFeatures: {
jsx: true
}
},
rules: {
"react-perf/jsx-no-new-object-as-prop": 2,
"react-perf/jsx-no-new-array-as-prop": 2,
"react-perf/jsx-no-new-function-as-prop": 2
}
},
all: {
plugins: ["react-perf"],
parserOptions: {
ecmaFeatures: {
jsx: true
}
},
rules: configureAsError(allRules)
}
}
};
plugin.configs.flat = {
recommended: {
plugins: { "react-perf": plugin },
rules: plugin.configs.recommended.rules,
languageOptions: { parserOptions: plugin.configs.recommended.parserOptions },
},
all: {
plugins: { "react-perf": plugin },
rules: plugin.configs.all.rules,
languageOptions: { parserOptions: plugin.configs.all.parserOptions },
},
};
module.exports = plugin;