Skip to content

Commit

Permalink
Disalble remaining TSLint rules
Browse files Browse the repository at this point in the history
The `@typescript-eslint/eslint-plugin-tslint` does not support ESLint v9,
and out of the remaining TSLint rules only a few rules do not have a replacement.

The following remaining rules were removed:

- `encoding` - UTF-8 is configured in `tsconfig.json` (the `charset` option).
- `import-spacing` - covered by the `@stylistic/ts/keyword-spacing` and `@stylistic/ts/object-curly-spacing` rules.
- `no-default-import` - irrelevant, as it requires a list of modules.
- `no-inferred-empty-object-type` - the rule is not irrelevant since TS 3.4.
- `no-mergeable-namespace` - irrelevant, as `@typescript-eslint/no-namespace` is enabled and namespaces are not allowed.
- `no-tautology-expression` - covered by the `no-self-compare`, `sonarjs/ no-identical-expressions`,
  and `no-constant-condition` rules.
- `no-unnecessary-callback-wrapper` - does not have a replacement.
  Without this rule the following code will not be flagged:
  ```
  input.map(x => same(x))
  ```
- `prefer-conditional-expression` - the rule is covered by the `unicorn/prefer-ternary` rule, if needed,
  but `unicorn/prefer-ternary` is disabled by default.
- `prefer-switch` - covered by the `unicorn/prefer-switch` rule.
- `prefer-while` - covered by the `sonarjs/prefer-while` rule.
- `return-undefined` - partially covered by the `no-useless-return` rule.
- `static-this` - does not have a replacement.
  Without this rule the following code will not be flagged:
  ```
  public static example() {
      return this.name;
  }
  ```
- `strict-comparisons` - does not have a replacement.
  Without this rule the following code will not be flagged:
  ```
  const o1 = {};
  const o2 = {};
  if (o1 > o2) { /*...*/ }
  ```
- `strict-type-predicates` - does not have a replacement, but has already been disabled.
- `switch-final-break` - does not have a replacement, due to `@typescript-eslint/switch-exhaustiveness-check`,
  the final statement in a `switch` is always `default`, so the issue is non-critical.
  Without this rule the following code will not be flagged:
  ```
  switch (a) {
      case 'a':
          r = 1;
          break;
      default:
          r = 2;
  }
  ```
  • Loading branch information
amikheychik committed Nov 11, 2024
1 parent 2dc1f6c commit ac1ef72
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 121 deletions.
6 changes: 0 additions & 6 deletions src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ export {
TypescriptEslintNamingConventionSelector,
TypescriptEslintNamingConventionUnderscore,
} from './rules/typescript-eslint/rules/typescript-eslint-naming-convention';
export {
TsLintRule,
TsLintRules,
TypescriptEslintTslintConfig,
typescriptEslintTslintConfig,
} from './rules/typescript-eslint/rules/typescript-eslint-tslint-config';
export {
UnicornPreventAbbreviationReplacements,
UnicornPreventAbbreviations,
Expand Down

This file was deleted.

This file was deleted.

4 changes: 1 addition & 3 deletions src/rules/typescript-eslint/tslint.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { typescriptEslintTslintConfig } from './rules/typescript-eslint-tslint-config';

export = {
plugins: [
'@typescript-eslint/tslint',
],
rules: {
'@typescript-eslint/tslint/config': ['warn', typescriptEslintTslintConfig()],
'@typescript-eslint/tslint/config': 'off',
},
};
1 change: 1 addition & 0 deletions src/rules/unicorn/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ The `link:https://github.com/sindresorhus/eslint-plugin-unicorn[eslint-plugin-un
| Yes
| Yes
| Off
4+| Reduces readability for `yield`, `await`, `throw` statements.

| `link:{eslint-unicorn-rules}/prefer-ternary.md[unicorn/prefer-top-level-await]`
|
Expand Down

0 comments on commit ac1ef72

Please sign in to comment.