Base configuration

This commit is contained in:
2025-03-29 22:55:08 +01:00
parent 482b9cae09
commit 19180d4516
8 changed files with 411 additions and 0 deletions

10
.editorconfig Normal file
View File

@@ -0,0 +1,10 @@
# top-most EditorConfig file
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4
tab_width = 4

11
.eslintignore Normal file
View File

@@ -0,0 +1,11 @@
node_modules/
dist/
main.js
**/*.js
*.js
**/*.mjs
*.mjs

255
.eslintrc Normal file
View File

@@ -0,0 +1,255 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"env": {
"node": true
},
"plugins": [
"@typescript-eslint",
"deprecation",
"prettier",
"import",
"jsdoc",
"@stylistic"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsdoc/recommended-typescript"
],
"parserOptions": {
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"prettier/prettier": "warn",
"array-callback-return": ["error"],
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_",
"args": "none"
}
],
"no-warning-comments": [
"warn",
{
"terms": ["@todo"],
"location": "anywhere"
}
],
"no-unused-vars": "off",
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off",
"deprecation/deprecation": "warn",
"no-console": "error",
"max-len": [
"warn",
{
"code": 100,
"comments": 100,
"ignoreUrls": true
}
],
"@typescript-eslint/naming-convention": [
"warn",
{
"selector": "classProperty",
"modifiers": ["private"],
"format": [],
"custom": {
"regex": "^(_{1,2}I[A-Z][a-zA-Z0-9]*_?|_{1,2}[a-z][a-zA-Z0-9]*)$",
"match": true
}
},
{
"selector": "classProperty",
"modifiers": ["private", "readonly"],
"format": [],
"custom": {
"regex": "^(_{1,2}I[A-Z][a-zA-Z0-9]*_?|_{1,2}[a-z][a-zA-Z0-9]*|_{2}[a-zA-Z][a-zA-Z0-9]*)$",
"match": true
}
},
{
"selector": "classProperty",
"modifiers": ["protected"],
"format": [],
"custom": {
"regex": "^(_{1,2}I[A-Z][a-zA-Z0-9]*_?|_{1,2}[a-z][a-zA-Z0-9]*)$",
"match": true
}
},
{
"selector": ["typeProperty", "classProperty"],
"types": ["boolean"],
"format": ["PascalCase"],
"prefix": ["is", "has", "can", "did", "will", "should"],
"leadingUnderscore": "allow"
},
{
"selector": "memberLike",
"modifiers": ["public"],
"format": ["camelCase"],
"leadingUnderscore": "forbid",
"filter": {
"regex": "^(Events|Styles|Classes|Then|TextContent|El)$",
"match": false
}
},
{
"selector": "typeProperty",
"modifiers": ["public"],
"format": null,
"filter": {
"regex": ".*-event$",
"match": true
},
"custom": {
"regex": "^[a-z]+(-[a-z]+)*-event$",
"match": true
}
},
{
"selector": "typeProperty",
"modifiers": ["public"],
"format": ["camelCase"],
"filter": {
"regex": ".*-event$|^(Events|Styles|Classes|Then|TextContent|El)$",
"match": false
}
}
],
"@typescript-eslint/no-unused-expressions": "off",
"@stylistic/padding-line-between-statements": [
"warn",
{
"blankLine": "always",
"prev": "*",
"next": [
"return",
"if",
"multiline-const",
"function",
"multiline-expression",
"multiline-let",
"block-like"
]
},
{
"blankLine": "always",
"prev": ["function"],
"next": "*"
}
],
"import/order": [
"warn",
{
"groups": [
["builtin", "external"],
["internal"],
["parent", "sibling"]
],
"newlines-between": "never",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
"jsdoc/no-undefined-types": [
"warn",
{
"disableReporting": true,
"markVariablesAsUsed": true
}
],
"jsdoc/require-jsdoc": [
"warn",
{
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
"ArrowFunctionExpression": false,
"FunctionExpression": false
},
"minLineCount": 10
}
],
"jsdoc/require-param": [
"warn",
{
"exemptedBy": ["deprecated", "inheritdoc"]
}
],
"jsdoc/require-description": [
"warn",
{
"contexts": [
"FunctionDeclaration",
"MethodDefinition",
"ClassDeclaration",
"ClassExpression"
],
"descriptionStyle": "body",
"exemptedBy": ["deprecated", "inheritdoc"]
}
],
"jsdoc/require-returns": [
"warn",
{
"checkGetters": false,
"exemptedBy": ["deprecated", "inheritdoc"]
}
],
"jsdoc/check-tag-names": [
"warn",
{
"definedTags": ["remarks", "jest-environment", "singleton"]
}
],
"jsdoc/check-alignment": "warn",
"jsdoc/check-indentation": "warn",
"jsdoc/no-restricted-syntax": [
"error",
{
"contexts": [
{
"context": "MethodDefinition[kind='get']",
"comment": "JsdocBlock:has(JsdocTag[tag='returns'])",
"message": "JSDoc @returns comments are not allowed in getters."
}
]
}
],
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/explicit-function-return-type": [
"warn",
{
"allowExpressions": true,
"allowTypedFunctionExpressions": true,
"allowHigherOrderFunctions": true
}
],
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
"@typescript-eslint/no-misused-promises": "warn",
"@typescript-eslint/prefer-optional-chain": "warn"
},
"overrides": [
{
"files": ["*.test.ts", "*.spec.ts"],
"rules": {
"jsdoc/require-jsdoc": "off",
"jsdoc/require-param": "off",
"jsdoc/require-description": "off",
"jsdoc/require-returns": "off",
"@typescript-eslint/explicit-function-return-type": "off"
}
}
]
}

