Add shareable config TS files and tsconfig.json

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-01-21 15:18:20 +04:00
parent 6d75d64ba9
commit bcc9de804e
6 changed files with 113 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
import * as js from "@eslint/js";
export const baseConfigs = [
{ ignores: ["dist", "node_modules", "**/*.d.ts"] },
js.configs.recommended,
];

View File

@@ -0,0 +1,35 @@
import { browser, es2022, es2023, node } from "globals"
export const browserLanguageOptionsConfig = {
languageOptions: {
// Same as the ones we use in our tsconfig compilerOptions.lib for browser
ecmaVersion: 2022,
globals: {
...browser,
...es2022,
},
sourceType: "module",
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
},
},
};
export const nodeLanguageOptionsConfig = {
languageOptions: {
// Same as the ones we use in our tsconfig compilerOptions.lib for node
ecmaVersion: 2023,
globals: {
...node,
...es2023,
},
sourceType: "module",
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
},
},
};

View File

@@ -0,0 +1,8 @@
import * as react from "eslint-plugin-react";
import * as reactHooks from "eslint-plugin-react-hooks";
export const reactConfigs = [
react.configs.flat.recommended,
react.configs.flat["jsx-runtime"],
reactHooks.configs.flat.recommended,
];

View File

@@ -0,0 +1,24 @@
import stylistic from "@stylistic/eslint-plugin";
export const stylisticConfigs = [
stylistic.configs.customize({
arrowParens: false, // Will actually set it to "as-needed"
blockSpacing: true,
braceStyle: "1tbs",
commaDangle: "always-multiline",
indent: 2,
quotes: "double",
quoteProps: "consistent-as-needed",
semi: true,
jsx: true,
severity: "error",
}),
{
rules: {
"@stylistic/max-len": [
"warn",
{ code: 120, ignoreUrls: true, ignoreStrings: true },
],
},
},
];

View File

@@ -0,0 +1,22 @@
import tseslint from "typescript-eslint";
export const tsConfigs = [
...tseslint.configs.recommendedTypeChecked,
{
files: ["**/*.{ts,tsx}"],
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
},
],
},
},
];

View File

@@ -0,0 +1,18 @@
{
"complierOptions": {
"lib": ["ES2023"],
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "nodenext",
"moduleDetection": "force",
"verbatimModuleSyntax": true,
"noEmit": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["./*.ts"]
}