LU03b - Linter & Formatter Best Practices

Checkliste

Beispiele Overall

.editorconfig (wird von Prettier native unterstützt)

# Global settings (applied to all files unless overridden)
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
 
# Python files
[*.py]
indent_size = 4
 
# JavaScript/TypeScript files
[*.{js,ts,jsx,tsx,cjs,mjs}]
indent_size = 2
 
# HTML/CSS
[*.{html,css,scss}]
indent_size = 2
 
# JSON / YAML / config
[*.{json,yml,yaml}]
indent_size = 2

Beispiele Frontend

prettier.config.js

export default {
  semi: true,
  singleQuote: true,
  trailingComma: 'all',
  printWidth: 100,
};

eslint.config.js Für die ganze Konfigurationsdatei inklusive TSLint: https://github.com/AlexanderPeter/cicd/blob/develop/frontend/eslint.config.js

...
ignores: ['node_modules/**', 'dist/**'],
...
quotes: ['error', 'single'],
...
prettierConfig.default,
...

Beispiele Python

pyproject.toml

[tool.black]
line-length = 100
target-version = ['py311']
skip-string-normalization = true
extend-exclude = '''
/(
    generated
)/
'''

.pylintrc

[MASTER]
ignore=.venv,generated
 
[MESSAGES CONTROL]
 
# Disable the message, report, category or checker with the given id(s).
disable=
      invalid-name, # C0103
      C0114,  # Missing module docstring
      C0115,  # Missing class docstring
      C0116,  # Missing function or method docstring