Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a TypeScript preset to turn off rules that the tsc compiler correctly transpiles #58

Open
astorije opened this issue Dec 4, 2020 · 0 comments

Comments

@astorije
Copy link

astorije commented Dec 4, 2020

At the moment, we're using one of the restrict-to-esNNNN presets, which are really great. However, when using TypeScript, there are a lot of things that tsc transpiles correctly regardless of target, so we end up "canceling" a set of rules that are perfectly fine with TypeScript:

## ES2020

# Disallow nullish coalescing operators
# https://eslint-plugin-es.mysticatea.dev/rules/no-nullish-coalescing-operators.html
# This is correctly transpiled by TypeScript
es/no-nullish-coalescing-operators: off

# Disallow optional chaining
# https://eslint-plugin-es.mysticatea.dev/rules/no-optional-chaining.html
# This is correctly transpiled by TypeScript
es/no-optional-chaining: off

## ES2019

# Disallow optional catch binding
# https://eslint-plugin-es.mysticatea.dev/rules/no-optional-catch-binding.html
# This is correctly transpiled by TypeScript
es/no-optional-catch-binding: off

## ES2018

# Disallow async iteration
# https://eslint-plugin-es.mysticatea.dev/rules/no-async-iteration.html
# This is correctly transpiled by TypeScript
es/no-async-iteration: off

# Disallow rest/spread properties
# https://eslint-plugin-es.mysticatea.dev/rules/no-rest-spread-properties.html
# This is correctly transpiled by TypeScript
es/no-rest-spread-properties: off

## ES2017

# Disallow async function declarations
# https://eslint-plugin-es.mysticatea.dev/rules/no-async-functions.html
# This is correctly transpiled by TypeScript
es/no-async-functions: off

# Disallow trailing commas in parameter/argument lists
# https://eslint-plugin-es.mysticatea.dev/rules/no-trailing-function-commas.html
# This is correctly transpiled by TypeScript
es/no-trailing-function-commas: off

It would be really nice if there was an extra preset to load at the end that cancels those rule correctly, similarly to how eslint-config-prettier turns off all rules that are unnecessary:

extends:
  - plugin:es/restrict-to-es2015
  - plugin:es/typescript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant