mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-30 11:19:12 +01:00
* feat: update prettier configuration for print width * chore: apply code formatting to entire repository * fix: remove build files * fix: format issue --------- Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
81 lines
3.0 KiB
JavaScript
81 lines
3.0 KiB
JavaScript
/** @type {import("eslint").Linter.Config} */
|
|
const config = {
|
|
extends: [
|
|
"turbo",
|
|
"eslint:recommended",
|
|
"plugin:@typescript-eslint/recommended-type-checked",
|
|
"plugin:@typescript-eslint/stylistic-type-checked",
|
|
"prettier",
|
|
],
|
|
env: {
|
|
es2022: true,
|
|
node: true,
|
|
},
|
|
parser: "@typescript-eslint/parser",
|
|
parserOptions: {
|
|
project: true,
|
|
},
|
|
plugins: ["@typescript-eslint", "import"],
|
|
rules: {
|
|
"id-length": [
|
|
"warn",
|
|
{
|
|
min: 3,
|
|
exceptions: ["_", "i", "z", "t", "id", "db"], // _ for unused variables, i for index, z for zod, t for translation
|
|
properties: "never", // This allows for example the use of <Grid.Col span={{ sm: 12, md: 6 }}> as sm and md would be too short
|
|
},
|
|
],
|
|
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
"turbo/no-undeclared-env-vars": "off",
|
|
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
|
|
"@typescript-eslint/consistent-type-imports": [
|
|
"warn",
|
|
{ prefer: "type-imports", fixStyle: "separate-type-imports" },
|
|
],
|
|
"@typescript-eslint/no-misused-promises": [2, { checksVoidReturn: { attributes: false } }],
|
|
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
"no-restricted-syntax": [
|
|
"error",
|
|
{
|
|
selector: "FunctionDeclaration[async=false][id.name=/Async$/]",
|
|
message: "Function ending in 'Async' must be declared async",
|
|
},
|
|
{
|
|
selector:
|
|
"FunctionDeclaration[async=true][id.name=/^[a-z].*$/][id.name=/ ^(?!generateMetadata$)[a-z].*$/][id.name!=/Async$/]",
|
|
message: "Async function name must end in 'Async' (function declaration)",
|
|
},
|
|
{
|
|
selector: "MethodDefinition[value.async=false][key.name=/Async$/]",
|
|
message: "Method ending in 'Async' must be declared async",
|
|
},
|
|
{
|
|
selector: "MethodDefinition[value.async=true][key.name!=/Async$/]",
|
|
message: "Async method name must end in 'Async'",
|
|
},
|
|
{
|
|
selector: "Property[value.type=/FunctionExpression$/][value.async=false][key.name=/Async$/]",
|
|
message: "Function ending in 'Async' must be declared async",
|
|
},
|
|
{
|
|
selector:
|
|
"Property[value.type=/FunctionExpression$/][value.async=true][key.name!=/^on(Success|Settled)$/][key.name!=/Async$/]",
|
|
message: "Async function name must end in 'Async' (property)",
|
|
},
|
|
{
|
|
selector: "VariableDeclarator[init.type=/FunctionExpression$/][init.async=false][id.name=/Async$/]",
|
|
message: "Function ending in 'Async' must be declared async",
|
|
},
|
|
{
|
|
selector:
|
|
"VariableDeclarator[init.type=/FunctionExpression$/][init.async=true][id.name=/^[a-z].*$/][id.name!=/Async$/]",
|
|
message: "Async function name must end in 'Async' (variable declarator)",
|
|
},
|
|
],
|
|
},
|
|
ignorePatterns: ["**/.eslintrc.cjs", "**/*.config.js", "**/*.config.cjs", ".next", "dist", "pnpm-lock.yaml"],
|
|
reportUnusedDisableDirectives: true,
|
|
};
|
|
|
|
module.exports = config;
|