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

Any plans to support ESLint? #19

Closed
rsp opened this issue Nov 13, 2019 · 4 comments
Closed

Any plans to support ESLint? #19

rsp opened this issue Nov 13, 2019 · 4 comments

Comments

@rsp
Copy link

rsp commented Nov 13, 2019

Since the core TypeScript and VS Code team is moving from TSLint to ESLint, and as ESLint is getting help from Microsoft with the TypeScript compatibility (see The future of TypeScript on ESLint) are there any plans for TypeStrict to support ESLint as well, like including an ESLint config with similar rules in addition to tslint.js?

TypeScript Roadmap: January - June 2019 - microsoft/TypeScript#29288:

ESLint already has the more-performant architecture we're looking for from a linter. Additionally, different communities of users often have lint rules (e.g. rules for React Hooks or Vue) that are built for ESLint, but not TSLint.

Given this, our editor team will be focusing on leveraging ESLint rather than duplicating work. For scenarios that ESLint currently doesn't cover (e.g. semantic linting or program-wide linting), we'll be working on sending contributions to bring ESLint's TypeScript support to parity with TSLint. As an initial testbed of how this works in practice, we'll be switching the TypeScript repository over to using ESLint, and sending any new rules upstream.

TypeScript Roadmap: July - December 2019 - microsoft/TypeScript#33118:

ESLint is now a capable linter for TypeScript projects. There is room for improvement in editor scenarios, but we'll focus on core editor functionality and performance for JavaScript/TypeScript. We will monitor TypeScript integration in ESLint and assist the project when needed.

@rsp
Copy link
Author

rsp commented Nov 13, 2019

Actually, the TSLint itself is going to be deprecated soon. See, TSLint's README:

⚠️ TSLint will be deprecated some time in 2019. See this issue for more details: Roadmap: TSLint → ESLint. (palantir/tslint#4534)

See also, TSLint in 2019 post on Medium:

Palantir is the creator and primary maintainer of TSLint, the standard linter for the TypeScript programming language. As the TypeScript community is working toward a unified developer experience across the TypeScript and JavaScript languages, we are committed to support the convergence of TSLint and ESLint; in this blog post we explain the Why and How of our efforts.
[...]
In order to avoid bifurcating the linting tool space for TypeScript, we therefore plan to deprecate TSLint and focus our efforts instead on improving ESLint’s TypeScript support.

There is some interesting discussion in the Roadmap: TSLint → ESLint issue (palantir/tslint#4534).

I'd love to keep using TypeStrict as my recommended linter config for the projects that I work on, so it would be good to know what is the plan regarding the TSLint deprecation.

@rsp
Copy link
Author

rsp commented Nov 13, 2019

Since TypeStrict is using SonarTS and tslint-microsoft-contrib and both of them are moving to ESLint, here is some some relevant info:

There is a tslint-to-eslint-config migration tool. Currently run on the TypeStrict config it outputs:

module.exports = {
    "env": {
        "browser": true,
        "es6": true
    },
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "project": "tsconfig.json",
        "sourceType": "module"
    },
    "plugins": [
        "@typescript-eslint",
        "@typescript-eslint/tslint"
    ],
    "rules": {
        "@typescript-eslint/await-thenable": "error",
        "@typescript-eslint/no-floating-promises": "error",
        "@typescript-eslint/no-misused-new": "error",
        "@typescript-eslint/no-use-before-declare": "error",
        "@typescript-eslint/restrict-plus-operands": "error",
        "constructor-super": "error",
        "no-invalid-this": "error",
        "no-restricted-syntax": [
            "error",
            "ForInStatement"
        ],
        "use-isnan": "error",
        "@typescript-eslint/tslint/config": [
            "error",
            {
                "rules": {
                    "no-accessor-field-mismatch": true,
                    "no-all-duplicated-branches": true,
                    "no-collection-size-mischeck": true,
                    "no-dead-store": true,
                    "no-duplicated-branches": true,
                    "no-element-overwrite": true,
                    "no-empty-destructuring": true,
                    "no-gratuitous-expressions": true,
                    "no-identical-conditions": true,
                    "no-identical-expressions": true,
                    "no-ignored-return": true,
                    "no-inferred-empty-object-type": true,
                    "no-multiline-string-literals": true,
                    "no-promise-as-boolean": true,
                    "no-self-assignment": true,
                    "no-unconditional-jump": true,
                    "no-unthrown-error": true,
                    "no-unused-array": true,
                    "no-unused-variable": [
                        true,
                        "check-parameters",
                        {
                            "ignore-pattern": "^_"
                        }
                    ],
                    "no-useless-cast": true,
                    "no-useless-increment": true,
                    "no-variable-usage-before-declaration": true,
                    "promise-must-complete": true,
                    "strict-comparisons": true
                }
            }
        ]
    }
};

with this info:

✨ 9 rules replaced with their ESLint equivalents. ✨
📢 1 ESLint rule behaves differently from their TSLint counterparts: 📢
* no-invalid-this:
  - Functions in methods will no longer be ignored.
️👀 24 rules do not yet have ESLint equivalents (see generated log file); defaulting to eslint-plugin-tslint for these rules. 👀

Hopefully, as soon as both SonarTS and tslint-microsoft-contrib are migrated, it will be possible to simply convert TypeStrict to ESLint with the tslint-to-eslint-config command.

@krzkaczor
Copy link
Owner

I am 100% aware of the situation :) and yes - the plan is to migrate to eslint based config as soon as it's ready.

Hopefully, as soon as both SonarTS and tslint-microsoft-contrib are migrated, it will be possible to simply convert TypeStrict to ESLint with the tslint-to-eslint-config command.

Yes exactly - that's what I am hoping for 😆

I am thinking - maybe we should create tmp branch v2.0.0 with initial migration already started 🤔

@krzkaczor
Copy link
Owner

Solved! Try npm package: eslint-config-typestrict

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

2 participants