# Google TypeScript Style

Google's TypeScript style guide as a ready-made lint and format setup.

- Linter: ESLint
- Package: `gts` (https://github.com/google/gts)
- Author: Google (community)
- Rules: 71, plus 1 from plugins this site doesn't track
- Weekly downloads: 553.3K, +10.3% last quarter
- Technologies: javascript (52), typescript (19)

## Install

```sh
npm install -D gts
pnpm add -D gts
yarn add -D gts
bun add -d gts
```

## Config: `eslint.config.js`

```js
// eslint.config.js
import gts from "gts";

export default [
  ...gts,
];
```

## Rules it enables

| Rule | Severity | Description | Reach |
| --- | --- | --- | --- |
| [eslint/no-cond-assign](https://lintradar.dev/rules/eslint/no-cond-assign.md) | error | Disallow assignment operators in conditional expressions | 282.3M |
| [eslint/no-ex-assign](https://lintradar.dev/rules/eslint/no-ex-assign.md) | error | Disallow reassigning exceptions in `catch` clauses | 282.3M |
| [eslint/no-global-assign](https://lintradar.dev/rules/eslint/no-global-assign.md) | error | Disallow assignments to native objects or read-only global variables | 282.3M |
| [eslint/no-shadow-restricted-names](https://lintradar.dev/rules/eslint/no-shadow-restricted-names.md) | error | Disallow identifiers from shadowing restricted names | 282.3M |
| [eslint/no-sparse-arrays](https://lintradar.dev/rules/eslint/no-sparse-arrays.md) | error | Disallow sparse arrays | 282.3M |
| [eslint/use-isnan](https://lintradar.dev/rules/eslint/use-isnan.md) | error | Require calls to `isNaN()` when checking for `NaN` | 282.3M |
| [eslint/no-control-regex](https://lintradar.dev/rules/eslint/no-control-regex.md) | error | Disallow control characters in regular expressions | 282.3M |
| [eslint/no-useless-escape](https://lintradar.dev/rules/eslint/no-useless-escape.md) | error | Disallow unnecessary escape characters | 281.5M |
| [eslint/no-empty-character-class](https://lintradar.dev/rules/eslint/no-empty-character-class.md) | error | Disallow empty character classes in regular expressions | 281.1M |
| [eslint/no-duplicate-case](https://lintradar.dev/rules/eslint/no-duplicate-case.md) | error | Disallow duplicate case labels | 281.1M |
| [eslint/no-empty-pattern](https://lintradar.dev/rules/eslint/no-empty-pattern.md) | error | Disallow empty destructuring patterns | 281.1M |
| [eslint/no-self-assign](https://lintradar.dev/rules/eslint/no-self-assign.md) | error | Disallow assignments where both sides are exactly the same | 281.1M |
| [eslint/valid-typeof](https://lintradar.dev/rules/eslint/valid-typeof.md) | error | Enforce comparing `typeof` expressions against valid strings | 280.8M |
| [eslint/no-debugger](https://lintradar.dev/rules/eslint/no-debugger.md) | error | Disallow the use of `debugger` | 278.2M |
| [eslint/no-extra-boolean-cast](https://lintradar.dev/rules/eslint/no-extra-boolean-cast.md) | error | Disallow unnecessary boolean casts | 278.2M |
| [eslint/no-irregular-whitespace](https://lintradar.dev/rules/eslint/no-irregular-whitespace.md) | error | Disallow irregular whitespace | 277.6M |
| [eslint/no-async-promise-executor](https://lintradar.dev/rules/eslint/no-async-promise-executor.md) | error | Disallow using an async function as a Promise executor | 277M |
| [eslint/no-compare-neg-zero](https://lintradar.dev/rules/eslint/no-compare-neg-zero.md) | error | Disallow comparing against `-0` | 277M |
| [eslint/no-misleading-character-class](https://lintradar.dev/rules/eslint/no-misleading-character-class.md) | error | Disallow characters which are made with multiple code points in character class syntax | 277M |
| [eslint/no-unsafe-finally](https://lintradar.dev/rules/eslint/no-unsafe-finally.md) | error | Disallow control flow statements in `finally` blocks | 277M |
| [eslint/no-useless-catch](https://lintradar.dev/rules/eslint/no-useless-catch.md) | error | Disallow unnecessary `catch` clauses | 277M |
| [eslint/require-yield](https://lintradar.dev/rules/eslint/require-yield.md) | error | Require generator functions to contain `yield` | 276.9M |
| [eslint/no-unused-labels](https://lintradar.dev/rules/eslint/no-unused-labels.md) | error | Disallow unused labels | 276.7M |
| [eslint/no-loss-of-precision](https://lintradar.dev/rules/eslint/no-loss-of-precision.md) | error | Disallow literal numbers that lose precision | 276.6M |
| [eslint/no-constant-condition](https://lintradar.dev/rules/eslint/no-constant-condition.md) | error | Disallow constant expressions in conditions | 276.2M |
| [eslint/no-useless-backreference](https://lintradar.dev/rules/eslint/no-useless-backreference.md) | error | Disallow useless backreferences in regular expressions | 275.8M |
| [eslint/for-direction](https://lintradar.dev/rules/eslint/for-direction.md) | error | Enforce `for` loop update clause moving the counter in the right direction | 272.8M |
| [eslint/no-dupe-else-if](https://lintradar.dev/rules/eslint/no-dupe-else-if.md) | error | Disallow duplicate conditions in if-else-if chains | 272.8M |
| [eslint/no-nonoctal-decimal-escape](https://lintradar.dev/rules/eslint/no-nonoctal-decimal-escape.md) | error | Disallow `\8` and `\9` escape sequences in string literals | 272.8M |
| [eslint/no-unsafe-optional-chaining](https://lintradar.dev/rules/eslint/no-unsafe-optional-chaining.md) | error | Disallow use of optional chaining in contexts where the `undefined` value is not allowed | 272.6M |
| [eslint/no-unused-private-class-members](https://lintradar.dev/rules/eslint/no-unused-private-class-members.md) | error | Disallow unused private class members | 262.3M |
| [typescript/no-duplicate-enum-values](https://lintradar.dev/rules/typescript/no-duplicate-enum-values.md) | error | Disallow duplicate enum member values | 260.7M |
| [typescript/no-non-null-asserted-optional-chain](https://lintradar.dev/rules/typescript/no-non-null-asserted-optional-chain.md) | error | Disallow non-null assertions after an optional chain expression | 260.7M |
| [typescript/no-this-alias](https://lintradar.dev/rules/typescript/no-this-alias.md) | error | Disallow aliasing `this` | 260.7M |
| [typescript/prefer-namespace-keyword](https://lintradar.dev/rules/typescript/prefer-namespace-keyword.md) | error | Require using `namespace` keyword over `module` keyword to declare custom TypeScript modules | 260.7M |
| [typescript/no-extra-non-null-assertion](https://lintradar.dev/rules/typescript/no-extra-non-null-assertion.md) | error | Disallow extra non-null assertions | 260.7M |
| [typescript/no-misused-new](https://lintradar.dev/rules/typescript/no-misused-new.md) | error | Enforce valid definition of `new` and `constructor` | 260.7M |
| [typescript/no-unsafe-declaration-merging](https://lintradar.dev/rules/typescript/no-unsafe-declaration-merging.md) | error | Disallow unsafe declaration merging | 260.7M |
| [typescript/triple-slash-reference](https://lintradar.dev/rules/typescript/triple-slash-reference.md) | error | Disallow certain triple slash directives in favor of ES6-style import declarations | 260M |
| [eslint/no-delete-var](https://lintradar.dev/rules/eslint/no-delete-var.md) | error | Disallow deleting variables | 253.8M |
| [eslint/no-invalid-regexp](https://lintradar.dev/rules/eslint/no-invalid-regexp.md) | error | Disallow invalid regular expression strings in `RegExp` constructors | 252.6M |
| [eslint/no-constant-binary-expression](https://lintradar.dev/rules/eslint/no-constant-binary-expression.md) | error | Disallow expressions where the operation doesn't affect the value | 234.4M |
| [eslint/no-empty-static-block](https://lintradar.dev/rules/eslint/no-empty-static-block.md) | error | Disallow empty static blocks | 234.3M |
| [typescript/prefer-as-const](https://lintradar.dev/rules/typescript/prefer-as-const.md) | error | Enforce the use of `as const` over literal type | 232.2M |
| [typescript/no-wrapper-object-types](https://lintradar.dev/rules/typescript/no-wrapper-object-types.md) | error | Disallow using confusing built-in primitive class wrappers | 232.2M |
| [eslint/no-fallthrough](https://lintradar.dev/rules/eslint/no-fallthrough.md) | error | Disallow fallthrough of `case` statements | 231.5M |
| [eslint/no-regex-spaces](https://lintradar.dev/rules/eslint/no-regex-spaces.md) | error | Disallow multiple spaces in regular expressions | 231.5M |
| [eslint/no-octal](https://lintradar.dev/rules/eslint/no-octal.md) | error | Disallow octal literals | 231.4M |
| [eslint/no-case-declarations](https://lintradar.dev/rules/eslint/no-case-declarations.md) | error | Disallow lexical declarations in case clauses | 226.2M |
| [eslint/no-prototype-builtins](https://lintradar.dev/rules/eslint/no-prototype-builtins.md) | error | Disallow calling some `Object.prototype` methods directly on objects | 226.1M |
| [eslint/prefer-const](https://lintradar.dev/rules/eslint/prefer-const.md) | error | Require `const` declarations for variables that are never reassigned after declared | 223.9M |
| [eslint/prefer-rest-params](https://lintradar.dev/rules/eslint/prefer-rest-params.md) | error | Require rest parameters instead of `arguments` | 220.5M |
| [typescript/no-unnecessary-type-constraint](https://lintradar.dev/rules/typescript/no-unnecessary-type-constraint.md) | error | Disallow unnecessary constraints on generic types | 209.9M |
| [typescript/ban-ts-comment](https://lintradar.dev/rules/typescript/ban-ts-comment.md) | warn | Disallow `@ts-<directive>` comments or require descriptions after directives | 209.9M |
| [typescript/no-explicit-any](https://lintradar.dev/rules/typescript/no-explicit-any.md) | error | Disallow the `any` type | 208.7M |
| [eslint/no-empty](https://lintradar.dev/rules/eslint/no-empty.md) | error | Disallow empty block statements | 197.7M |
| [eslint/no-var](https://lintradar.dev/rules/eslint/no-var.md) | error | Require `let` or `const` instead of `var` | 195.4M |
| [eslint/prefer-spread](https://lintradar.dev/rules/eslint/prefer-spread.md) | error | Require spread operators instead of `.apply()` | 192M |
| [typescript/no-unused-vars](https://lintradar.dev/rules/typescript/no-unused-vars.md) | error | Disallow unused variables | 185.6M |
| [typescript/no-array-constructor](https://lintradar.dev/rules/typescript/no-array-constructor.md) | error | Disallow generic `Array` constructors | 185.6M |
| [typescript/no-unused-expressions](https://lintradar.dev/rules/typescript/no-unused-expressions.md) | error | Disallow unused expressions | 184.8M |
| [typescript/no-unsafe-function-type](https://lintradar.dev/rules/typescript/no-unsafe-function-type.md) | error | Disallow using the unsafe built-in Function type | 181.4M |
| [typescript/no-namespace](https://lintradar.dev/rules/typescript/no-namespace.md) | error | Disallow TypeScript namespaces | 180.7M |
| [typescript/no-floating-promises](https://lintradar.dev/rules/typescript/no-floating-promises.md) | error | Require Promise-like statements to be handled appropriately | 126.5M |
| [eslint/eqeqeq](https://lintradar.dev/rules/eslint/eqeqeq.md) | error | Require the use of `===` and `!==` | 51.1M |
| [eslint/prefer-arrow-callback](https://lintradar.dev/rules/eslint/prefer-arrow-callback.md) | error | Require using arrow functions for callbacks | 42.4M |
| [eslint/no-restricted-properties](https://lintradar.dev/rules/eslint/no-restricted-properties.md) | error | Disallow certain properties on certain objects | 15.3M |
| [eslint/eol-last](https://lintradar.dev/rules/eslint/eol-last.md) | error | Require or disallow newline at the end of files | 14.2M |
| [eslint/no-trailing-spaces](https://lintradar.dev/rules/eslint/no-trailing-spaces.md) | error | Disallow trailing whitespace at the end of lines | 14.2M |
| [eslint/quotes](https://lintradar.dev/rules/eslint/quotes.md) | warn | Enforce the consistent use of either backticks, double, or single quotes | 14.2M |
| [eslint/block-scoped-var](https://lintradar.dev/rules/eslint/block-scoped-var.md) | error | Enforce the use of variables within the scope they are defined | 13.7M |

---

Web page: https://lintradar.dev/presets/gts. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
