Add shareable config TS files and tsconfig.json
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
6
packages/eslint-config/baseConfigs.ts
Normal file
6
packages/eslint-config/baseConfigs.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import * as js from "@eslint/js";
|
||||||
|
|
||||||
|
export const baseConfigs = [
|
||||||
|
{ ignores: ["dist", "node_modules", "**/*.d.ts"] },
|
||||||
|
js.configs.recommended,
|
||||||
|
];
|
||||||
35
packages/eslint-config/languageOptionsConfigs.ts
Normal file
35
packages/eslint-config/languageOptionsConfigs.ts
Normal 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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
8
packages/eslint-config/reactConfigs.ts
Normal file
8
packages/eslint-config/reactConfigs.ts
Normal 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,
|
||||||
|
];
|
||||||
24
packages/eslint-config/stylisticConfigs.ts
Normal file
24
packages/eslint-config/stylisticConfigs.ts
Normal 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 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
22
packages/eslint-config/tsConfigs.ts
Normal file
22
packages/eslint-config/tsConfigs.ts
Normal 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
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
18
packages/eslint-config/tsconfig.json
Normal file
18
packages/eslint-config/tsconfig.json
Normal 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"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user