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

Replace TSLint with ESLint #967

Closed
abdonrd opened this issue Jul 24, 2019 · 4 comments · Fixed by #969
Closed

Replace TSLint with ESLint #967

abdonrd opened this issue Jul 24, 2019 · 4 comments · Fixed by #969

Comments

@abdonrd
Copy link
Contributor

abdonrd commented Jul 24, 2019

Ad TSLint is being deprecated in favor of ESLint, I want to propose to replace it.
Also, good moment to add pre-commit hook for linting and format.

References

Proposal

Use @typescript-eslint, husky and lint-staged.

package.json

  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^2.0.0",
    "@typescript-eslint/parser": "^2.0.0",
    "eslint": "^6.2.0",
    "husky": "^3.0.0",
    "lint-staged": "^9.2.0"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "**/*.{js,ts}": [
      "eslint --fix",
      "git add"
    ]
  }

.eslintrc.json

{
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 2018,
    "sourceType": "module"
  },
  "plugins": [
    "@typescript-eslint"
  ]
}

.eslintignore

/lib/
/directives/
/polyfills/
/test/**/*.{d.ts,d.ts.map,js,js.map}
/tools/lib/
/lit-html.{d.ts,d.ts.map,js,js.map}
@abdonrd
Copy link
Contributor Author

abdonrd commented Jul 24, 2019

I have created a draft PR (#969), if you like it I can continue working on it.

@justinfagnani
Copy link
Collaborator

We still use tslint internally at Google, and it sounds like it'll be awhile before we can move off it. I'm not sure how much we gain from keeping the same tooling, but being able to move contributions between systems is nice. cc @rictic and @aomarks

@rictic
Copy link
Collaborator

rictic commented Aug 16, 2019

If there are desirable lint passes in ESLint that aren't in TSLint then I say go for it. Lint errors won't block syncing code and they don't break the build so it's ok if they get a little out of sync.

@abdonrd
Copy link
Contributor Author

abdonrd commented Aug 23, 2019

Also @aomarks already merged ESLint in the Material Web Components project.

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

Successfully merging a pull request may close this issue.

3 participants