Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

$(()=>{}) flags no-jquery-raw-elements #872

Closed
kasugaiasuka opened this issue May 27, 2019 · 3 comments
Closed

$(()=>{}) flags no-jquery-raw-elements #872

kasugaiasuka opened this issue May 27, 2019 · 3 comments
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. 💀 R.I.P. 💀 Type: Bug

Comments

@kasugaiasuka
Copy link

Bug Report

  • tslint-microsoft-contrib version: 6.2.0
  • TSLint version: 5.16.0
  • TypeScript version: 3.4.5
  • Running TSLint via: CLI

TypeScript code being linted

$(async () => {

})

with tslint.json configuration:

{
    "defaultSeverity": "error",
    "extends": [],
    "jsRules": {},
    "rules": {
        "no-jquery-raw-elements": true
    },
    "rulesDirectory": [
        "node_modules/tslint-microsoft-contrib"
    ]
}

Actual behavior

(Error:no-jquery-raw-elements) Replace HTML string manipulation with jQuery API: $(async () => {

})

Expected behavior

No errors.
FYI, tslint-microsoft-contrib@6.1.1 is working properly.

@kasugaiasuka kasugaiasuka changed the title $(async ()=>{}) flags no-jquery-raw-elements $(()=>{}) flags no-jquery-raw-elements May 27, 2019
@kasugaiasuka
Copy link
Author

Oops, that is not a minimum code ("async" is not needed.)

$(() => {

});

// Replace HTML string manipulation with jQuery API: $(() => {
// 
// })

@IllusionMH IllusionMH added Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Status: Accepting PRs Type: Bug labels May 27, 2019
@IllusionMH
Copy link
Contributor

Looks like regression after migration to the new format.

Previously if first arguments wasn't a string - new walker was created and recursively checked strings for < or > characters in string literals, however new one looks for same characters in any expression text.

Good solution will be to check if first argument is a function expression or an arrow function, and only then check recursively as it was in old implementation.

Accepting PRs

@JoshuaKGoldberg
Copy link

💀 It's time! 💀

TSLint is deprecated and no longer accepting pull requests other than security fixes. See #876. ☠️
We recommend you instead use typescript-eslint to lint your TypeScript code with ESLint. ✅

👋 It was a pleasure open sourcing with you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. 💀 R.I.P. 💀 Type: Bug
Projects
None yet
Development

No branches or pull requests

3 participants