Files
tuono/eslintrc.cjs
T
2024-04-27 10:40:38 +02:00

108 lines
2.8 KiB
JavaScript

// @ts-check
/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
reportUnusedDisableDirectives: true,
ignorePatterns: ["**/build", "**/dist"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "import"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/stylistic",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier",
],
env: {
browser: true,
es2020: true,
},
parserOptions: {
tsconfigRootDir: __dirname,
project: true,
sourceType: "module",
ecmaVersion: 2020,
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: true,
},
react: {
version: "detect",
},
},
rules: {
"@typescript-eslint/array-type": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports" },
],
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/method-signature-style": ["error", "property"],
"@typescript-eslint/naming-convention": [
"error",
{
selector: "typeParameter",
format: ["PascalCase"],
leadingUnderscore: "forbid",
trailingUnderscore: "forbid",
custom: {
regex: "^(T|T[A-Z][A-Za-z]+)$",
match: true,
},
},
],
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-inferrable-types": [
"error",
{ ignoreParameters: true },
],
"import/default": "error",
"import/export": "error",
"import/namespace": "error",
"import/newline-after-import": "error",
"import/no-cycle": "error",
"import/no-duplicates": "off",
"import/no-named-as-default-member": "error",
"import/no-unused-modules": "error",
"import/order": [
"error",
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type",
],
},
],
"no-case-declarations": "error",
"no-empty": "error",
"no-prototype-builtins": "error",
"no-redeclare": "error",
"no-shadow": "error",
"no-undef": "error",
"sort-imports": "error",
},
};
module.exports = config;