RenaiApp/.eslintrc.json

240 lines
6.6 KiB
JSON

{
"root": true,
"plugins": ["@typescript-eslint", "import"],
"extends": ["eslint:recommended", "prettier", "plugin:import/recommended"],
"parserOptions": {
"ecmaVersion": 2019,
"sourceType": "module"
},
"env": {
"browser": true,
"node": true
},
"rules": {
"no-shadow": "warn",
"no-magic-numbers": ["warn", { "ignore": [-1, 0, 1, 2, 10, 100, 1000] }],
"no-param-reassign": "warn",
"prefer-template": "warn",
"prefer-arrow-callback": "warn",
"arrow-body-style": ["warn", "as-needed"],
"no-unused-expressions": "warn",
"prefer-const": "warn",
"max-classes-per-file": "warn",
"object-shorthand": ["warn", "methods"],
"no-useless-rename": "warn",
"prefer-promise-reject-errors": "error",
"eqeqeq": "warn",
"prefer-destructuring": [
"warn",
{
"VariableDeclarator": {
"array": false,
"object": true
},
"AssignmentExpression": {
"array": false,
"object": false
}
}
],
"no-constant-condition": ["warn", { "checkLoops": false }],
"no-throw-literal": "error",
"curly": "warn",
"no-promise-executor-return": "error",
"no-return-await": "error",
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"**/*.{spec,mock}.*",
"src/**/test/*",
"src/renderer.ts",
"src/renderer/**/*",
"declarations/**/*",
"templates/**/*",
"scripts/**/*"
]
}
],
"import/no-restricted-paths": [
"error",
{
"zones": [
{
"target": "./src/main",
"from": "./src",
"except": ["./main", "./shared"],
"message": "only import from main/shared"
},
{
"target": "./src/renderer",
"from": "./src",
"except": ["./renderer", "./shared"],
"message": "only import from renderer/shared"
},
{
"target": "./src/shared",
"from": "./src",
"except": ["./shared"],
"message": "only import from shared"
}
]
}
],
"import/no-default-export": "warn",
"import/first": "warn",
"import/order": [
"warn",
{
"alphabetize": {
"order": "asc"
}
}
]
},
"overrides": [
{
"files": ["**/*.ts"],
"extends": [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier/@typescript-eslint",
"plugin:import/typescript",
"plugin:import/electron"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"settings": {
"import/extensions": [".ts", "d.ts", ".js", ".json"],
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".d.ts"]
}
},
"rules": {
"no-console": "warn",
"no-magic-numbers": "off",
"no-shadow": "off",
"@typescript-eslint/ban-types": [
"warn",
{
"extendDefaults": true,
"types": {
"object": false
}
}
],
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-magic-numbers": [
"warn",
{
"ignore": [-1, 0, 1, 2, 10, 100, 1000],
"ignoreNumericLiteralTypes": true,
"ignoreReadonlyClassProperties": true,
"ignoreEnums": true
}
],
"@typescript-eslint/no-inferrable-types": [
"warn",
{
"ignoreParameters": true,
"ignoreProperties": true
}
],
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/no-empty-function": [
"warn",
{
"allow": ["arrowFunctions", "private-constructors", "protected-constructors"]
}
],
"@typescript-eslint/naming-convention": [
"warn",
{
"selector": "default",
"format": ["camelCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": ["variable", "enumMember"],
"format": ["camelCase", "UPPER_CASE"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": "typeLike",
"format": ["PascalCase"]
},
{
"selector": "function",
"modifiers": ["exported"],
"format": ["camelCase", "PascalCase"]
},
{
"selector": "objectLiteralProperty",
"format": null
},
{
"selector": "interface",
"format": ["PascalCase"],
"suffix": ["Interface"]
}
],
"@typescript-eslint/explicit-member-accessibility": "warn",
"@typescript-eslint/member-ordering": "warn",
"@typescript-eslint/array-type": ["warn", { "default": "array-simple" }],
"@typescript-eslint/restrict-template-expressions": [
"warn",
{
"allowNumber": true,
"allowBoolean": false,
"allowAny": false,
"allowNullish": false
}
],
"@typescript-eslint/no-shadow": ["warn"]
}
},
{
"files": ["src/renderer.ts", "src/renderer/**/*.ts"],
"parserOptions": {
"project": "./tsconfig.renderer.json"
}
},
{
"files": ["src/shared/types/**/*"],
"rules": {
"@typescript-eslint/no-magic-numbers": "off"
}
},
{
"files": ["src/main/migrations/**/*"],
"rules": {
"@typescript-eslint/class-name-casing": "off",
"@typescript-eslint/typedef": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/naming-convention": "off"
}
},
{
"files": ["**/*.{spec,mock}.*", "src/**/test/**/*"],
"rules": {
"no-unused-expressions": "off",
"prefer-promise-reject-errors": "off",
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/typedef": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/ban-ts-comment": "off"
}
}
]
}