Skip to content

9 files changed

+978
-93
lines changed

mgmt/jrgen-spec-schema.ts

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// npx -p json-schema-to-typescript json2ts -i jrgen-spec.schema.json -o mgmt/jrgen-spec-schema.ts
44
// rm jrgen-spec.schema.json
55

6-
/* tslint:disable */
76
/**
87
* This file was automatically generated by json-schema-to-typescript.
98
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,

mgmt/make-spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const spec: JrgenSpecSchema = {
2222
methods: {},
2323
};
2424

25-
const mgmtModules: { [k: string]: string; } = {};
25+
const mgmtModules: { [k: string]: string } = {};
2626
for (const [propName, propSchema] of Object.entries(schema.properties!)) {
2727
const typeName = (propSchema as TJS.Definition).$ref!.replace("#/definitions/", "");
2828
mgmtModules[typeName] = propName;
@@ -32,7 +32,7 @@ for (const [typeName, typeSchema] of Object.entries(schema.definitions!)) {
3232
if (mgmtModules[typeName]) {
3333
const methodPrefix = mgmtModules[typeName];
3434
for (const [methodSuffix, methodSchema] of Object.entries((typeSchema as TJS.Definition).properties!)) {
35-
spec.methods[methodPrefix + "." + methodSuffix] = {
35+
spec.methods[`${methodPrefix}.${methodSuffix}`] = {
3636
params: (methodSchema as TJS.Definition).properties!.args,
3737
result: (methodSchema as TJS.Definition).properties!.reply,
3838
summary: "",
@@ -43,4 +43,4 @@ for (const [typeName, typeSchema] of Object.entries(schema.definitions!)) {
4343
}
4444
}
4545

46-
process.stdout.write(jsonStringify(spec, {space: 2}));
46+
process.stdout.write(jsonStringify(spec, { space: 2 }));

mgmt/rpc-client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function makeMgmtClient(): RpcClient {
3535

3636
const u = new URL(mgmtEnv);
3737
if (!/^tcp[46]?:$/.test(u.protocol)) {
38-
throw new Error("unsupported MGMT scheme " + u.protocol);
38+
throw new Error(`unsupported MGMT scheme ${u.protocol}`);
3939
}
4040

4141
const jaysonClient = jayson.Client.tcp({

mk/eslintrc-js.js

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
module.exports = {
2+
plugins: [
3+
"simple-import-sort",
4+
],
5+
env: {
6+
es2020: true,
7+
node: true,
8+
},
9+
extends: [
10+
"eslint:recommended",
11+
],
12+
rules: {
13+
"simple-import-sort/sort": "error",
14+
"array-bracket-spacing": ["error", "never"],
15+
"arrow-parens": "error",
16+
"arrow-spacing": "error",
17+
"block-spacing": "error",
18+
"camelcase": "error",
19+
"comma-dangle": ["error", "always-multiline"],
20+
"comma-spacing": "error",
21+
"comma-style": "error",
22+
"computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
23+
"curly": "error",
24+
"dot-location": ["error", "property"],
25+
"dot-notation": "error",
26+
"eol-last": "error",
27+
"eqeqeq": "error",
28+
"func-call-spacing": "error",
29+
"key-spacing": "error",
30+
"keyword-spacing": "error",
31+
"no-console": "warn",
32+
"no-constant-condition": ["error", { checkLoops: false }],
33+
"no-else-return": "error",
34+
"no-empty": ["error", { allowEmptyCatch: true }],
35+
"no-spaced-func": "error",
36+
"no-useless-call": "error",
37+
"no-var": "error",
38+
"object-curly-spacing": ["error", "always"],
39+
"object-shorthand": "error",
40+
"prefer-arrow-callback": "error",
41+
"prefer-const": ["error", { destructuring: "all" }],
42+
"prefer-rest-params": "error",
43+
"prefer-spread": "error",
44+
"prefer-template": "error",
45+
"quotes": ["error", "double", { allowTemplateLiterals: true }],
46+
"radix": "error",
47+
"semi": "error",
48+
"semi-spacing": "error",
49+
"space-before-blocks": "error",
50+
"space-in-parens": "error",
51+
"switch-colon-spacing": "error",
52+
"template-curly-spacing": "error",
53+
},
54+
};

mk/eslintrc-ts.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const path = require("path");
2+
const jsRc = require("./eslintrc-js");
3+
4+
module.exports = {
5+
parser: "@typescript-eslint/parser",
6+
parserOptions: {
7+
project: path.resolve(__dirname, "..", "tsconfig.json"),
8+
},
9+
plugins: [
10+
"@typescript-eslint/eslint-plugin",
11+
"simple-import-sort",
12+
],
13+
env: {
14+
node: true,
15+
},
16+
extends: [
17+
"eslint:recommended",
18+
"plugin:@typescript-eslint/eslint-recommended",
19+
"plugin:@typescript-eslint/recommended",
20+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
21+
],
22+
rules: {
23+
...jsRc.rules,
24+
"@typescript-eslint/ban-ts-ignore": "off",
25+
"@typescript-eslint/explicit-function-return-type": "off",
26+
"@typescript-eslint/member-delimiter-style": ["error", { singleline: { delimiter: "comma" } }],
27+
"@typescript-eslint/no-empty-interface": ["error", { allowSingleExtends: true }],
28+
"@typescript-eslint/no-explicit-any": "off",
29+
"@typescript-eslint/no-inferrable-types": ["error", { ignoreParameters: true, ignoreProperties: true }],
30+
"@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: false }],
31+
"@typescript-eslint/no-namespace": "off",
32+
"@typescript-eslint/no-non-null-assertion": "off",
33+
"@typescript-eslint/no-unused-vars": ["warn", { args: "none" }],
34+
"@typescript-eslint/no-use-before-define": "off",
35+
"@typescript-eslint/require-await": "off",
36+
"@typescript-eslint/unbound-method": ["error", { ignoreStatic: true }],
37+
"constructor-super": "off",
38+
"no-inner-declarations": "off",
39+
"require-atomic-updates": "off",
40+
},
41+
};

mk/format-code.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ gofmt -l -w -s .
33
find -name '*.h' -o -name '*.c' \
44
| grep -vE 'pcg_basic|siphash-20121104|uthash|zf_log' \
55
| xargs clang-format-6.0 -i -style='{BasedOnStyle: Mozilla, ReflowComments: false}'
6-
node_modules/.bin/tslint --fix -p .
6+
node_modules/.bin/eslint --ignore-path .gitignore -c mk/eslintrc-ts.js --fix **/*.ts
7+
node_modules/.bin/eslint --ignore-path .gitignore -c mk/eslintrc-js.js --fix **/*.js
78
find . -path ./node_modules -prune -o \( -name '*.yaml' -o -name '*.yml' \) -print | xargs yamllint
89
node_modules/.bin/markdownlint --ignore node_modules '**/*.md'

0 commit comments

Comments
 (0)