20
.prettierrc.json Normal file
View File

@@ -0,0 +1,20 @@
{
"printWidth": 80,
"semi": true,
"singleQuote": true,
"bracketSpacing": true,
"useTabs": false,
"tabWidth": 4,
"endOfLine": "auto",
"overrides": [
{
"files": [
".prettierrc",
".eslintrc"
],
"options": {
"parser": "json"
}
}
]
}

22
jest.config.cjs Normal file
View File

@@ -0,0 +1,22 @@
module.exports = {
setupFilesAfterEnv: ['./scripts/jest.setup.js'],
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/__tests__/**/*.test.ts', '**/?(*.)+(test).ts'],
testPathIgnorePatterns: ['\\.spec\\.ts$', '\\.performance\\.test\\.ts$'],
moduleDirectories: ['node_modules', 'src'],
moduleNameMapper: {
'^src/(.*)$': '<rootDir>/src/$1',
},
collectCoverage: true,
coverageDirectory: '.locale/coverage',
coverageReporters: ['text', 'lcov'],
coverageThreshold: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70,
},
},
};

41
package.json Normal file
View File

@@ -0,0 +1,41 @@
{
"name": "vhdldoc",
"version": "1.0.0",
"description": "VHDL Documentation Generator using web-tree-sitter",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"start": "ts-node -r tsconfig-paths/register src/index.ts",
"lint": "eslint --ext .ts .",
"lint:fix": "eslint --fix --ext .ts .",
"format": "prettier --write .",
"test": "jest",
"test:watch": "jest --watch",
"docs": "typedoc"
},
"author": "",
"license": "MIT",
"devDependencies": {
"@stylistic/eslint-plugin": "^2.6.2",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.11",
"@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.1.0",
"eslint": "^8.56.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^50.2.2",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"ts-jest": "^29.2.3",
"ts-node": "^10.9.2",
"typedoc": "^0.26.5",
"typescript": "^5.5.3"
},
"dependencies": {
"ts-injex": "github:PxaMMaxP/TSinjex",
"wavedrom": "^3.5.0",
"web-tree-sitter": "^0.22.3"
}
}

34
tsconfig.json Normal file
View File

@@ -0,0 +1,34 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"moduleResolution": "node",
"baseUrl": "src", // ⚠️ Wichtig: Startpunkt für Pfad-Aliase
"paths": {
"*": ["*", "./*"] // ⚠️ Ermöglicht z. B. import { X } from 'elements/X'
},
"outDir": "./dist",
"rootDir": "./src",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"inlineSources": true,
"allowJs": true,
"importHelpers": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"isolatedModules": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"strict": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"lib": ["ES2020", "DOM"]
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
}

18
typedoc.json Normal file
View File

@@ -0,0 +1,18 @@
{
"entryPoints": [
"src/**/*.ts"
],
"out": ".locale/docs",
"tsconfig": "tsconfig.json",
"excludePrivate": false,
"excludeProtected": false,
"excludeExternals": false,
"includeVersion": true,
"readme": "README.md",
"exclude": [
"**/*.test.ts",
"**/*.spec.ts"
],
"theme": "default",
"hideGenerator": true
}