forked from eslint/eslint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-eslint-all.js
50 lines (38 loc) · 1.41 KB
/
update-eslint-all.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
/**
* @fileoverview Script to update the eslint:all configuration.
* @author Nicholas C. Zakas
*/
"use strict";
//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------
const fs = require("node:fs");
const builtInRules = require("../lib/rules");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const allRules = {};
for (const [ruleId, rule] of builtInRules) {
if (!rule.meta.deprecated) {
allRules[ruleId] = "error";
}
}
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
const code = `/*
* WARNING: This file is autogenerated using the tools/update-eslint-all.js
* script. Do not edit manually.
*/
"use strict";
/* eslint quote-props: off -- autogenerated so don't lint */
/*
* IMPORTANT!
*
* We cannot add a "name" property to this object because it's still used in eslintrc
* which doesn't support the "name" property. If we add a "name" property, it will
* cause an error.
*/
module.exports = Object.freeze(${JSON.stringify({ rules: allRules }, null, 4)});
`;
fs.writeFileSync("./packages/js/src/configs/eslint-all.js", code, "utf8");