diff --git a/.gitignore b/.gitignore index 9b0ce94b..dc23330c 100644 --- a/.gitignore +++ b/.gitignore @@ -136,3 +136,5 @@ dist test/msg-box test/bookshop/gen test/bookshop/.cdsrc.json + +.claude/ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..2312dc58 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/.oxfmtrc.jsonc b/.oxfmtrc.jsonc new file mode 100644 index 00000000..587c4a02 --- /dev/null +++ b/.oxfmtrc.jsonc @@ -0,0 +1,21 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "arrowParens": "avoid", + "bracketSpacing": true, + "embeddedLanguageFormatting": "auto", + "htmlWhitespaceSensitivity": "css", + "insertPragma": false, + "jsxSingleQuote": false, + "printWidth": 120, + "proseWrap": "preserve", + "quoteProps": "as-needed", + "requirePragma": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false, + "vueIndentScriptAndStyle": false, + "sortPackageJson": false, + "ignorePatterns": ["*.md"] +} diff --git a/jest.config.js b/jest.config.js index 70fb6cd8..e9822f91 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,7 +8,9 @@ if (process.env.CI && process.env.HANA_DRIVER) { config.testMatch = ['**/tracing-attributes.test.js', '**/passport.test.js'] if (process.env.HANA_PROM) - process.env.cds_requires_telemetry_tracing = JSON.stringify({ _hana_prom: process.env.HANA_PROM === 'true' }) + process.env.cds_requires_telemetry_tracing = JSON.stringify({ + _hana_prom: process.env.HANA_PROM === 'true' + }) } module.exports = config diff --git a/lib/exporter/ConsoleMetricExporter.js b/lib/exporter/ConsoleMetricExporter.js index e04b8cec..833a17a1 100644 --- a/lib/exporter/ConsoleMetricExporter.js +++ b/lib/exporter/ConsoleMetricExporter.js @@ -119,7 +119,9 @@ class ConsoleMetricExporter extends StandardConsoleMetricExporter { // export other metrics for (const tenant of Object.keys(other)) { for (const [k, v] of Object.entries(other[tenant])) { - LOG.info(`${k}${tenant !== 'undefined' ? ` of tenant "${tenant}"` : ''}: ${inspect(v.length === 1 ? v[0] : v)}`) + LOG.info( + `${k}${tenant !== 'undefined' ? ` of tenant "${tenant}"` : ''}: ${inspect(v.length === 1 ? v[0] : v)}` + ) } } } diff --git a/package.json b/package.json index 03583029..adc4cf5f 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,14 @@ "lib" ], "scripts": { + "fmt": "npx oxfmt", "lint": "npx eslint .", + "prepare": "husky", "test": "npx jest --silent" }, + "lint-staged": { + "*": "oxfmt --no-error-on-unmatched-pattern" + }, "dependencies": { "@opentelemetry/api": "^1.9", "@opentelemetry/core": "^1.30", @@ -48,7 +53,10 @@ "chai-as-promised": "^7.1.1", "chai-subset": "^1.6.0", "eslint": "^10", - "jest": "^29.7.0" + "husky": "^9.1.7", + "jest": "^29.7.0", + "lint-staged": "^17.0.8", + "oxfmt": "^0.56.0" }, "cds": { "requires": {