mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-03-07 02:33:38 +00:00
78 lines
3.4 KiB
JavaScript
78 lines
3.4 KiB
JavaScript
import js from "@eslint/js";
|
|
import stylistic from "@stylistic/eslint-plugin";
|
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
import reactRefresh from "eslint-plugin-react-refresh";
|
|
import simpleImportSort from "eslint-plugin-simple-import-sort";
|
|
import tseslint from "typescript-eslint";
|
|
|
|
export default tseslint.config(
|
|
{ ignores: ["dist"] },
|
|
{
|
|
extends: [js.configs.recommended, ...tseslint.configs.recommendedTypeChecked],
|
|
files: ["src/**/*.{ts,tsx}"],
|
|
languageOptions: {
|
|
parserOptions: {
|
|
projectService: true,
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
},
|
|
plugins: {
|
|
"react-hooks": reactHooks,
|
|
"react-refresh": reactRefresh,
|
|
"simple-import-sort": simpleImportSort,
|
|
"@stylistic": stylistic,
|
|
},
|
|
rules: {
|
|
...reactHooks.configs.recommended.rules,
|
|
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
|
|
|
|
// imports
|
|
"simple-import-sort/exports": "error",
|
|
"simple-import-sort/imports": "error",
|
|
|
|
// core
|
|
"curly": "error",
|
|
"eqeqeq": "error",
|
|
"no-console": "error",
|
|
"no-eval": "error",
|
|
|
|
// stylistic
|
|
"@stylistic/array-bracket-spacing": ["error", "never"],
|
|
"@stylistic/arrow-parens": ["error", "as-needed"],
|
|
"@stylistic/brace-style": ["error", "1tbs"],
|
|
"@stylistic/comma-dangle": ["error", "always-multiline"],
|
|
"@stylistic/comma-spacing": ["error", { before: false, after: true }],
|
|
"@stylistic/eol-last": ["error", "always"],
|
|
"@stylistic/indent": ["error", 4],
|
|
"@stylistic/jsx-curly-brace-presence": ["error", { props: "never", children: "never" }],
|
|
"@stylistic/jsx-quotes": ["error", "prefer-double"],
|
|
"@stylistic/jsx-self-closing-comp": ["error", { component: true, html: true }],
|
|
"@stylistic/max-len": ["error", {
|
|
code: 120,
|
|
ignoreComments: true,
|
|
ignoreStrings: true,
|
|
ignoreTemplateLiterals: true,
|
|
ignoreUrls: true,
|
|
}],
|
|
"@stylistic/member-delimiter-style": ["error", { multiline: { delimiter: "semi" }, singleline: { delimiter: "semi" } }],
|
|
"@stylistic/no-extra-parens": ["error", "all"],
|
|
"@stylistic/no-multi-spaces": "error",
|
|
"@stylistic/no-multiple-empty-lines": ["error", { max: 1 }],
|
|
"@stylistic/no-trailing-spaces": "error",
|
|
"@stylistic/object-curly-spacing": ["error", "always"],
|
|
"@stylistic/quotes": ["error", "double"],
|
|
"@stylistic/semi": ["error", "always"],
|
|
|
|
// typescript
|
|
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
|
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }],
|
|
"@typescript-eslint/explicit-function-return-type": ["error", { allowExpressions: true }],
|
|
"@typescript-eslint/no-deprecated": "error",
|
|
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
|
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
|
"@typescript-eslint/prefer-optional-chain": "error",
|
|
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
},
|
|
},
|
|
);
|