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

eslint-config-semistandard-with-typescript? #276

Closed
lemoustachiste opened this issue Apr 21, 2020 · 8 comments
Closed

eslint-config-semistandard-with-typescript? #276

lemoustachiste opened this issue Apr 21, 2020 · 8 comments

Comments

@lemoustachiste
Copy link

lemoustachiste commented Apr 21, 2020

What version of this package are you using?
15.0.1

What problem do you want to solve?
I am coming to this package as I am looking at not installing tslint since it's going in deprecation. Our code style follows semistandard, and I would like to configure eslint for typescript following this style. For tslint we are using: tslint-config-semistandard. But it seems this is not available for eslint.

What do you think is the correct solution to this problem?
I am not sure, hence why I am opening this issue. I tried overriding the rules property in my project's .eslintrc.js file, similarly as to what eslint-config-semistandard does, but that generated more errors and broke snazzy, so I am assuming this is not the right way.

Are you willing to submit a pull request to implement this change?
Yes, provided I am guided on the right way to handle this.

@mightyiam
Copy link
Owner

Thank you for using this config, @lemoustachiste. When using standard, you can't use a configuration file. That's part of the concept. Perhaps you'd like to use standardx or plain eslint extending from this config.

@LinusU
Copy link
Contributor

LinusU commented Apr 21, 2020

@lemoustachiste you should be able to use use and extend eslint-config-standard-with-typescript if you are using ESLint directly, and not via standard or ts-standard.

add this to .eslintrc.json:

{
  "extends": "standard-with-typescript",
  "parserOptions": {
    "project": "./tsconfig.json"
  },
  "rules": {
    "semi": "off",
    "@typescript-eslint/semi": ["error", "always"]
  }
}

run this long command:

npm install --save-dev eslint@6 eslint-plugin-standard@4 eslint-plugin-promise@4 eslint-plugin-import@2 eslint-plugin-node@11 @typescript-eslint/eslint-plugin@2 eslint-config-standard-with-typescript

What errors did you get?


@mightyiam we have always supported overriding rules in the eslint-config-standard* repos, so I think that we should do that here as well ☺️

@LinusU LinusU reopened this Apr 21, 2020
@lemoustachiste
Copy link
Author

Hi @mightyiam,

I'm sorry I think there might have been a misunderstanding. I am not trying to change a lot much from what standard offers. I only want semistandard, but applicable to typescript. Semistandard is supported by this organization: https://github.com/standard/eslint-config-semistandard.

@LinusU you reopened as I was typing. Thanks for your direction, I will try that.

@mightyiam
Copy link
Owner

@lemoustachiste forgive me. I thought you were trying to configure standard. The example provided by @LinusU should be sufficient. Thank you, @LinusU.

@raiseandfall
Copy link

@LinusU it worked for me. Thanks!

@flisboac
Copy link

@lemoustachiste you should be able to use use and extend eslint-config-standard-with-typescript if you are using ESLint directly, and not via standard or ts-standard.

add this to .eslintrc.json:

{
  "extends": "standard-with-typescript",
  "parserOptions": {
    "project": "./tsconfig.json"
  },
  "rules": {
    "semi": "off",
    "@typescript-eslint/semi": ["error", "always"]
  }
}

run this long command:

npm install --save-dev eslint@6 eslint-plugin-standard@4 eslint-plugin-promise@4 eslint-plugin-import@2 eslint-plugin-node@11 @typescript-eslint/eslint-plugin@2 eslint-config-standard-with-typescript

What errors did you get?

@mightyiam we have always supported overriding rules in the eslint-config-standard* repos, so I think that we should do that here as well relaxed

@LinusU Do you know if this approach works or can be integrated with Standard's official VSCode plugin? I haven't tested yet, but AFAICT, it won't work, because the plugin expects standard executables; it does not use eslint directly, I think (please, correct me if I'm wrong).

If that's indeed what would happen, then there's a case to be made for a new eslint-config-semistandard-with-typescript, so that we can have a ts-semistandard, the same way we already have a semistandard, don't you think?

Or even if you don't agree, making it easier for TypeScript programmers to adopt semistandard (not standard) whenever there's a valid reason for it (and I'm sure there are) is a good thing, too. I personally do NOT contest any rule, in any way, apart from semi, and I'm sure all semistandard (and TypeScript) users have the same opinion.

@AntonOfTheWoods
Copy link

@flisboac , I think most of us typescripters who see semi as a deal-breaker only care about this rule. But the zealotry on this is a major turnoff. If I didn't have to memorize several rules that will never get caught by an IDE, I might think about it but nosemi is objectively just dumb. But it shouldn't be part of standard, it should be part of the language, period! Or rather semi-colon ;)

@flisboac
Copy link

flisboac commented Dec 16, 2021

@AntonOfTheWoods I fully agree, but it is what it is... :(

I still think this issue should be reopened.

I understand they want to segregate the userbase between semi and non-semi. I honestly don't think the nosemi side of the debate has any good arguments in favor of it, and I frankly don't care about any reasoning anymore. I just don't get why they oppose so much to create the semistandard counterpart on the TypeScript side. Such unbalance makes no sense.

Still, I truly hope they reconsider, and create a fully complete "ts-semistandard" already. I'd switch to it instantly. The editor/IDE tooling is just as important as the standard itself.

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

6 participants