export interface TSInterface {
id: number;
name: string;
}
with tslint.json configuration:
{
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"interface-name": [
true,
"never-prefix"
]
},
"rulesDirectory": []
}
This change breaks TSLint completely. If I add this, suddenly the rules start acting out. I need to start manually writing rules.
For instance, this makes trailing-comma activate and if I don't write it in the new tslint.json, it just keeps showing errors on code that wasn't flagged as such before. Trying to override a rule makes some rules go haywire?
After writing the new trailing-comma rule, then alphabetical order activates, after I fix that something else and it just keeps going and going.
I want to be able to write OVERRIDES for certain rules, not write everything from scratch.
It will take me a week to write everything again, when the only thing I want to change is the interface-name rule.
I don't care about downloading some presets because I want to change a single rule. This should not have to be so complicated.
edit: this might also be an issue with TSLint extension for VS Code, but for now I would like to show you what I had to write for my project to work.
{
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"interface-name": false,
"trailing-comma": false,
"ordered-imports": false,
"member-ordering": false,
"object-literal-sort-keys": false,
"array-type": [
true,
"generic"
],
"max-classes-per-file": false,
"object-literal-shorthand": false
},
"rulesDirectory": []
}
I'm pretty sure this works. Can you confirm that this still isn't working for you?
Nope, can't get it to work. It seems to "break" if I add a rule here.
I saw a lot of tutorials there about this, but this doesn't work for me, nor my colleagues at work.
We have several projects set up and depending on the project, more or less of these settings had to be overriden. For my project, only these ones had to be included. I don't really understand what's happening behind it but it's strange.
I believe it doesn't break if I add a rule that is "safe". For instance, that array-type wasn't broken, I just changed it.
I'm also unable to override rules.
My tslint.json config looks like:
{
"extends": ["tslint:recommended", "tslint-react"],
"rules": {
// Don't require prefix interface with 'I''
"interface-name": false,
// Use: '
"quotemark": [true, "single", "avoid-escape"]
}
}
When I run:
tslint -v
5.11.0
tslint -p .
.... a lot of errors like:
/home/node/src/registerServiceWorker.js[114, 7]: ' should be "
When I comment out the extends: line, it works as expected.
From the docs: Any rules specified in this block will override those configured in any base configuration being extended.
Heh, nevermind, I un-tangled my snaggle.
I had 1 .js file in my project that was at the bottom of the output:
ERROR: src/types/SurveySummary.ts[1, 34]: " should be '
ERROR: src/registerServiceWorker.js[114, 7]: ' should be "
So that was the error message I read, which didn't seem to be respecting my override. I didn't notice the other messages in .ts files were correct.
I had one .js file in the project, the registerServiceWorker.js which used double quotes (when I wanted single quotes).
Adding a js rule for it made all files fail as expected:
"jsRules": {
"quotemark": [true, "single", "avoid-escape"]
}
Override appears to be working!
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:
๐ 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!_
๐ค 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! ๐