Skip to content

Commit 6bf44fe

Browse files
committed
Refactor code structure for improved readability and maintainability
1 parent 8f94895 commit 6bf44fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+10879
-3613
lines changed

.editorconfig

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,22 @@ end_of_line = lf
44
indent_size = 2
55
indent_style = space
66
insert_final_newline = true
7-
max_line_length = 80
7+
max_line_length = 120
88
trim_trailing_whitespace = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false
12+
13+
[*.yml]
14+
indent_style = space
15+
indent_size = 2
16+
17+
[*.yaml]
18+
indent_style = space
19+
indent_size = 2
20+
21+
[*.{json,js,ts,tsx,jsx}]
22+
indent_size = 2
23+
24+
[*.prettierrc]
25+
indent_size = 2

.eslintrc.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"env": {
3+
"es2022": true,
4+
"node": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"plugin:import/errors",
10+
"plugin:import/warnings",
11+
"plugin:import/typescript",
12+
"prettier"
13+
],
14+
"parser": "@typescript-eslint/parser",
15+
"parserOptions": {
16+
"project": ["./tsconfig.json", "./tsconfig.spec.json"],
17+
"tsconfigRootDir": "D:/backstage-mcp-server",
18+
"ecmaVersion": "latest",
19+
"sourceType": "module"
20+
},
21+
"plugins": ["@typescript-eslint", "simple-import-sort", "import"],
22+
"settings": {
23+
"import/resolver": {
24+
"typescript": {}
25+
}
26+
},
27+
"rules": {
28+
"@typescript-eslint/no-explicit-any": "error",
29+
"@typescript-eslint/strict-boolean-expressions": "warn",
30+
"@typescript-eslint/no-unused-vars": [
31+
"error",
32+
{
33+
"argsIgnorePattern": "^_",
34+
"varsIgnorePattern": "^_"
35+
}
36+
],
37+
"simple-import-sort/imports": "error",
38+
"simple-import-sort/exports": "error",
39+
"import/no-unused-modules": ["error", { "unusedExports": true }],
40+
"no-console": ["error", { "allow": ["warn", "error"] }]
41+
}
42+
}

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18.x]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
- name: Install dependencies
24+
run: |
25+
npm ci
26+
- name: Lint
27+
run: |
28+
npm run lint
29+
- name: Test
30+
run: |
31+
npm test
32+
- name: Upload coverage
33+
if: success()
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: coverage-report
37+
path: coverage

.prettierrc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
trailingComma: 'es5'
2-
tabWidth: 2
31
semi: true
42
singleQuote: true
3+
tabWidth: 2
4+
trailingComma: 'es5'
5+
6+
overrides:
7+
- files: ['*.yml', '*.yaml']
8+
options:
9+
singleQuote: false

.vscode/extensions.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"recommendations": [
3+
"esbenp.prettier-vscode",
4+
"editorconfig.editorconfig",
5+
"dbaeumer.vscode-eslint",
6+
"DavidAnson.vscode-markdownlint",
7+
"arcanis.vscode-zipfs"
8+
],
9+
"unwantedRecommendations": []
10+
}

.vscode/settings.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"search.exclude": {
3+
"**/.yarn": true,
4+
"**/.pnp.*": true
5+
},
6+
"eslint.nodePath": ".yarn/sdks",
7+
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
8+
"typescript.tsdk": ".yarn/sdks/typescript/lib",
9+
"typescript.enablePromptUseWorkspaceTsdk": true
10+
}

.yarn/sdks/eslint/bin/eslint.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
3+
const { existsSync } = require(`fs`);
4+
const { createRequire, register } = require(`module`);
5+
const { resolve } = require(`path`);
6+
const { pathToFileURL } = require(`url`);
7+
8+
const relPnpApiPath = '../../../../.pnp.cjs';
9+
10+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
12+
const absRequire = createRequire(absPnpApiPath);
13+
14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
17+
if (existsSync(absPnpApiPath)) {
18+
if (!process.versions.pnp) {
19+
// Setup the environment to be able to require eslint/bin/eslint.js
20+
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
24+
}
25+
}
26+
27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? (exports) => absRequire(absUserWrapperPath)(exports)
29+
: (exports) => exports;
30+
31+
// Defer to the real eslint/bin/eslint.js your application uses
32+
module.exports = wrapWithUserWrapper(absRequire(`eslint/bin/eslint.js`));

.yarn/sdks/eslint/lib/api.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
3+
const { existsSync } = require(`fs`);
4+
const { createRequire, register } = require(`module`);
5+
const { resolve } = require(`path`);
6+
const { pathToFileURL } = require(`url`);
7+
8+
const relPnpApiPath = '../../../../.pnp.cjs';
9+
10+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
12+
const absRequire = createRequire(absPnpApiPath);
13+
14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
17+
if (existsSync(absPnpApiPath)) {
18+
if (!process.versions.pnp) {
19+
// Setup the environment to be able to require eslint
20+
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
24+
}
25+
}
26+
27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? (exports) => absRequire(absUserWrapperPath)(exports)
29+
: (exports) => exports;
30+
31+
// Defer to the real eslint your application uses
32+
module.exports = wrapWithUserWrapper(absRequire(`eslint`));
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
3+
const { existsSync } = require(`fs`);
4+
const { createRequire, register } = require(`module`);
5+
const { resolve } = require(`path`);
6+
const { pathToFileURL } = require(`url`);
7+
8+
const relPnpApiPath = '../../../../.pnp.cjs';
9+
10+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
12+
const absRequire = createRequire(absPnpApiPath);
13+
14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
17+
if (existsSync(absPnpApiPath)) {
18+
if (!process.versions.pnp) {
19+
// Setup the environment to be able to require eslint/use-at-your-own-risk
20+
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
24+
}
25+
}
26+
27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? (exports) => absRequire(absUserWrapperPath)(exports)
29+
: (exports) => exports;
30+
31+
// Defer to the real eslint/use-at-your-own-risk your application uses
32+
module.exports = wrapWithUserWrapper(absRequire(`eslint/use-at-your-own-risk`));

.yarn/sdks/eslint/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "eslint",
3+
"version": "8.57.1-sdk",
4+
"main": "./lib/api.js",
5+
"type": "commonjs",
6+
"bin": {
7+
"eslint": "./bin/eslint.js"
8+
},
9+
"exports": {
10+
"./package.json": "./package.json",
11+
".": "./lib/api.js",
12+
"./use-at-your-own-risk": "./lib/unsupported-api.js"
13+
}
14+
}

0 commit comments

Comments
 (0)