-
Notifications
You must be signed in to change notification settings - Fork 38
/
index.js
45 lines (39 loc) · 1.03 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
const { readFileSync } = require("fs");
const path = require("path");
const data = readFileSync(path.join(__dirname, "package.json"));
const packageJSON = JSON.parse(data);
const plugin = {
meta: {
name: "eslint-plugin-no-unsanitized",
version: packageJSON.version,
},
rules: {
property: require("./lib/rules/property"),
method: require("./lib/rules/method"),
},
configs: {},
};
const rules = {
"no-unsanitized/property": "error",
"no-unsanitized/method": "error",
};
Object.assign(plugin.configs, {
"recommended-legacy": {
plugins: ["no-unsanitized"],
rules,
},
recommended: {
plugins: { "no-unsanitized": plugin },
rules,
},
});
Object.defineProperty(plugin.configs, "DOM", {
enumerable: true,
get() {
console.log(
'The "DOM" configuration of the "no-unsanitized" plugin is deprecated. Use "recommended-legacy" instead.'
);
return this["recommended-legacy"];
},
});
module.exports = plugin;