Skip to content

Commit

Permalink
Reduce linting config
Browse files Browse the repository at this point in the history
  • Loading branch information
zoontek committed Jan 8, 2025
1 parent e0df7ce commit 1533845
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 26 deletions.
49 changes: 23 additions & 26 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ import globals from "globals";
import ts from "typescript-eslint";
import swan from "./scripts/eslint/index.mjs";

const typescriptRules = [
ts.configs.eslintRecommended,
...ts.configs.recommended,
...ts.configs.recommendedTypeChecked,
]
const typescriptRules = [ts.configs.eslintRecommended, ...ts.configs.recommended]
.map(config => config.rules)
.reduce((acc, rules) => ({ ...acc, ...rules }), {});

Expand All @@ -22,16 +18,19 @@ export default [
"**/*.d.ts",
"**/*.js",
"**/*.mjs",
"**/graphql/**/*.ts",

"**/graphql/*.ts",
"docs/**",
"node_modules/**",
"playwright.config.ts",
"scripts/**",
"server/dist/**",
"tests/**",
"vite.config.ts",
"vite.config.js",
],
},
{
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
files: ["clients/*/src/**/*.ts", "clients/*/src/**/*.tsx", "server/src/**/*.ts"],

plugins: {
react,
Expand All @@ -51,7 +50,7 @@ export default [
},
parserOptions: {
tsconfigRootDir: import.meta.dirname,
projectService: true,
projectService: false,
},
},

Expand All @@ -61,11 +60,13 @@ export default [

curly: "warn",
"no-extra-boolean-cast": "off",
"no-param-reassign": "error",
"no-implicit-coercion": "error",
"no-param-reassign": "error",
"no-var": "error",
"prefer-const": "error",
"object-shorthand": "warn",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"no-empty": ["error", { allowEmptyCatch: true }],

"@typescript-eslint/no-unused-vars": [
Expand All @@ -79,24 +80,20 @@ export default [
],

"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/no-base-to-string": "error",
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-object-type": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-arguments": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/require-await": "error",
"@typescript-eslint/strict-boolean-expressions": "error",

"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-unnecessary-type-constraint": "error",
"@typescript-eslint/no-unsafe-declaration-merging": "error",
"@typescript-eslint/no-unsafe-function-type": "error",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/only-throw-error": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/no-wrapper-object-types": "error",
"@typescript-eslint/prefer-as-const": "error",

"react/jsx-boolean-value": ["error", "always"],

Expand Down
1 change: 1 addition & 0 deletions server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"allowSyntheticDefaultImports": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"forceConsistentCasingInFileNames": false,

"typeRoots": ["types", "node_modules/@types"]
}
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"allowSyntheticDefaultImports": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"forceConsistentCasingInFileNames": false,

"typeRoots": ["types", "node_modules/@types"]
}
Expand Down

0 comments on commit 1533845

Please sign in to comment.