Skip to content

Commit

Permalink
tests green, linting works
Browse files Browse the repository at this point in the history
  • Loading branch information
merrycoder committed Dec 31, 2024
1 parent eaf394e commit 19e6c33
Show file tree
Hide file tree
Showing 50 changed files with 892 additions and 110 deletions.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce / see the bug:
1. Go to '...'
2. Click on '....'
3. See error

**Expected behavior**
A clear and concise description of what you expected to happen / to see.

**Videos / screenshots**
If applicable, add a video or screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Problem description**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]. How can others profit from the change. What's the main benefit.

**Desired Solution**
A clear and concise description of what you want to happen.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Question
about: Ask something

---

## Main topic

<!--- Delete topics that do not aply -->

- Technical understanding
- Missing documentation
- Contributing and community
- ...

## Precise and short description of your question
_description_
107 changes: 105 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,111 @@
// @ts-check

import eslint from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import jsonc from 'eslint-plugin-jsonc';
import prettier from 'eslint-plugin-prettier';
import prettierRecommended from 'eslint-plugin-prettier/recommended';
import tseslint from 'typescript-eslint';

export default tseslint.config(
tseslint.configs.strict,
tseslint.configs.recommended,
);

/*****************************************************************************************
* IGNORES
* ---------------------------------------------------------------------------------------
* GLOB patterns for files and directories to be ignored by ESLint completely.
*
* @see https://eslint.org/docs/latest/use/configure/ignore
*****************************************************************************************/
{
ignores: ['**/.github/*', '**/node_modules/*', '**/dist/*', '**/package-lock.json']
},

/*****************************************************************************************
* PROJECT CONFIGURATION
* ---------------------------------------------------------------------------------------
* These configurations are valid for all files, independent of their type.
* Type-specific adjustments are configured explicitly in specific sections individually.
*
* @see https://eslint.org/docs/latest/use/configure/plugins
* @see https://eslint.org/docs/latest/use/configure/parser
*****************************************************************************************/

// Default settings from prettier.
prettierRecommended,

// Disable deprecated formatting rules.
// @see https://eslint.org/blog/2023/10/deprecating-formatting-rules/
eslintConfigPrettier,

// Default settings from eslint.
eslint.configs.recommended,

// Default settings from TS.
...tseslint.configs.recommended,

// Default settings from jsonc.
...jsonc.configs['flat/recommended-with-jsonc'],

/*****************************************************************************************
* DEFAULT CONFIGURATION
* ---------------------------------------------------------------------------------------
* These rules and styles are valid for all code-files, independent of their type.
* Type-specific adjustments are configured explicitly in specific sections individually.
*
* @see https://eslint.org/docs/latest/use/configure/rules
*****************************************************************************************/
{
plugins: {
prettier
},
rules: {
// Prefer const over function.
'func-style': ['error', 'expression'],
// Forbid relative imports.
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['./', '../'],
message: 'Relative imports are not allowed.'
}
]
}
],
// Disallow unused variables unless they are prefixed with "_" (e.g. _myVar).
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
],
// Prettier configuration right here rather in a separate file.
// @see https://prettier.io/docs/en/options
'prettier/prettier': [
'error',
{
singleQuote: true,
printWidth: 100,
trailingComma: 'none',
arrowParens: 'avoid'
}
],
// Default 20. Enforce lower cyclomatic complexity.
complexity: ['error', 15],
// Default is 4. Enforce lower value for higher readability.
'max-depth': ['error', 2],
// Default is 3. Allow 2 more parameters.
'max-params': ['error', 5],
// Default is 10. Increase value explicitly.
'max-statements': ['error', 25],
// Enforce the use of the shorthand syntax.
'object-shorthand': 'error',
// Proper logger must be used instead of console.log.
'no-console': 'error'
}
}
);
30 changes: 30 additions & 0 deletions examples/swissrets-min.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"created": "2023-03-23T08:11:12Z",
"generator": {
"name": "CASAGATEWAY",
"version": "0.9"
},
"properties": [
{
"id": "amIuniqueOrAmI",
"referenceId": "kj3kj3kj38ss",
"type": "buy",
"address": {
"countryCode": "CH",
"locality": "Bern",
"postalCode": "3000"
},
"availability": {
"state": "private",
"start": "2023-03-23T08:11:12Z",
"expiration": "2023-03-23T08:11:12Z"
},
"localizations": [
{
"languageCode": "de",
"title": "Doppelhaushälfte"
}
]
}
]
}
9 changes: 4 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// jest.config.js
/** @type {import('ts-jest').JestConfigWithTsJest} */
// eslint-disable-next-line no-undef
module.exports = {
preset: 'ts-jest',
testMatch: ['**/*.spec.ts'],
moduleNameMapper: {
'^src/(.*)$': '<rootDir>/src/$1',
},
}
'^src/(.*)$': '<rootDir>/src/$1'
}
};
Loading

0 comments on commit 19e6c33

Please sign in to comment.