Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Extended configuration does not apply to JS files #4564

Closed
deskoh opened this issue Mar 3, 2019 · 4 comments
Closed

Extended configuration does not apply to JS files #4564

deskoh opened this issue Mar 3, 2019 · 4 comments

Comments

@deskoh
Copy link

deskoh commented Mar 3, 2019

Feature request

Currently using using a tslint rules that extends tslint-config-airbnb. However, the rules does not seem to apply to JS files after setting "jsRules" property set to true. The documentation also did not specify whether this is the intended behaviour.

Example tslint.json file:

{
  "defaultSeverity": "error",
  "extends": [
    "tslint-config-airbnb"
  ],
  "jsRules": true
}
function test() {
  // No lint errors for `prefer-const` rule even though it is defined in `tslint-config-airbnb`.
  let x = 1;
}

The prefer-const rule need to be added explicitly:

{
  "defaultSeverity": "error",
  "extends": [
    "tslint-config-airbnb"
  ],
  "jsRules": {
    "prefer-const": true,
  }
}

Any solution for the extended rules to also apply to JS files?

@JoshuaKGoldberg
Copy link
Contributor

👋 @deskoh, is this a duplicate of #4513?

@deskoh
Copy link
Author

deskoh commented Mar 4, 2019

Slightly different. Currently using tsc 5.13.1.

tsconfig.json has "allowJs" set to true, running tslint -p . for the following tslint.json has different results:

// Does not flag prefer-const errors in JS files
{
    "defaultSeverity": "error",
    "extends": [
        "tslint:recommended"
    ],
    "jsRules": true,
    "rules": {},
    "rulesDirectory": []
}
// Flag prefer-const errors in JS files
{
    "defaultSeverity": "error",
    "extends": [
        "tslint:recommended"
    ],
    "jsRules": {
        "prefer-const": true
    },
    "rules": {},
    "rulesDirectory": []
}

@JoshuaKGoldberg
Copy link
Contributor

💀 It's time! 💀

TSLint is being deprecated and no longer accepting pull requests for major new changes or features. See #4534. 😱

If you'd like to see this change implemented, you have two choices:

  • Recommended: Check if this is available in ESLint + typescript-eslint
  • Not Recommended: Fork TSLint locally 🤷‍♂️

👋 It was a pleasure open sourcing with you!

If you believe this message was posted here in error, please comment so we can re-open the issue!

@JoshuaKGoldberg
Copy link
Contributor

🤖 Beep boop! 👉 TSLint is deprecated 👈 (#4534) and you should switch to typescript-eslint! 🤖

🔒 This issue is being locked to prevent further unnecessary discussions. Thank you! 👋

@palantir palantir locked and limited conversation to collaborators Mar 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants