-
Notifications
You must be signed in to change notification settings - Fork 889
Conversation
Thanks for your interest in palantir/tslint, @YuichiNukiyama! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request. |
@YuichiNukiyama What do you think of a system where each rule has metadata that's something like |
@jkillian Metadata is good idea. But I won't use all the settings in rules when there is no jsRules option. A lot of developer use other linter for linting js. So we should use unobtrusive setting. If they don't specified any settings in jsRule, We lint nothing. |
@YuichiNukiyama But why would they pass their |
@jkillian You've given a misunderstanding ,because of my poor english. Since the TypeScript-only rule is large, the error occurs frequently when we apply the all rule options. And now many developer use eslint to lint js files. I afraid that these developer apply the jslint to js. |
Let's look at a concrete example to see what makes the most sense. Say we start with this configuration. We then automatically skip any rules that only make sense for TS. For example, Are you saying that this wouldn't work well because a lot of the remaining rules wouldn't work correctly on JS files? |
Sorry for my large commit.
@jkillian I add tests for all rules.
|
@jkillian I add JS recommendations. |
Sorry @YuichiNukiyama, things have been really busy lately! @adidahiya, do you have time to weigh in on this / take a look? |
@YuichiNukiyama we should have time to review this soon, I think @nchen63 can take a look. Could you resolve the merge conflicts? |
@adidahiya Sure. I resolved conflict. |
@@ -47,6 +47,7 @@ export class Rule extends Lint.Rules.AbstractRule { | |||
}, | |||
optionExamples: ['[true, "check-space", "check-lowercase"]'], | |||
type: "style", | |||
typescriptOnly: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this typescript only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Rule don't work well in js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with the PR going in with this rule disabled for js since it's not that hard to add later, but I'm just curious why you think it doesn't work well with js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this rule pass a test. Now, #1635 privent me from doing test...
@@ -29,6 +29,7 @@ export class Rule extends Lint.Rules.AbstractRule { | |||
options: null, | |||
optionExamples: ["true"], | |||
type: "style", | |||
typescriptOnly: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this rule work with js also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Rule don't work well in js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arrow functions supported in es6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@@ -29,6 +29,7 @@ export class Rule extends Lint.Rules.AbstractRule { | |||
options: null, | |||
optionExamples: ["true"], | |||
type: "maintainability", | |||
typescriptOnly: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
js also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Rule don't work well in js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also useful in es6 with the new imports
@nchen63 |
"trace", | ||
], | ||
"no-construct": true, | ||
"no-constructor-vars": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was renamed to no-parameter-properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameter properties is typescript only feature. So, I removed it.
"label-position": true, | ||
"label-undefined": true, | ||
"max-line-length": [true, 120], | ||
"member-access": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this ever rule make sense for JS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, it's not supported in ES.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this.
"no-unused-new": true, | ||
// disable this rule as it is very heavy performance-wise and not that useful | ||
"no-use-before-declare": false, | ||
"no-var-keyword": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this only applies to ES6. I don't think most Javascript users will be targeting that version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this.
Loading tslint.json that extends another config such as "recommended", won't load the base js rules. Please update |
Also update DEFAULT_CONFIG |
@nchen63 I fixed configration.ts. This commit pass ci. But somewhat there is no self-confidence.(I can't test on local.) |
remove old rule label-undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. Thanks!
Thank you for your help 😊 |
You're welcome. Thanks for the contribution! |
@@ -31,6 +31,7 @@ export class Rule extends Lint.Rules.AbstractRule { | |||
options: null, | |||
optionExamples: ["true"], | |||
type: "functionality", | |||
typescriptOnly: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule was deleted on the master branch because it is covered by the compiler. I'm going to delete it again; I don't want to maintain it just for JS files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was removed in next
, but not in master
Related issue
Fixes #515
Usage
I add jsRule option to tslint.json. We can distinguish the rules that apply to js or ts depending on this option.
Good point
Bad point
Note
Now, I test only class-name and curly rule. If you think this PR is good, I add tests for another rules.