ESLint Configuration#
This project uses a centralized ESLint configuration with the flat config API, supporting modern ECMAScript, React, TypeScript, and Next.js. The configuration enforces consistent code style and quality across backend, frontend, and shared packages.
ECMAScript Version and Source Type:
The configuration sets ecmaVersion to 'latest' and sourceType to 'module' for most files, ensuring support for the newest JavaScript features and ES modules (source).
React Plugin and Recommended Settings:
The React plugin (eslint-plugin-react) is included with recommended settings. React version detection is enabled via settings.react.version: 'detect'. The rule react/react-in-jsx-scope is turned off to support React 17+ JSX transforms (source).
Browser and Node Environment Setup:
The configuration applies environment and parser options for different areas of the codebase. For example, frontend files use Next.js core-web-vitals rules and reference the frontend tsconfig.json. Node-specific config files (such as jest.config.js, postcss.config.js, etc.) set sourceType to 'script' and define Node globals (source).
Rule Customizations:
Key custom rules include:
{
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' }
],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'react/react-in-jsx-scope': 'off',
'no-console': [
'warn',
{ allow: ['warn', 'error'] }
]
}
Variables and arguments prefixed with _ are ignored for unused checks. Explicit any and non-null assertions are disallowed. Console usage is warned except for console.warn and console.error (source).
Ignored Files and Directories:
Globally ignored patterns include: node_modules, dist, .next, coverage, src/examples, jest.config.*, postcss.config.*, tailwind.config.*, and next-env.d.ts (source).
Markdown Linting and Formatting#
Markdownlint Configuration:
Markdown files are linted using .markdownlint-cli2.jsonc, which enables default rules and customizes several for project style:
- Enforces heading increments and dash-style unordered lists.
- Sets 2-space indentation for lists (
MD007). - Disables line length (
MD013) and ordered list marker (MD029) rules. - Allows different nesting for headings (
MD024), permits<span>elements (MD033), enforces horizontal rule style (MD035: '---'), fenced code blocks (MD046), and backtick code block style (MD048). - Ignores
CHANGELOG.md,.venv,node_modules,__pycache__, and*.tpl.mdfiles. - Respects
.gitignoreand applies autofix (source).
Example excerpt:
{
"config": {
"default": true,
"heading-increment": true,
"ul-style": { "style": "dash" },
"MD007": { "indent": 2 },
"MD013": false,
"MD024": { "allow_different_nesting": true, "siblings_only": true },
"MD029": false,
"MD033": { "allowed_elements": ["span"] },
"MD035": { "style": "---" },
"MD046": { "style": "fenced" },
"MD048": { "style": "backtick" },
"first-line-h1": false,
"fenced-code-language": true
},
"gitignore": true,
"fix": true,
"globs": ["**/*.md"],
"ignores": ["CHANGELOG.md", ".venv/**", "**/node_modules/**", "**/__pycache__/**", "**/*.tpl.md"]
}
Markdown Formatting:
The .mdformat.toml file configures markdown formatting to validate and number headings. It uses the mkdocs plugin to align semantic breaks in lists and ignore missing references (source).
Example:
validate = true
number = true
[plugin.mkdocs]
align_semantic_breaks_in_lists = true
ignore_missing_references = true
EditorConfig Settings#
The .editorconfig file enforces consistent code style across editors:
- Sets root to true.
- Uses UTF-8 charset and LF line endings.
- Inserts a final newline.
- Trims trailing whitespace except in diff and markdown files.
- Uses 2 spaces for indentation in JavaScript, JSX, TypeScript, JSON, YAML, and other files (source).
Example:
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
[*.{js,jsx,ts,tsx,json,yml,yaml}]
indent_style = space
indent_size = 2
[*.{diff,md}]
trim_trailing_whitespace = false
Prettier Ignore Rules#
The .prettierignore file excludes files and directories from Prettier formatting to avoid conflicts and unnecessary formatting:
node_modules,dist,build,.next,coverage,test-results- All
.logfiles .envfiles and variants- All markdown files (
*.md,**/*.md) (source)
Example:
node_modules
dist
build
.next
coverage
test-results
*.log
.env
.env.*
# Ignore markdown docs from Prettier checks (per project preference)
*.md
**/*.md
Prettier Formatting Configuration#
The .prettierrc.json file sets formatting rules:
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"arrowParens": "always",
"endOfLine": "lf"
}
(source)
These configurations work together to enforce a consistent code style and quality across the project, covering JavaScript/TypeScript, React, markdown documentation, and editor/formatter behavior.