k2hr3-api 1.0.42 → 2.0.1
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/config/k2hr3-init.sh.templ +4 -4
- package/dist/.gitkeep +0 -0
- package/dist/src/app.js +262 -0
- package/{bin → dist/src/bin}/run.sh +1 -1
- package/dist/src/bin/watcher.js +113 -0
- package/dist/src/bin/www.js +217 -0
- package/dist/src/lib/basicipcheck.js +392 -0
- package/dist/src/lib/cacerts.js +106 -0
- package/dist/src/lib/dbglogging.js +190 -0
- package/dist/src/lib/dummyuserapi.js +719 -0
- package/dist/src/lib/ipwatch.js +354 -0
- package/dist/src/lib/k2hr3acrutil.js +532 -0
- package/dist/src/lib/k2hr3apiutil.js +1444 -0
- package/dist/src/lib/k2hr3cliutil.js +183 -0
- package/dist/src/lib/k2hr3config.js +832 -0
- package/dist/src/lib/k2hr3cryptutil.js +258 -0
- package/dist/src/lib/k2hr3dkc.js +12121 -0
- package/dist/src/lib/k2hr3extdata.js +198 -0
- package/dist/src/lib/k2hr3keys.js +207 -0
- package/dist/src/lib/k2hr3resutil.js +111 -0
- package/dist/src/lib/k2hr3template.js +6546 -0
- package/dist/src/lib/k2hr3tokens.js +2643 -0
- package/dist/src/lib/k2hr3userdata.js +296 -0
- package/dist/src/lib/k8soidc.js +1000 -0
- package/dist/src/lib/openstackapiv2.js +695 -0
- package/dist/src/lib/openstackapiv3.js +932 -0
- package/dist/src/lib/openstackep.js +667 -0
- package/{tests/auto_common.js → dist/src/lib/types.js} +4 -38
- package/dist/src/routes/acr.js +704 -0
- package/dist/src/routes/debugVerify.js +294 -0
- package/dist/src/routes/extdata.js +219 -0
- package/dist/src/routes/list.js +264 -0
- package/dist/src/routes/policy.js +840 -0
- package/dist/src/routes/resource.js +1489 -0
- package/dist/src/routes/role.js +2627 -0
- package/dist/src/routes/service.js +908 -0
- package/dist/src/routes/tenant.js +1141 -0
- package/dist/src/routes/userTokens.js +482 -0
- package/dist/src/routes/userdata.js +212 -0
- package/dist/src/routes/version.js +103 -0
- package/package.json +152 -121
- package/ChangeLog +0 -378
- package/app.js +0 -292
- package/bin/watcher +0 -122
- package/bin/www +0 -180
- package/eslint.config.mjs +0 -68
- package/lib/basicipcheck.js +0 -376
- package/lib/cacerts.js +0 -71
- package/lib/dbglogging.js +0 -151
- package/lib/dummyuserapi.js +0 -766
- package/lib/ipwatch.js +0 -379
- package/lib/k2hr3acrutil.js +0 -516
- package/lib/k2hr3apiutil.js +0 -1494
- package/lib/k2hr3cliutil.js +0 -191
- package/lib/k2hr3config.js +0 -826
- package/lib/k2hr3cryptutil.js +0 -254
- package/lib/k2hr3dkc.js +0 -12632
- package/lib/k2hr3extdata.js +0 -198
- package/lib/k2hr3keys.js +0 -234
- package/lib/k2hr3resutil.js +0 -100
- package/lib/k2hr3template.js +0 -6925
- package/lib/k2hr3tokens.js +0 -2799
- package/lib/k2hr3userdata.js +0 -312
- package/lib/k8soidc.js +0 -1012
- package/lib/openstackapiv2.js +0 -764
- package/lib/openstackapiv3.js +0 -1032
- package/lib/openstackep.js +0 -553
- package/routes/acr.js +0 -738
- package/routes/debugVerify.js +0 -263
- package/routes/extdata.js +0 -232
- package/routes/list.js +0 -270
- package/routes/policy.js +0 -869
- package/routes/resource.js +0 -1441
- package/routes/role.js +0 -2664
- package/routes/service.js +0 -894
- package/routes/tenant.js +0 -1095
- package/routes/userTokens.js +0 -511
- package/routes/userdata.js +0 -218
- package/routes/version.js +0 -108
- package/templ/Dockerfile.templ +0 -71
- package/tests/auto_acr.js +0 -1101
- package/tests/auto_acr_spec.js +0 -79
- package/tests/auto_all_spec.js +0 -142
- package/tests/auto_control_subprocess.sh +0 -243
- package/tests/auto_extdata.js +0 -220
- package/tests/auto_extdata_spec.js +0 -79
- package/tests/auto_init_config_json.sh +0 -275
- package/tests/auto_k2hdkc_server.ini +0 -109
- package/tests/auto_k2hdkc_slave.ini +0 -83
- package/tests/auto_list.js +0 -439
- package/tests/auto_list_spec.js +0 -79
- package/tests/auto_policy.js +0 -1579
- package/tests/auto_policy_spec.js +0 -79
- package/tests/auto_resource.js +0 -10956
- package/tests/auto_resource_spec.js +0 -79
- package/tests/auto_role.js +0 -6150
- package/tests/auto_role_spec.js +0 -79
- package/tests/auto_service.js +0 -770
- package/tests/auto_service_spec.js +0 -79
- package/tests/auto_subprocesses.js +0 -114
- package/tests/auto_template.sh +0 -126
- package/tests/auto_tenant.js +0 -1100
- package/tests/auto_tenant_spec.js +0 -79
- package/tests/auto_token_util.js +0 -219
- package/tests/auto_userdata.js +0 -292
- package/tests/auto_userdata_spec.js +0 -79
- package/tests/auto_usertokens.js +0 -565
- package/tests/auto_usertokens_spec.js +0 -79
- package/tests/auto_version.js +0 -127
- package/tests/auto_version_spec.js +0 -79
- package/tests/auto_watcher.js +0 -157
- package/tests/auto_watcher_spec.js +0 -79
- package/tests/k2hdkc_test.data +0 -986
- package/tests/k2hdkc_test_load.sh +0 -255
- package/tests/k2hr3template_test.js +0 -187
- package/tests/k2hr3template_test.sh +0 -339
- package/tests/k2hr3template_test_async.js +0 -216
- package/tests/k2hr3template_test_template.result +0 -7117
- package/tests/k2hr3template_test_template.txt +0 -3608
- package/tests/k2hr3template_test_vars.js +0 -194
- package/tests/manual_acr_delete.js +0 -143
- package/tests/manual_acr_get.js +0 -297
- package/tests/manual_acr_postput.js +0 -215
- package/tests/manual_allusertenant_get.js +0 -113
- package/tests/manual_extdata_get.js +0 -191
- package/tests/manual_k2hr3keys_get.js +0 -84
- package/tests/manual_list_gethead.js +0 -230
- package/tests/manual_policy_delete.js +0 -132
- package/tests/manual_policy_gethead.js +0 -275
- package/tests/manual_policy_postput.js +0 -297
- package/tests/manual_resource_delete.js +0 -433
- package/tests/manual_resource_gethead.js +0 -423
- package/tests/manual_resource_postput.js +0 -487
- package/tests/manual_role_delete.js +0 -404
- package/tests/manual_role_gethead.js +0 -547
- package/tests/manual_role_postput.js +0 -544
- package/tests/manual_service_delete.js +0 -153
- package/tests/manual_service_gethead.js +0 -178
- package/tests/manual_service_postput.js +0 -348
- package/tests/manual_tenant_delete.js +0 -186
- package/tests/manual_tenant_gethead.js +0 -268
- package/tests/manual_tenant_postput.js +0 -293
- package/tests/manual_test.sh +0 -352
- package/tests/manual_userdata_get.js +0 -173
- package/tests/manual_usertoken_gethead.js +0 -136
- package/tests/manual_usertoken_postput.js +0 -310
- package/tests/manual_version_get.js +0 -127
- package/tests/run_local_test_k2hdkc.sh +0 -174
- package/tests/test.sh +0 -333
package/bin/watcher
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/*
|
|
3
|
-
* K2HR3 REST API
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2017 Yahoo Japan Corporation.
|
|
6
|
-
*
|
|
7
|
-
* K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers
|
|
8
|
-
* common management information for the cloud.
|
|
9
|
-
* K2HR3 can dynamically manage information as "who", "what", "operate".
|
|
10
|
-
* These are stored as roles, resources, policies in K2hdkc, and the
|
|
11
|
-
* client system can dynamically read and modify these information.
|
|
12
|
-
*
|
|
13
|
-
* For the full copyright and license information, please view
|
|
14
|
-
* the license file that was distributed with this source code.
|
|
15
|
-
*
|
|
16
|
-
* AUTHOR: Takeshi Nakatani
|
|
17
|
-
* CREATE: Wed Oct 24 2018
|
|
18
|
-
* REVISION:
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
'use strict';
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
// Module dependencies.
|
|
26
|
-
//
|
|
27
|
-
var apiutil = require('../lib/k2hr3apiutil');
|
|
28
|
-
var watchobj = require('../lib/ipwatch');
|
|
29
|
-
var r3Conf = require('../lib/k2hr3config').r3ApiConfig;
|
|
30
|
-
var apiConf = new r3Conf();
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
// Setup console logging
|
|
34
|
-
//
|
|
35
|
-
apiConf.setConsoleLogging(__dirname + '/..', true); // replace output from stdout/stderr to file if set in config
|
|
36
|
-
|
|
37
|
-
// Debug logging objects
|
|
38
|
-
var r3logger = require('../lib/dbglogging');
|
|
39
|
-
|
|
40
|
-
// Globals
|
|
41
|
-
var intervalobj = null;
|
|
42
|
-
|
|
43
|
-
//
|
|
44
|
-
// Process/Signal handlering
|
|
45
|
-
//
|
|
46
|
-
function procSignal(reason, code)
|
|
47
|
-
{
|
|
48
|
-
if(apiutil.compareCaseString(reason, 'exit')){
|
|
49
|
-
r3logger.elog('K2HR3 watcher exit with status code : ' + (apiutil.isSafeEntity(code) ? code.toString() : 'unknown'));
|
|
50
|
-
}else{
|
|
51
|
-
r3logger.elog('K2HR3 watcher caught signal : ' + apiutil.getSafeString(reason));
|
|
52
|
-
}
|
|
53
|
-
if(intervalobj){
|
|
54
|
-
clearInterval(intervalobj);
|
|
55
|
-
intervalobj = null;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
process.on('exit', function(code){ procSignal('exit', code); });
|
|
60
|
-
process.on('SIGHUP', function(){ procSignal('SIGHUP'); });
|
|
61
|
-
process.on('SIGINT', function(){ procSignal('SIGINT'); });
|
|
62
|
-
process.on('SIGBREAK', function(){ procSignal('SIGBREAK'); });
|
|
63
|
-
process.on('SIGTERM', function(){ procSignal('SIGTERM'); });
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
// OneShot callback
|
|
67
|
-
//
|
|
68
|
-
function oneshotCallback(result)
|
|
69
|
-
{
|
|
70
|
-
if(apiutil.isSafeEntity(result) && 'boolean' == typeof result && result){
|
|
71
|
-
r3logger.dlog('K2HR3 watcher oneshot result : Succeed');
|
|
72
|
-
process.exit(0);
|
|
73
|
-
}else{
|
|
74
|
-
r3logger.elog('K2HR3 watcher oneshot result : Failed');
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
//
|
|
80
|
-
// Process parameter
|
|
81
|
-
//
|
|
82
|
-
var oneshotCB = null;
|
|
83
|
-
if(!apiutil.isEmptyArray(process.argv)){
|
|
84
|
-
for(var cnt = 2; cnt < process.argv.length; ++cnt){ // argv[0] = 'node', argv[1] = 'this program'
|
|
85
|
-
if( apiutil.isSafeString(process.argv[cnt]) ||
|
|
86
|
-
apiutil.compareCaseString(process.argv[cnt], '--oneshot') ||
|
|
87
|
-
apiutil.compareCaseString(process.argv[cnt], '-os') )
|
|
88
|
-
{
|
|
89
|
-
oneshotCB = oneshotCallback;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
// Check wathcer type
|
|
96
|
-
//
|
|
97
|
-
if(watchobj.isNocheckType() || watchobj.isListenerType()){
|
|
98
|
-
r3logger.elog('K2HR3 watcher type defined ' + watchobj.getType() + ' in configuration, thus could not run watcher.');
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
//
|
|
103
|
-
// Run watcher interval loop
|
|
104
|
-
//
|
|
105
|
-
intervalobj = watchobj.watchAddressesAlive(oneshotCB);
|
|
106
|
-
if(!intervalobj){
|
|
107
|
-
if(null != oneshotCB){
|
|
108
|
-
// nothig to do here
|
|
109
|
-
}else{
|
|
110
|
-
r3logger.elog('K2HR3 watcher could not run.');
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/*
|
|
116
|
-
* Local variables:
|
|
117
|
-
* tab-width: 4
|
|
118
|
-
* c-basic-offset: 4
|
|
119
|
-
* End:
|
|
120
|
-
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
121
|
-
* vim<600: noexpandtab sw=4 ts=4
|
|
122
|
-
*/
|
package/bin/www
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/*
|
|
3
|
-
* K2HR3 REST API
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2017 Yahoo Japan Corporation.
|
|
6
|
-
*
|
|
7
|
-
* K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers
|
|
8
|
-
* common management information for the cloud.
|
|
9
|
-
* K2HR3 can dynamically manage information as "who", "what", "operate".
|
|
10
|
-
* These are stored as roles, resources, policies in K2hdkc, and the
|
|
11
|
-
* client system can dynamically read and modify these information.
|
|
12
|
-
*
|
|
13
|
-
* For the full copyright and license information, please view
|
|
14
|
-
* the license file that was distributed with this source code.
|
|
15
|
-
*
|
|
16
|
-
* AUTHOR: Takeshi Nakatani
|
|
17
|
-
* CREATE: Wed Jun 8 2017
|
|
18
|
-
* REVISION:
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
'use strict';
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
// Module dependencies.
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
var app = require('../app');
|
|
29
|
-
var debug = require('debug')('k2hr3-api:server');
|
|
30
|
-
var fs = require('fs');
|
|
31
|
-
var cluster = require('cluster');
|
|
32
|
-
var numCPUs = require('os').cpus().length;
|
|
33
|
-
var r3Conf = require('../lib/k2hr3config').r3ApiConfig;
|
|
34
|
-
var apiConf = new r3Conf();
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
// Setup console logging
|
|
38
|
-
//
|
|
39
|
-
apiConf.setConsoleLogging(__dirname + '/..', false); // replace output from stdout/stderr to file if set in config
|
|
40
|
-
|
|
41
|
-
if(cluster.isMaster && (undefined == apiConf.isMultiProc() || false !== apiConf.isMultiProc())){
|
|
42
|
-
console.log(`Master ${process.pid} is running`);
|
|
43
|
-
|
|
44
|
-
// Fork workers.
|
|
45
|
-
var cnt;
|
|
46
|
-
for(cnt = 0; cnt < numCPUs; ++cnt){
|
|
47
|
-
cluster.fork();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
cluster.on('exit', function(worker, code, signal){
|
|
51
|
-
if(signal){
|
|
52
|
-
console.log(`worker was killed by signal: ${signal}`);
|
|
53
|
-
}else if(0 !== code){
|
|
54
|
-
console.log(`worker exited with error code: ${code}`);
|
|
55
|
-
}else{
|
|
56
|
-
console.log(`worker ${worker.process.pid} died`);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}else{
|
|
60
|
-
//
|
|
61
|
-
// Get port from environment and store in Express.
|
|
62
|
-
//
|
|
63
|
-
var options;
|
|
64
|
-
var secure = false;
|
|
65
|
-
var key = apiConf.getPrivateKey(); // allow empty
|
|
66
|
-
var cert = apiConf.getCert(); // allow empty
|
|
67
|
-
var ca = apiConf.getCA(); // allow empty
|
|
68
|
-
var user = apiConf.getRunUser(); // allow empty
|
|
69
|
-
var port = apiConf.getPort();
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
// scheme
|
|
73
|
-
//
|
|
74
|
-
if('https' == apiConf.getScheme() || 'HTTPS' == apiConf.getScheme()){
|
|
75
|
-
secure = true;
|
|
76
|
-
options = {
|
|
77
|
-
key: fs.readFileSync(key),
|
|
78
|
-
cert: fs.readFileSync(cert),
|
|
79
|
-
ca: fs.readFileSync(ca)
|
|
80
|
-
};
|
|
81
|
-
}else if('http' == apiConf.getScheme() || 'HTTP' == apiConf.getScheme()){
|
|
82
|
-
secure = false;
|
|
83
|
-
}else{
|
|
84
|
-
console.log('scheme value(' + apiConf.getScheme() + ') in config is wrong');
|
|
85
|
-
process.exit(1);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
// Others
|
|
90
|
-
//
|
|
91
|
-
var os = require('os');
|
|
92
|
-
var hostname= os.hostname() || '127.0.0.1';
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
// Store in Express.
|
|
96
|
-
//
|
|
97
|
-
app.set('port', port);
|
|
98
|
-
|
|
99
|
-
//
|
|
100
|
-
// Create HTTP server.
|
|
101
|
-
//
|
|
102
|
-
var server;
|
|
103
|
-
if(secure){
|
|
104
|
-
var https = require('https');
|
|
105
|
-
server = https.createServer(options, app);
|
|
106
|
-
}else{
|
|
107
|
-
var http = require('http');
|
|
108
|
-
server = http.createServer(app);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
//
|
|
112
|
-
// Listen on provided port, on all network interfaces.
|
|
113
|
-
//
|
|
114
|
-
server.listen(port, function()
|
|
115
|
-
{
|
|
116
|
-
if(undefined !== user && null !== user && 'string' == typeof user && '' !== user){
|
|
117
|
-
console.log('Attempting setuid to user "' + user + '"...');
|
|
118
|
-
try {
|
|
119
|
-
process.setuid(user);
|
|
120
|
-
console.log('Succeeded to setuid');
|
|
121
|
-
} catch (err) {
|
|
122
|
-
console.log('Failed to setuid', JSON.stringify(err));
|
|
123
|
-
process.exit(1);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
server.on('error', onError);
|
|
129
|
-
server.on('listening', onListening);
|
|
130
|
-
|
|
131
|
-
console.log('Server running at ' + apiConf.getScheme() + '://' + hostname + ':' + port + '/');
|
|
132
|
-
console.log(`Worker ${process.pid} started`);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
//
|
|
136
|
-
// Event listener for HTTP server "error" event.
|
|
137
|
-
//
|
|
138
|
-
function onError(error)
|
|
139
|
-
{
|
|
140
|
-
if('listen' !== error.syscall){
|
|
141
|
-
throw error;
|
|
142
|
-
}
|
|
143
|
-
var bind = ('string' === typeof port) ? 'Pipe ' + port : 'Port ' + port;
|
|
144
|
-
|
|
145
|
-
// handle specific listen errors with friendly messages
|
|
146
|
-
switch(error.code){
|
|
147
|
-
case 'EACCES':
|
|
148
|
-
console.error(bind + ' requires elevated privileges');
|
|
149
|
-
process.exit(1);
|
|
150
|
-
break;
|
|
151
|
-
|
|
152
|
-
case 'EADDRINUSE':
|
|
153
|
-
console.error(bind + ' is already in use');
|
|
154
|
-
process.exit(1);
|
|
155
|
-
break;
|
|
156
|
-
|
|
157
|
-
default:
|
|
158
|
-
throw error;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
//
|
|
163
|
-
// Event listener for HTTP server "listening" event.
|
|
164
|
-
//
|
|
165
|
-
function onListening()
|
|
166
|
-
{
|
|
167
|
-
var addr = server.address();
|
|
168
|
-
var bind = ('string' === typeof addr) ? 'pipe ' + addr : 'port ' + addr.port;
|
|
169
|
-
|
|
170
|
-
debug('Listening on ' + bind);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/*
|
|
174
|
-
* Local variables:
|
|
175
|
-
* tab-width: 4
|
|
176
|
-
* c-basic-offset: 4
|
|
177
|
-
* End:
|
|
178
|
-
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
179
|
-
* vim<600: noexpandtab sw=4 ts=4
|
|
180
|
-
*/
|
package/eslint.config.mjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* K2HR3 REST API
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2017 Yahoo Japan Corporation.
|
|
5
|
-
*
|
|
6
|
-
* K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers
|
|
7
|
-
* common management information for the cloud.
|
|
8
|
-
* K2HR3 can dynamically manage information as "who", "what", "operate".
|
|
9
|
-
* These are stored as roles, resources, policies in K2hdkc, and the
|
|
10
|
-
* client system can dynamically read and modify these information.
|
|
11
|
-
*
|
|
12
|
-
* For the full copyright and license information, please view
|
|
13
|
-
* the license file that was distributed with this source code.
|
|
14
|
-
*
|
|
15
|
-
* AUTHOR: Takeshi Nakatani
|
|
16
|
-
* CREATE: Fri, Feb 14 2025
|
|
17
|
-
* REVISION:
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
//
|
|
22
|
-
// [NOTE]
|
|
23
|
-
// This file is the old .eslintrc.js file converted by @eslint/migrate-config.
|
|
24
|
-
//
|
|
25
|
-
import globals from "globals";
|
|
26
|
-
import path from "node:path";
|
|
27
|
-
import { fileURLToPath } from "node:url";
|
|
28
|
-
import js from "@eslint/js";
|
|
29
|
-
import { FlatCompat } from "@eslint/eslintrc";
|
|
30
|
-
|
|
31
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
32
|
-
const __dirname = path.dirname(__filename);
|
|
33
|
-
const compat = new FlatCompat({
|
|
34
|
-
baseDirectory: __dirname,
|
|
35
|
-
recommendedConfig: js.configs.recommended,
|
|
36
|
-
allConfig: js.configs.all
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export default [...compat.extends("eslint:recommended"), {
|
|
40
|
-
languageOptions: {
|
|
41
|
-
globals: {
|
|
42
|
-
...globals.node,
|
|
43
|
-
...globals.browser,
|
|
44
|
-
...globals.commonjs,
|
|
45
|
-
},
|
|
46
|
-
ecmaVersion: 2017,
|
|
47
|
-
sourceType: "commonjs",
|
|
48
|
-
},
|
|
49
|
-
files: ["**/*.js", "**/*.ts", "**/www", "**/watcher"],
|
|
50
|
-
rules: {
|
|
51
|
-
indent: ["error", "tab", {
|
|
52
|
-
SwitchCase: 1,
|
|
53
|
-
}],
|
|
54
|
-
"no-console": 0,
|
|
55
|
-
"linebreak-style": ["error", "unix"],
|
|
56
|
-
quotes: ["error", "single"],
|
|
57
|
-
semi: ["error", "always"],
|
|
58
|
-
},
|
|
59
|
-
}];
|
|
60
|
-
|
|
61
|
-
/*
|
|
62
|
-
* Local variables:
|
|
63
|
-
* tab-width: 4
|
|
64
|
-
* c-basic-offset: 4
|
|
65
|
-
* End:
|
|
66
|
-
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
67
|
-
* vim<600: noexpandtab sw=4 ts=4
|
|
68
|
-
*/
|