Skip to content

Instantly share code, notes, and snippets.

@lprhodes
Created April 19, 2022 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lprhodes/8f64d75e81d410d8ab117848556ba2ca to your computer and use it in GitHub Desktop.
Save lprhodes/8f64d75e81d410d8ab117848556ba2ca to your computer and use it in GitHub Desktop.
Parenthoods opinionated eslint, tsconfig and prettier
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "prettier"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier"
],
"rules": {
"prettier/prettier": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/member-delimiter-style": [
"error",
{
"multiline": {
"delimiter": "none",
"requireLast": false
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/array-type": [
"warn",
{
"default": "array"
}
],
"@typescript-eslint/brace-style": "error",
"comma-dangle": "off",
"@typescript-eslint/comma-dangle": "warn",
"@typescript-eslint/default-param-last": "error",
"@typescript-eslint/dot-notation": "warn",
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/explicit-member-accessibility": "warn",
"func-call-spacing": "off",
"@typescript-eslint/func-call-spacing": "error",
"indent": "off",
"@typescript-eslint/indent": "off",
"keyword-spacing": "off",
"@typescript-eslint/keyword-spacing": "error",
"lines-between-class-members": "off",
"@typescript-eslint/lines-between-class-members": [
"error",
{
"exceptAfterOverload": true
}
],
"@typescript-eslint/method-signature-style": "error",
"@typescript-eslint/consistent-type-assertions": [
"error",
{ "assertionStyle": "as", "objectLiteralTypeAssertions": "never" }
],
"@typescript-eslint/no-base-to-string": "warn",
"@typescript-eslint/no-confusing-non-null-assertion": "warn",
"@typescript-eslint/no-confusing-void-expression": "warn",
"@typescript-eslint/no-dupe-class-members": "error",
"no-duplicate-imports": "off",
"@typescript-eslint/no-duplicate-imports": "error",
"@typescript-eslint/no-dynamic-delete": "warn",
"no-extra-parens": "off",
"@typescript-eslint/no-extra-parens": ["warn", "functions"],
"@typescript-eslint/no-extraneous-class": "warn",
"@typescript-eslint/no-implicit-any-catch": "error",
"no-invalid-this": "off",
"@typescript-eslint/no-invalid-this": "error",
"@typescript-eslint/no-invalid-void-type": "error",
"no-loop-func": "off",
"@typescript-eslint/no-loop-func": "error",
"no-loss-of-precision": "off",
"@typescript-eslint/no-loss-of-precision": "error",
"@typescript-eslint/type-annotation-spacing": [
"error",
{
"before": false,
"after": true,
"overrides": { "arrow": { "before": true, "after": true } }
}
],
"@typescript-eslint/no-redeclare": "error",
"@typescript-eslint/no-require-imports": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/no-throw-literal": "error",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-arguments": "warn",
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": [
"error",
{ "functions": false, "classes": false, "variables": false }
],
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/non-nullable-type-assertion-style": "error",
"object-curly-spacing": "off",
"@typescript-eslint/object-curly-spacing": ["error", "always"],
"@typescript-eslint/prefer-enum-initializers": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-literal-enum-member": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/require-array-sort-compare": "warn",
"no-return-await": "off",
"@typescript-eslint/return-await": ["error", "never"],
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/prefer-ts-expect-error": "error",
"@typescript-eslint/promise-function-async": "error",
"quotes": "off",
// "@typescript-eslint/quotes": ["error", "single"],
"@typescript-eslint/sort-type-union-intersection-members": "warn",
"space-infix-ops": "off",
"@typescript-eslint/space-infix-ops": ["error", { "int32Hint": false }],
"@typescript-eslint/strict-boolean-expressions": [
"warn",
{
"allowString": true,
"allowNumber": true,
"allowNullableObject": true,
"allowNullableBoolean": true,
"allowNullableString": true,
"allowNullableNumber": true
}
],
"@typescript-eslint/switch-exhaustiveness-check": "warn",
"@typescript-eslint/unified-signatures": "error",
// Prevent explicity any
"@typescript-eslint/no-explicit-any": [
"error",
{
"fixToUnknown": true
}
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": ["function", "typeMethod", "classMethod", "objectLiteralMethod"],
"format": ["camelCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
},
{
"selector": ["typeProperty"],
"format": ["camelCase", "PascalCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
},
{
"selector": "variable",
"modifiers": ["destructured"],
"format": null
},
{
"selector": ["variable", "classProperty", "accessor"],
"format": ["camelCase", "UPPER_CASE", "PascalCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
},
{
"selector": ["parameter", "parameterProperty"],
"format": ["camelCase", "UPPER_CASE", "PascalCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "forbid"
},
{
"selector": ["enum", "enumMember", "class", "interface", "typeAlias", "typeParameter"],
"format": ["PascalCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid"
}
]
}
}
{
"semi": false,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 4,
"quoteProps": "consistent",
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "auto"
}
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"^/*": ["*"]
},
"target": "ES2021",
"module": "commonjs",
"lib": ["es2021", "dom"],
"declaration": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": false,
"inlineSourceMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"strictPropertyInitialization": false,
"forceConsistentCasingInFileNames": true,
"outDir": "./lib",
"esModuleInterop": true,
"types": ["node", "jest"],
"resolveJsonModule": true
},
"include": ["/**/src"],
"exclude": ["/**/node_modules", "/**/lib"],
"env": {
"node": true,
"jest": true
},
"lib": ["es2020", "dom"],
"plugins": ["@typescript-eslint"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"modules": true
}
},
"settings": {
"react": {
"version": "detect"
}
},
"typedocOptions:": {
"entryPoints": ["**/src"],
"exclude": ["lib", "node_modules"],
"excludeExternals": true,
"mode": "modules"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment