add eslint config

This commit is contained in:
Clement 2024-04-25 18:26:06 +02:00
parent 4761fef61b
commit b1fce87215
2 changed files with 332 additions and 0 deletions

8
front/.eslintignore Normal file
View File

@ -0,0 +1,8 @@
node_modules
out
.next
next-env.d.ts
*.js
__tests__

324
front/.eslintrc.json Normal file
View File

@ -0,0 +1,324 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:astro/recommended",
"plugin:@typescript-eslint/strict",
"plugin:@typescript-eslint/stylistic"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"overrides": [
{
"files": [
"*.astro"
],
"parser": "astro-eslint-parser",
"parserOptions": {
"extraFileExtensions": [
".astro"
],
"parser": "@typescript-eslint/parser"
}
},
{
"files": [
"*.ts",
"*.tsx",
"*.astro"
],
"rules": {
"no-extra-parens": "off",
"no-unused-expressions": "off",
"no-shadow": "off",
"quotes": "off",
"semi": "off",
"space-before-function-paren": "off"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"project": "tsconfig.json",
"sourceType": "module",
"ecmaVersion": 2018
}
},
"plugins": [
"@typescript-eslint"
],
"root": true,
"rules": {
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/space-before-function-paren": [
"error",
{
"anonymous": "never",
"asyncArrow": "always",
"named": "never"
}
],
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unified-signatures": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": [
"error",
{
"default": "generic"
}
],
"arrow-body-style": "error",
"arrow-parens": [
"error",
"always"
],
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"{}": false
}
}
],
"complexity": [
"warn",
10
],
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"constructor-super": "error",
"curly": "error",
"dot-notation": "error",
"eol-last": "error",
"eqeqeq": [
"error",
"smart"
],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "explicit"
}
],
"for-direction": "error",
"getter-return": "error",
"guard-for-in": "error",
"id-blacklist": [
"error",
"any",
"Number",
"number",
"String",
"string",
"Boolean",
"boolean",
"Undefined"
],
"id-length": [
"warn",
{
"exceptions": [
"_"
]
}
],
"id-match": "error",
"indent": [
"error",
"tab",
{
"SwitchCase": 1
}
],
"linebreak-style": [
"error",
"unix"
],
"max-classes-per-file": [
"error",
1
],
"max-depth": [
"warn",
2
],
"max-len": [
"warn",
{
"code": 256
}
],
"@typescript-eslint/member-delimiter-style": [
"error",
{
"multiline": {
"delimiter": "none",
"requireLast": true
},
"singleline": {
"delimiter": "comma",
"requireLast": false
}
}
],
"@typescript-eslint/member-ordering": "error",
"new-parens": "error",
"no-async-promise-executor": "error",
"no-await-in-loop": "warn",
"no-bitwise": "error",
"no-caller": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-console": "off",
"no-constant-condition": "error",
"no-control-regex": "warn",
"no-debugger": "error",
"no-delete-var": "error",
"no-dupe-args": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
"no-empty-character-class": "error",
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"no-eval": "error",
"no-ex-assign": "error",
"@typescript-eslint/no-explicit-any": "off",
"no-extra-boolean-cast": "error",
"no-extra-parens": "off",
"@typescript-eslint/no-extra-parens": [
"error",
"all",
{
"ignoreJSX": "all"
}
],
"no-extra-semi": "error",
"no-fallthrough": "off",
"no-func-assign": "error",
"no-import-assign": "error",
"no-inner-declarations": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-label-var": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"@typescript-eslint/no-misused-new": "error",
"no-multiple-empty-lines": "error",
"@typescript-eslint/no-namespace": "error",
"no-new-wrappers": "error",
"no-obj-calls": "error",
"no-promise-executor-return": "error",
"@typescript-eslint/no-parameter-properties": "off",
"no-prototype-builtins": "error",
"no-regex-spaces": "error",
"no-setter-return": "error",
"@typescript-eslint/no-shadow": "error",
"no-shadow": [
"error",
{
"builtinGlobals": false,
"hoist": "all"
}
],
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-template-curly-in-string": "warn",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef": "error",
"no-undef-init": "error",
"no-underscore-dangle": "off",
"no-unexpected-multiline": "error",
"no-unreachable": "warn",
"no-unreachable-loop": "warn",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-expressions": [
"error",
{
"allowTernary": true
}
],
"@typescript-eslint/no-unused-expressions": [
"error",
{
"allowTernary": true
}
],
"no-unused-labels": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", {
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}],
"@typescript-eslint/no-non-null-assertion": ["warn"],
"no-var": "error",
"object-shorthand": [
"warn",
"methods"
],
"one-var": [
"error",
"never"
],
"prefer-const": "error",
"quote-props": [
"error",
"consistent-as-needed"
],
"quotes": "off",
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true
}
],
"radix": "error",
"require-atomic-updates": "warn",
"semi": "off",
"@typescript-eslint/semi": [
"error",
"never"
],
"space-before-function-paren": [
"error",
{
"anonymous": "never",
"asyncArrow": "always",
"named": "never"
}
],
"spaced-comment": ["error", "always", { "block": { "exceptions": ["*"] } }],
"use-isnan": "error",
"valid-typeof": "warn"
}
}